Back to Devexpress

PivotGridControl.OptionsChartDataSource Property

windowsforms-devexpress-dot-xtrapivotgrid-dot-pivotgridcontrol-3eca7610.md

latest4.4 KB
Original Source

PivotGridControl.OptionsChartDataSource Property

Provides access to the options controlling the display of the PivotGrid control’s data in a chart control.

Namespace : DevExpress.XtraPivotGrid

Assembly : DevExpress.XtraPivotGrid.v25.2.dll

NuGet Package : DevExpress.Win.PivotGrid

Declaration

csharp
[XtraSerializableProperty(XtraSerializationVisibility.Content, XtraSerializationFlags.DefaultValue)]
public PivotGridOptionsChartDataSource OptionsChartDataSource { get; }
vb
<XtraSerializableProperty(XtraSerializationVisibility.Content, XtraSerializationFlags.DefaultValue)>
Public ReadOnly Property OptionsChartDataSource As PivotGridOptionsChartDataSource

Property Value

TypeDescription
PivotGridOptionsChartDataSource

A PivotGridOptionsChartDataSource object that contains corresponding options.

|

Remarks

The PivotGrid allows the data it displays to be visualized using a ChartControl. The PivotGrid provides data, and acts as a data source for other controls. It implements the IBindingList interface, and so bound controls are automatically updated when the PivotGrid control’s display information changes.

See the PivotGridOptionsChartDataSource topic to learn about binding a chart control to a PivotGrid control, and about available chart display options.

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
'...

See Also

PivotGridControl Class

PivotGridControl Members

DevExpress.XtraPivotGrid Namespace