Data Filtering allows you to query large data in order to analyze and plot small subset of data entries via filter expressions, all without having to manually modify the datasource bound to the chart.
A complete list of valid expressions and keywords to form a query string can be found here:
NOTE: Any incorrect filter applied will result with an empty chart.
Web Components Chart Data Filter Example
The following example depicts a Column Chart of annual birth rates across several decades. The drop-down allows you to select a decade, which inserts an expression via the initialFilter property, to update the chart visual and thus filtering out the other decades out.
<!DOCTYPE html><html><head><title>Sample | Ignite UI | Web Components | infragistics</title><metacharset="UTF-8" /><linkrel="shortcut icon"href="https://static.infragistics.com/xplatform/images/browsers/wc.png" ><linkrel="stylesheet"href="https://fonts.googleapis.com/icon?family=Material+Icons" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Kanit&display=swap" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Titillium Web" /><linkrel="stylesheet"href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" /><linkrel="stylesheet"href="/src/index.css"type="text/css" /></head><body><divid="root"><divclass="container sample"><divclass="options vertical"><igc-property-editor-panelname="editor"id="editor"description-type="CategoryChart"is-horizontal="true"is-wrapping-enabled="true"><igc-property-editor-property-descriptionproperty-path="InitialFilterHandler"name="InitialFilter"id="InitialFilter"label="Modify Filter"value-type="EnumValue"should-override-default-editor="true"drop-down-names="1950, 1960, 1970, 1980, 1990, 2000, 2010, 2020"drop-down-values="1950, 1960, 1970, 1980, 1990, 2000, 2010, 2020"></igc-property-editor-property-description></igc-property-editor-panel></div><divclass="legend-title">
Annual Birth Rates by World Region
</div><divclass="legend"><igc-legendname="legend"id="legend"orientation="Horizontal"></igc-legend></div><divclass="container fill"><igc-category-chartname="chart"id="chart"chart-type="Column"is-horizontal-zoom-enabled="false"is-vertical-zoom-enabled="false"crosshairs-display-mode="None"y-axis-label-format="{0}M"></igc-category-chart></div></div></div><!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><scriptsrc="src/index.ts"></script><% } %>
</body></html>html
/* shared styles are loaded from: *//* https://static.infragistics.com/xplatform/css/samples */css
Like this sample? Get access to our complete Ignite UI for Web Components toolkit and start building your own apps in minutes. Download it for free.
The initialFilter property is a string that requires the following syntax in order to filter properly. The value requires sets of parenthesesthat include both the filter expression definition, column and value associated with the record(s) filtering in.
eg. To show all countries that start with the letter B:
"(startswith(Country, 'B'))"
eg. Concatenating more than one expression:
"(startswith(Country, 'B') and endswith(Country, 'L') and contains(Product, 'Royal Oak') and contains(Date, '3/1/20'))"
Additional Resources
You can find more information about related chart features in these topics: