Back to Devexpress

SeriesBase.FilterString Property

corelibraries-devexpress-dot-xtracharts-dot-seriesbase-2ea7976f.md

latest5.7 KB
Original Source

SeriesBase.FilterString Property

Gets or sets the current filter expression.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
[DefaultValue("")]
[XtraChartsLocalizableCategory(XtraChartsCategory.Data)]
public string FilterString { get; set; }
vb
<XtraChartsLocalizableCategory(XtraChartsCategory.Data)>
<DefaultValue("")>
Public Property FilterString As String

Property Value

TypeDefaultDescription
StringString.Empty

The current filter expression.

|

Remarks

Use the FilterString property to specify a filter expression that consists of multiple conditions applied to multiple data columns, and apply it to the series’ data. Setting the FilterString property to a new value clears any filters that have been previously applied.

Note that the FilterString and SeriesBase.FilterCriteria properties are dependent. If you update one of them, the other changes as well.

Use Criteria Language Syntax to create a filter expression. Then, assign the expression to the FilterString property:

csharp
Series series = chartControl1.Series[0];
series.FilterString = "CategoryID = 1 Or CategoryID = 3 Or CategoryID = 7";
vb
Dim series As Series = chartControl1.Series(0)
series.FilterString = "CategoryID = 1 Or CategoryID = 3 Or CategoryID = 7"

Alternatively, you can use the FilterCriteria property to set the filter expression. See Criteria Operators for information on supported syntax.

csharp
Series series = chartControl1.Series[0];
series.FilterCriteria = new BinaryOperator("CategoryID", 1, BinaryOperatorType.Equal) |
                        new BinaryOperator("CategoryID", 3, BinaryOperatorType.Equal) |
                        new BinaryOperator("CategoryID", 7, BinaryOperatorType.Equal);
vb
Dim series As Series = chartControl1.Series(0)
series.FilterCriteria = New BinaryOperator("CategoryID", 1, BinaryOperatorType.Equal) Or 
                        New BinaryOperator("CategoryID", 3, BinaryOperatorType.Equal) Or 
                        New BinaryOperator("CategoryID", 7, BinaryOperatorType.Equal)

You can also use the CriteriaOperator.Parse method to convert a filter string to its CriteriaOperator equivalent as follows:

csharp
Series series = chartControl1.Series[0];
series.FilterCriteria = CriteriaOperator.Parse("CategoryID = 1 Or CategoryID = 3 Or CategoryID = 7");
vb
Dim series As Series = chartControl1.Series(0)
series.FilterCriteria = CriteriaOperator.Parse("CategoryID = 1 Or CategoryID = 3 Or CategoryID = 7")

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the FilterString property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

reporting-winforms-use-subreport-to-add-a-chart/CS/Reporting-Use-Subreport-To-Add-A-Chart/Form1.cs#L155

csharp
chart.Parameters.Add(new XRControlParameter("chartCategory", report.Parameters[0]));
chart.Series[0].FilterString = "CategoryID=?chartCategory";
chart.Series[0].ValueDataMembers.AddRange(new string[] { "UnitPrice"});

reporting-winforms-use-subreport-to-add-a-chart/VB/Reporting-Use-Subreport-To-Add-A-Chart/Form1.vb#L145

vb
chartControl1.Parameters.Add(New XRControlParameter("chartCategory", report.Parameters(0)))
chartControl1.Series(0).FilterString = "CategoryID=?chartCategory"
chartControl1.Series(0).ValueDataMembers.AddRange(New String() {"UnitPrice"})

See Also

Filter Series Data

How to: Filter Data

SeriesBase Class

SeriesBase Members

DevExpress.XtraCharts Namespace