Back to Devexpress

PivotGridOptionsChartDataSource Class

corelibraries-devexpress-dot-xtrapivotgrid-09532aa7.md

latest7.4 KB
Original Source

PivotGridOptionsChartDataSource Class

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

Namespace : DevExpress.XtraPivotGrid

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

NuGet Packages : DevExpress.PivotGrid.Core, DevExpress.Win.Navigation

Declaration

csharp
public class PivotGridOptionsChartDataSource :
    PivotGridOptionsChartDataSourceBase
vb
Public Class PivotGridOptionsChartDataSource
    Inherits PivotGridOptionsChartDataSourceBase

The following members return PivotGridOptionsChartDataSource objects:

LibraryRelated API Members
WinForms ControlsPivotGridControl.OptionsChartDataSource
.NET Reporting ToolsXRPivotGrid.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:

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

csharp
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
//...
vb
Imports 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
'...

Inheritance

Object ViewStatePersisterCore BaseOptions PivotGridOptionsBase PivotGridOptionsChartDataSourceBase PivotGridOptionsChartDataSource

See Also

PivotGridOptionsChartDataSource Members

OptionsChartDataSource

ChartControl

DevExpress.XtraPivotGrid Namespace