This document describes how to filter chart data at the chart control level.
Bind a series to a data source. See Lesson 3 - Bind Chart Series to Data for more information on how to bind a series to a data source at design time.
Click the series FilterCriteria property's ellipsis button in the Properties window (you can also use the Chart Designer or Series Collection Editor to access a series). In the invoked Filter UI Editor, use the plus button to add a new condition. Then, select the column name and criteria operator, and specify the operand value.

Use the FilterString Property
The SeriesBase.FilterString property to define an expression used to filter series data. Use Criteria Language Syntax to create the filter expression.
C# |
using DevExpress.XtraCharts;
chartControl1.Series[0].FilterString = "Company='DevAV North' And SaleDate=#2018-12-31#";
|
VB |
Imports DevExpress.XtraCharts
chartControl1.Series(0).FilterString = "Company='DevAV North' And SaleDate=#2018-12-31#"
|
Use the FilterCriteria Property
You can use the SeriesBase.FilterCriteria property instead of SeriesBase.FilterString to build and pass a filter expression. Use Criteria Operators to construct the filter expression.
C# |
using DevExpress.XtraCharts;
using DevExpress.Data.Filtering;
chartControl1.Series[0].FilterCriteria = new BinaryOperator("Company", "DevAV North", BinaryOperatorType.Equal) &
new BinaryOperator("SaleDate", new DateTime(2018, 12, 31), BinaryOperatorType.Equal);
|
VB |
Imports DevExpress.XtraCharts
Imports DevExpress.Data.Filtering
chartControl1.Series(0).FilterCriteria = New BinaryOperator("Company", "DevAV North", BinaryOperatorType.Equal) And New BinaryOperator("SaleDate", New DateTime(2018, 12, 31), BinaryOperatorType.Equal)
|
To convert a filter string to its CriteriaOperator equivalent, call the CriteriaOperator.Parse method.
C# |
using DevExpress.XtraCharts;
using DevExpress.Data.Filtering;
chartControl1.Series[0].FilterCriteria = CriteriaOperator.Parse("Company='DevAV North' And SaleDate=#2018-12-31#");
|
VB |
Imports DevExpress.XtraCharts
Imports DevExpress.Data.Filtering
chartControl1.Series(0).FilterCriteria = CriteriaOperator.Parse("Company='DevAV North' And SaleDate=#2018-12-31#")
|
You can access a collection of points the Chart generates based on the filter expression in the ChartControl.BoundDataChanged event handler:
C# |
chartControl1.BoundDataChanged += ChartControl1_BoundDataChanged;
private void ChartControl1_BoundDataChanged(object sender, EventArgs e) {
SeriesPointCollection filteredPoints = chartControl1.Series[0].Points;
}
|
VB |
chartControl1.BoundDataChanged += ChartControl1_BoundDataChanged
Private Sub ChartControl1_BoundDataChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim filteredPoints As SeriesPointCollection = chartControl1.Series(0).Points
End Sub
|
For example, a form contains a Chart Control, Accordion Control, and Filtering UI Context. To filter a series generated from a template, click the FilteringUIContext's smart tag and set its Client property to the Chart Control.
Next, call the FilteringUIContext.RetrieveFields() method in the Form.Load event handler to initialize the filters. See the Filtering UI Context: Retrieve Fields and Create the Filter UI section for more information.
C# |
private void Form1_Load(object sender, EventArgs e) {
filteringUIContext.RetrieveFields();
}
|
VB |
Private Sub Form1_Load(sender As Object, e As EventArgs)
filteringUIContext.RetrieveFields()
End Sub
|
Now, the Chart Control uses the Filtering UI to manage series' SeriesBase.FilterCriteria.

Refer to the Filtering Attributes guide for more information on how to customize the Filtering UI.
To filter an individual series's data, initialize the Filtering UI at runtime. The following code demonstrates how to use a custom filter model to filter series data. Note that in this case, you should use the FilteringUIContext.SetFilterCriteriaBinding method instead of the Client property to bind the Context to the SeriesBase.FilterCriteria property.
Form1.cs |
Series ProductSeries { get { return chartControl.Series["Products"]; } }
List<Product> Products { get; set; }
FilterViewModel FilterViewModel { get; set; }
private void Form1_Load(object sender, EventArgs e) {
ProductSeries.DataSource = Products;
ProductSeries.ArgumentDataMember = "ProductName";
ProductSeries.ValueDataMembers.AddRange("OnOrderIncome");
filteringUIContext.ParentViewModel = FilterViewModel;
filteringUIContext.ModelType = typeof(Product);
filteringUIContext.SetFilterCriteriaBinding(ProductSeries, s => s.FilterCriteria);
filteringUIContext.RetrieveFields();
}
|
Form1.vb |
Private ReadOnly Property ProductSeries() As Series
Get
Return chartControl.Series("Products")
End Get
End Property
Private Property Products() As List(Of Product)
Private Property FilterViewModel() As FilterViewModel
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
ProductSeries.DataSource = Products
ProductSeries.ArgumentDataMember = "ProductName"
ProductSeries.ValueDataMembers.AddRange("OnOrderIncome")
filteringUIContext.ParentViewModel = FilterViewModel
filteringUIContext.ModelType = GetType(Product)
filteringUIContext.SetFilterCriteriaBinding(ProductSeries, Function(s) s.FilterCriteria)
filteringUIContext.RetrieveFields()
End Sub
|