Apply and delete filters
Applying filters
There are two ways in which you can apply filters to a Vizpad:
Local Filter (filters applied to a Viz)
Global filters (filters applied to all the Viz in a Vizpad)
Local filter
To apply a local filter, the following fields need to be provided:
actionType: vizFilter
vizID: ID of the Viz
column: column name for which the filter is to be applied
value: value to be applied
operator: operator to be applied
When the following code is applied, the filter "Sales >= 10000" will be applied to the individual Viz (of ID "vizID_for_local_filter) of a Vizpad.
telliusFrame.postMessage ({
actionType: "vizFilter",
filters: [{
vizId: "vizID_for_local_filter",
value: "10000",
column: "Sales",
operator: ">="
}]
}, "*");
Global filter
To apply a global filter at the tab level, the following fields need to be provided:
actionType: vizpadFilter
column: column name for which the filter is to be applied
value: value to be applied
operator: operator to be applied
allTabs: If set to
true
, then the filters will be applied for all the tabs in a Vizpad. If set tofalse
, then the filters will be applied only to the currently active tab.
When the following code is applied, the filter "Ship_Mode does not contain 'same'" will be applied to all the Viz present in the current tab (since allTabs is set to false
) of a Vizpad.
telliusFrame.postMessage ({
actionType: "vizpadFilter",
filters: [{
value: "Same",
column: "Ship_Mode",
operator: "Does not contain"
}],
allTabs: false
}, "*");
Supported filters
The following are the types of filters supported in a Vizpad:
Operators
Timeline filters
Resolution filters
Operators
< (less than)
<= (less than or equal to)
> (greater than)
>= (greater than or equal to)
= (equal to)
!= (not equal to)
>= & <= (between)
in
not in
like (contains, starts with, ends with)
not like (does not contain, does not start with)
Here is a sample code for like operator that uses conditionName field.
telliusFrame.postMessage({
actionType: "vizFilter",
filters: [{
vizId: "ID_of_Viz",
value: "New",
column: "store_state",
operator: "like",
conditionName: "starts with"
}]
}, "*");
Here is a sample code for using between operator:
telliusFrame.postMessage({
actionType: "vizFilter",
filters: [{
vizId: "ID_of_Viz",
value: "900",
column: "Shipping_Cost",
operator: ">=",
}, {
vizId: "ID_of_Viz",
value: "1200",
column: "Shipping_Cost",
operator: "<="
}]
}, "*");
Timeline filters
The following operators are supported for timeline filters
Today
Yesterday
Last 5 days
Last 7 days
Last 15 days
Last 30 days
Last week
Last month
This month
Last 3 months
Last 6 months
This year
Last year
Last 3 years
Last 6 years
Custom range (user-defined time period)
Here is a sample code for applying custom time range:
telliusFrame.postMessage ({
actionType: "vizFilter",
filters: [{
value: {
start: "2014-02-18T00:00:00Z",
end: "2018-02-18T00:00:00Z"
},
column: "Ship_Date",
filterKind: "vizTimelineFilter",
vizId: "ID_of_Viz",
}]
}, "*");
Resolution filters
The following operators are supported for the resolution filter:
Hourly
Daily
Weekly
Monthly
Quarterly
Yearly
Here is a sample code for applying the resolution filter:
telliusFrame.postMessage({
actionType: "resolution",
timeColumn: {
resolution: "quarterly",
}
}, "*");
Removing filters
To remove a filter (local or global), the following fields need to be provided:
actionType: remove all filters or a specific filter from a Viz/Vizpad
Id: ID of the filter
vizID: ID of the Viz (if required)
The following are some of the code samples on removing filters in different ways:
To remove all filters applied to a Vizpad
telliusFrame.postMessage({
actionType: "removeAllVizFilter"
}, "*");
To remove a specific filter applied to a Vizpad (removes the specific filter from all the Viz and all the tabs)
telliusFrame.postMessage({
actionType: "removeVizpadFilter",
id: "advancedFilter_idD_5j7kiov0e",
}, "*");
To remove a specific filter applied to a Viz
telliusFrame.postMessage({
actionType: "removeVizFilter",
vizId: "f086db5c-e824-4bce-a1ec-07d005d8196f",
id: "advancedFilter_idD_maqkb30lh",
}, "*");
Was this helpful?