EN | ES
Table of Contents |
---|
Introduction
The platform allows you to define complex filters in our your gadgets and dashboards, in a simple way.
We You can define gadgets with filters as we have done until now, by clicking on a point in the graph or a bar, for example.
Besides, we you can define a filter form to filter the gadget itself where the form is defined and, by means of the datalink we , you have the option to indicate whether we you want these filters to be applied to other gadgets or not.
Additionally, a new type of gadget has been incorporated: the gadget filter.
This gadget will display a form with the filters defined, and serves as a master filter to filter other gadgets.
These filters can be defined in the Dashboard API messages, in order to create gadgets with defined filters.
Creating filters in a Gadget
First, we create a gadget. For this example, we you will use the Helsinkipopulation ontology and create a bar gadget:
In dashboard , editing mode, we click on the three-dot icon of the gadget menu and then on the Edit Filters entry.
We are You will be shown this modal window:
It has three sections:
...
ADD NEW FILTER:
Form where we you can fill in the filter data.
In the form, we you define the identifier. It , which must be unique.
Type filter, we to select the type of filter we you want to create, it can be a text filter, numerical filter, ... The fields that appear for us you to fill in, will depend on that choice.
FILTER LAYOUT:
It has three entriesinputs:
- Show filters in modal: If checked, it shows the filter form in a modal window.
...
- Hide active filters:
...
- If checked, it hides the badgets, which indicate which filters are affecting the gadget.
...
- Hide button clean filters: If checked, it hides the clean filter button on the form.
As an example, we will you can now create a simple numerical filter over on the year:
We press Press CREATE.
When creating it, it is added to the filter list of filters.
We close Close the modal widow and we you will see that a new icon before appears now, because now the gadget has defined filters: . When you press that icon, we you will see the filters form. We click Click OK and see the filtered data.
...
The next step is to create another gadget and see how to filter it from this:
To do this, we create a gadget type line for example, for the same ontology - although it could be for another.
We press Click the datalink icon.
and we create the relation indicating as parameter the filter identifier as a parameter in the gadget source. We write Write year, press the + icon to add the relation, and close the modal window.
We click Click OK on the filter form and see that the two filtered gadgets are there.
If we you press the Clean Filters button, the filters are cleaned and we you will see the initial data again.
...
Using the Filter gadget
We will now Let's create a gadget filter, to filter the two previous gadgets.
To simplify the example, we remove the filter that we you had on in the gadget bars. To do this, we click on the edit filters icon and, in the list of filters, we click on the red icon. If we you wanted to modify it, we you would have to click on the tool instead.
We remove Delete it, and the icon no longer appears in the upper right:
We drag Drag the gadget filter to the dashboard.
...
It appears with this format:
We click Click on the button of the three dots and edit filters, and re- create again a filter for the year less than, and another greater than.
After creating the two filters, the filter gadget will look like this:
Now we , indicate in the datalink the relations with the gadgets. The source will be the gadget filter.
We define Define that it affects one parameter for each of the gadgets. We could You can also make the two filters affect the two gadgets, etc.
If, for example we , you mark min as 1900 and max as 1910, the gadget data will be filtered.
Giving us giving this result. Here we , you can see the badgets where the filter being applied to the gadgets is shown. As previously explained, they these can be either shown or hidden from the modal "edit filters" modal .
Note:
Info | ||
---|---|---|
| ||
In the case of the intervalfilter, two relationships will be created in the datalink with the target gadget, adding the terminations to the filter identifier identifier + startDate and identifier + endDate, for example if we you have a filter gadget with a filter of the intervalfilter type with identifier |
Access from the code to the filters in Gadget templates:
We You have the following functions and variables available to use the filters in the gadgets templates from the JavaScript code, in case it is necessary you need to know what value they have at some time a given point, for example:
Send a data filter:
...
value: value that is sent for that topic.
An example would be:
vm.sendValue(‘topic1’, ‘{actívate:true}’)
...
To access the data structure containing the filters from the JavaScript code of the gadget template, we you can use this variable:
vm.filters
...