This post describes how to set up documents to permit Displayr users to filter pages in an online document (i.e., dashboard).
The user experience
When a user accesses Displayr in View Mode, the top-right of the screen shows a standard set of controls. These allow searching, filtering, exporting, zooming, and getting a full screen display. The image below shows these controls.
When you click Filters it shows a list of set-up and available filters in the project. In this example, the user's selections equate to Males aged 18 to 34 (i.e., Male AND (18-24 OR 25-29 OR 30-34)).
Please click here to access an example of a Displayr document where the user can filter analyses and visualizations.
There are a number of different ways to create filters in Displayr (see 5 Ways to Create a Filter in Displayr for an overview). When creating filters for use by a user in Edit Mode, the best method is usually to:
- Select the variable sets you wish to use to create the filters from the Data Tree (bottom-left of the screen).
- Insert > Filter > Filters from Selected Data.
When you do this, related filters group together as variable sets. This is important because when the user in View Mode selects Filters they will see the filters in the same variable set grouped together, as shown above. Furthermore, filters within the same group work as OR operations.
Ensuring the filters are hooked up to the data
Any tables created in Displayr by dragging or dropping, or created in Q and imported into Displayr, will automatically be filtered if the the user selects from Filters and presses OK. Similarly, charts created from a table using Home > Chart will also have their contents automatically filtered.
If using an R Output, and this includes all the charts and other visualizations in Insert > Visualization, the filtering needs to be set up in one of two ways:
- Have a Displayr table on the same page (presumably hidden from view using Appearance > Hide), with the data in the visualization linked to this table. Thus, when you update the table, the R Outputs linked to it will automatically update.
- By explicitly addressing the filter in the R code in the R output (using the variable called QFilter).
Click here to sign-in to Displayr and access a document that addresses filters in R code.
Click here for more information about applying filters to Displayr documents.