With this object we can build filters to narrow our queries.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
// Filter by attribute var event = cf.Filter('venuecity') .value(['New York','LA']) // Filter by time attribute var event = cf.Filter('saletime') .operation('BETWEEN') .value([ '2008-01-12 00:00:00.000', '2008-02-12 00:00:00.000', ]) // Filter by a metric var event = cf.Filter('pricepaid') .operation('BETWEEN') .value([ 1, 10])
Filters support three types of operations:
NOT IN and
BETWEEN. The last one is used as the examples above for numeric and date fields. If no operation is specified then
IN will be used as default.
It also supports the label property which is useful when filters are applied across sources with different field names but common field labels. Refer to Interaction Manager for advanced interactions across visualizations.
All filters set to a visualization or query by using
.staticFilters() are server filters. This means that the visualization will query the server again to bring the new filtered data.
This type of filter are set with the use of
.clientFilters(). Usually these filters match the same group or field used to aggregate the visualization or query. This way the visual knows how to exclude non-matching data without re-querying the server again.