Skip to main content
A newer version of this page is available. .

SeriesPointFilter.Key Property

Gets or sets the key which is compared to the SeriesPointFilter.Value to filter a series point.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v21.2.dll

NuGet Package: DevExpress.Charts

Declaration

public SeriesPointKey Key { get; set; }

Property Value

Type Description
SeriesPointKey

A SeriesPointKey enumeration value, specifying the coordinate of a series point by which filtering is performed.

Available values:

Name Description
Argument

Specifies that sorting is performed by the argument values of a series’ data points.

Value_1

Specifies that series points are sorted based on the first data value within the SeriesPoint.Values array of a series’s data points. For financial data, Value_1 indicates the Low value. For BoxPlot series, it indicates the Min value.

Value_2

Specifies that series points are sorted based on the second data value within the SeriesPoint.Values array of a series’s data points. For financial data, Value_2 indicates the High value. For BoxPlot series, it indicates the Quartile1 value.

Value_3

Specifies that series points are sorted based on the third data value within the SeriesPoint.Values array of a series’s data points. For financial data, Value_3 indicates the Open value. For BoxPlot series, it indicates the Median value.

Value_4

Specifies that series points are sorted based on the fourth data value within the SeriesPoint.Values array of a series’s data points. For financial data, Value_4 indicates the Close value. For BoxPlot series, it indicates the Quartile3 value.

Value_5

Specifies that series points are sorted based on the fifth data value within the SeriesPoint.Values array of a series’s data points. For BoxPlot series, it indicates the Max value.

Value_6

Specifies that series points are sorted based on the sixth data value within the SeriesPoint.Values array of a series’s data points. For BoxPlot series, it indicates the Mean value.

Remarks

Use the Key property to select the points for displaying as exploded slices in the Pie and Donut Series Views.

Example

The following example demonstrates how to create a ChartControl with a series of the PieSeriesView type, and add this chart to a form at runtime.

Note that this series view type is associated with the SimpleDiagram type, and you should cast your diagram object to this type, in order to access its specific options.

using System;
using System.Windows.Forms;
using DevExpress.XtraCharts;
// ...

namespace Series_PieChart {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e) {
            // Create an empty chart.
            ChartControl pieChart = new ChartControl();

            // Create a pie series.
            Series series1 = new Series("A Pie Series", ViewType.Pie);

            // Populate the series with points.
            series1.Points.Add(new SeriesPoint("Russia", 17.0752));
            series1.Points.Add(new SeriesPoint("Canada", 9.98467));
            series1.Points.Add(new SeriesPoint("USA", 9.63142));
            series1.Points.Add(new SeriesPoint("China", 9.59696));
            series1.Points.Add(new SeriesPoint("Brazil", 8.511965));
            series1.Points.Add(new SeriesPoint("Australia", 7.68685));
            series1.Points.Add(new SeriesPoint("India", 3.28759));
            series1.Points.Add(new SeriesPoint("Others", 81.2));

            // Add the series to the chart.
            pieChart.Series.Add(series1);

            // Format the the series labels.
            series1.Label.TextPattern = "{A}: {VP:p0}";

            // Adjust the position of series labels. 
            ((PieSeriesLabel)series1.Label).Position = PieSeriesLabelPosition.TwoColumns;

            // Detect overlapping of series labels.
            ((PieSeriesLabel)series1.Label).ResolveOverlappingMode = ResolveOverlappingMode.Default;

            // Access the view-type-specific options of the series.
            PieSeriesView myView = (PieSeriesView)series1.View;

            // Show a title for the series.
            myView.Titles.Add(new SeriesTitle());
            myView.Titles[0].Text = series1.Name;

            // Specify a data filter to explode points.
            myView.ExplodedPointsFilters.Add(new SeriesPointFilter(SeriesPointKey.Value_1,
                DataFilterCondition.GreaterThanOrEqual, 9));
            myView.ExplodedPointsFilters.Add(new SeriesPointFilter(SeriesPointKey.Argument,
                DataFilterCondition.NotEqual, "Others"));
            myView.ExplodeMode = PieExplodeMode.UseFilters;
            myView.ExplodedDistancePercentage = 30;
            myView.RuntimeExploding = true;
            myView.HeightToWidthRatio = 0.75;

            // Hide the legend (if necessary).
            pieChart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False;

            // Add the chart to the form.
            pieChart.Dock = DockStyle.Fill;
            this.Controls.Add(pieChart);
        }
    }
}
See Also