Log In
[Expand]General Information
[Collapse]WinForms Controls
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Collapse]Chart Control
   [Expand]Getting Started
   [Collapse]Providing Data
    [Expand]Providing Data
    [Collapse]Data Representation
      Filtering Data
      Sorting Data
      Calculating Summaries
      Using The Top-N Feature
      Work Time and Workday Configuration
      Empty Points Representation
   [Expand]Appearance Customization
   [Expand]End-User Features
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]Additional Resources
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Expand]eXpressApp Framework
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Filtering Data

This document describes how to filter chart data at the level of the chart control (as opposed to the filtering at the data source's level).


When dealing with large data sources, filtering data at the chart control level may not be as efficient as filtering at the data source level. So, if you need to sort data from a large data source, it's recommended you do so using SQL at the level of your data source.

The chart control provides different ways of applying a filtering criterion to chart data depending on the data population scenarios. The following sections describe the specifics of filtering data when you either create series using series data binding or use the automatic creation approach using the series templates for auto-created series.

Expanded Series Data Binding

If you bind your chart to a data source, and define the SeriesBase.ArgumentDataMember and SeriesBase.ValueDataMembers properties of a series, you can perform complex data filtering based on as many criteria as required using the SeriesBase.DataFilters property. You can define a data column to be used as a filtering criteria, a logical condition, and a value upon which this condition should be applied to that data field.

The following example demonstrates how to create DataFilter objects, and apply their conditions to a series at runtime: How to: Filter Data.

Expanded Using Series Template

To filter chart data when using series templates, use the SeriesBase.DataFilters property. To access the SeriesBase object, use the ChartControl.SeriesTemplate property.

Consider the chart created using series templates, with the series view type set to the Stacked Bar. You can see the initial, unfiltered chart in the following image.

Now, show data for 2003 only. To do this at design time:

  • select the required series, and in the Properties window, locate the SeriesBase.DataFilters property;

  • click its ellipsis button to invoke the Data Filter Collection Editor;

  • in this dialog, click Add to create a new filter condition. And define the required data column for the DataFilter.ColumnName;

  • set the DataFilter.Condition property to the required logical condition, and the DataFilter.Value property - to the desired value;

    Normally, you don't need to manually define the DataFilter.DataType property, since it's set automatically.

  • to apply the changes and quit the dialog, click Close.

The result is shown in the following image.

With the date-time scale type, it's possible to exclude holidays and weekends from an axis scale. To learn more, see the "Days-Off Exclusion and Custom Weeks" section of the Financial Charting topic.

Expanded See Also

How would you rate this topic?​​​​​​​