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

PivotGridOptionsChartDataSource Class

Contains options controlling the display of the PivotGrid’s data in a ChartControl.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.PivotGrid.v19.2.Core.dll

Declaration

public class PivotGridOptionsChartDataSource :
    PivotGridOptionsChartDataSourceBase

The following members return PivotGridOptionsChartDataSource objects:

Library Related API Members
WinForms Controls PivotGridControl.OptionsChartDataSource
Reporting XRPivotGrid.OptionsChartDataSource

Remarks

A PivotGrid control’s data can be visualized in a ChartControl. Use the PivotGridControl.OptionsChartDataSource property to access the options controlling the display of data in a chart control.

The main options provided by the PivotGridOptionsChartDataSource class are:

To display a PivotGrid’s data in a chart control, set the chart control’s properties as follows:

  1. the DataSource property to the PivotGrid object;
  2. the SeriesDataMember property to the “Series” string;
  3. the SeriesTemplate.ArgumentDataMember property to the “Arguments” string;
  4. to the SeriesTemplate.ValueDataMembers collection add an array containing the “Values” string;

Example

The following code shows how to display a Pivot Grid Control’s data in a ChartControl.

If the PivotGridOptionsChartDataSourceBase.ProvideDataByColumns property is set to true, series in the chart control are created based on PivotGrid columns:

Pivot_Chart_ex_ChartDataVertical_True

If the PivotGridOptionsChartDataSourceBase.ProvideDataByColumns property is set to false, series in the chart control are created based on PivotGrid rows:

Pivot_Chart_ex_ChartDataVertical_False

using DevExpress.XtraCharts;

chartControl1.DataSource = pivotGridControl1;
chartControl1.SeriesDataMember = "Series";
chartControl1.SeriesTemplate.ArgumentDataMember = "Arguments";
chartControl1.SeriesTemplate.ValueDataMembers.AddRange(new string[] { "Values" });
// Format display values.
chartControl1.SeriesTemplate.PointOptions.ValueNumericOptions.Format = NumericFormat.Currency;
chartControl1.SeriesTemplate.PointOptions.ValueNumericOptions.Precision = 0;

pivotGridControl1.OptionsChartDataSource.ProvideDataByColumns = true;
//see image 1
//...
pivotGridControl1.OptionsChartDataSource.ProvideDataByColumns = false;
//see image 2
//...
See Also