Series.FilterCriteria Property
Gets or sets the current filter criteria. This is a dependency property.
Namespace: DevExpress.Xpf.Charts
Assembly: DevExpress.Xpf.Charts.v19.2.dll
Declaration
Property Value
Type | Description |
---|---|
CriteriaOperator | The current filter criteria. |
Remarks
Use the FilterCriteria property to create a filter expression that consists of multiple conditions applied to multiple data columns, and apply it to the series’ data. Setting the FilterCriteria property to a new value clears any filters that have been previously applied.
Note that the FilterCriteria and Series.FilterString properties are dependent. If you update one of them, the other changes as well.
Example
Use the Series.FilterCriteria
property to filter series or chart data source using the Criteria Language.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-filter-charts-data-source-using-filter-criteria-syntax-language-t568127.
Public Sub New()
InitializeComponent()
Dim dataStreamInfo As StreamResourceInfo = Application.GetResourceStream(New Uri("Data/GDPStatistic.xml", UriKind.RelativeOrAbsolute))
Dim valueProvider As New XmlGdpValueProvider(dataStreamInfo.Stream)
DataContext = New MainViewModel(valueProvider)
End Sub
Public Class MainViewModel
Private privateGdpValues As IEnumerable(Of GdpValue)
Public Property GdpValues() As IEnumerable(Of GdpValue)
Get
Return privateGdpValues
End Get
Private Set(ByVal value As IEnumerable(Of GdpValue))
privateGdpValues = value
End Set
End Property
'Filter parameters
Private privateMinGdpValue As Double
Public Property MinGdpValue() As Double
Get
Return privateMinGdpValue
End Get
Private Set(ByVal value As Double)
privateMinGdpValue = value
End Set
End Property
Private privateMaxGdpValue As Double
Public Property MaxGdpValue() As Double
Get
Return privateMaxGdpValue
End Get
Private Set(ByVal value As Double)
privateMaxGdpValue = value
End Set
End Property
Private privateStartYear As Integer
Public Property StartYear() As Integer
Get
Return privateStartYear
End Get
Private Set(ByVal value As Integer)
privateStartYear = value
End Set
End Property
Private privateEndYear As Integer
Public Property EndYear() As Integer
Get
Return privateEndYear
End Get
Private Set(ByVal value As Integer)
privateEndYear = value
End Set
End Property
Private privateCountryNames As IEnumerable(Of String)
Public Property CountryNames() As IEnumerable(Of String)
Get
Return privateCountryNames
End Get
Private Set(ByVal value As IEnumerable(Of String))
privateCountryNames = value
End Set
End Property
Private privateContinentNames As IEnumerable(Of String)
Public Property ContinentNames() As IEnumerable(Of String)
Get
Return privateContinentNames
End Get
Private Set(ByVal value As IEnumerable(Of String))
privateContinentNames = value
End Set
End Property
Public Sub New(ByVal valueProvider As XmlGdpValueProvider)
GdpValues = valueProvider.GetValues()
MinGdpValue = GdpValues.Min(Function(gdp) gdp.Value)
MaxGdpValue = GdpValues.Max(Function(gdp) gdp.Value)
StartYear = GdpValues.Min(Function(gdp) gdp.Year)
EndYear = GdpValues.Max(Function(gdp) gdp.Year)
CountryNames = GdpValues.Select(Function(gdp) gdp.CountryName)
ContinentNames = GdpValues.Select(Function(gdp) gdp.ContinentName)
End Sub
End Class
Public Class GdpValue
<FilterLookup(DataSourceMember := "ContinentNames", UseBlanks := False)> _
Public Property ContinentName() As String
<FilterLookup(DataSourceMember := "CountryNames", UseBlanks := False)> _
Public Property CountryName() As String
<FilterRange(MaximumMember := "MaxGdpValue", MinimumMember := "MinGdpValue")> _
Public Property Value() As Double
<FilterRange(MinimumMember := "StartYear", MaximumMember := "EndYear")> _
Public Property Year() As Integer
End Class
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the FilterCriteria 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.