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.v24.1.dll
NuGet Package: DevExpress.Win.PivotGrid
Declaration
[XtraSerializableProperty(XtraSerializationVisibility.Content, XtraSerializationFlags.DefaultValue)]
public PivotGridOptionsChartDataSource OptionsChartDataSource { get; }
Property Value
Type | Description |
---|---|
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:
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
//...