We provide a way to filter data sets dynamically, to affect all the charts that use a specific data set. The filter is a component in itself so it will be using an order, and it will need to be passed an exiting shared data set by name.
The function to use is the following (using s as the Shimoku client):
s.plt.filter( order: int, # Order in the view data: str, # The name of the shared data set field: str, # The field from the data set to be filtered multi_select: bool =False, # Wether to use the multi select for categoricals cols_size: int =4, # The number columns that will occupy the filter rows_size: int =1, # The number of rows that will occupy the filter padding: Optional[str] =None# The padding that will be applie to the filter )
The filter works with 4 types of inputs, for different types of values, this will be inferred by the field to be filtered. The types are:
Numeric values (it lets the user chose the operation):
It lets the user select a range of dates, if we select the range 2021/01/1 - 2021/01/03, the result is:
To use the categorical filter we will use the filtA field. The input is a select dropdown with all the possible options, only one can be selected.
If we set the filter to the value A the result is:
To use the categorical multi select filter we will use the filtB field. The input is a select dropdown with all the possible options, any combination can be selected.
If we set all the values of the filter we get:
It is not recommended to use more than one filter on a single data set, only one filter can have effect on a data set at a time, and this can be confusing for the user.