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

Pivot Charting (Integration with a Pivot Grid Control)

  • 6 minutes to read

This document describes the capability to automatically bridge (link) a chart with a Pivot Grid, lists the auto-defined options that are set after this link, and describes event handlers for manual customizations.

This document consists of the following sections.

Feature Overview

Both the WinForms Chart Control and PivotGridControl are well adapted to pair with each other in your application. While each control provides a specific set of related options, they also share some common properties between controls. This allows you to easily deploy the two as a bundle (or, a Pivot Chart), by simply specifying a Pivot Grid as a chart’s data source.

PivotChart_0

To learn how to bind a Chart control with a Pivot Grid, see the Integration with the Chart Control topic.

A similar functionality is available for bridging the XRChart with the XRPivotGrid.

A Pivot Grid’s data is auto-retrieved by a chart, after assigning a PivotGridControl instance to the ChartControl.DataSource property.

You can vary the layout of the incoming data, using the options listed in the following section: The Data Source Options.

In addition, after specifying a Pivot Grid instance as a chart’s data source, the following two properties automatically adjust this bridge: PivotGridDataSourceOptions.AutoBindingSettingsEnabled and PivotGridDataSourceOptions.AutoLayoutSettingsEnabled. To access the PivotGridDataSourceOptions object, use the ChartControl.PivotGridDataSourceOptions property. If required, each of the settings that are affected by these automatic options can be tweaked in the corresponding event handler. This is detailed in the following section: The Automatic Settings.

The Data Source Options

A PivotGridDataSourceOptions object returned by the ChartControl.PivotGridDataSourceOptions property contains settings that determine the common behavior for a bridged chart and Pivot Grid pair. This property is linked to the PivotGridControl.OptionsChartDataSource property of the associated Pivot Grid, and changing any of its options is synchronous for the associated control.

These settings are listed in the table below.

Function Member Description
Format of the incoming data PivotGridDataSourceOptions.RetrieveDataByColumns Specifies whether or not a Chart’s series are created based on columns or rows of its associated Pivot Grid.
PivotGridDataSourceOptions.RetrieveEmptyCells Specifies whether or not empty cells should be passed to a Chart from its associated Pivot Grid.
Treatment of pivot totals PivotGridDataSourceOptions.RetrieveColumnCustomTotals Specifies whether or not column custom totals should be passed to a Chart from its associated Pivot Grid.
PivotGridDataSourceOptions.RetrieveColumnGrandTotals Specifies whether or not column grand totals should be passed to a Chart from its associated Pivot Grid.
PivotGridDataSourceOptions.RetrieveColumnTotals Specifies whether or not column totals should be passed to a Chart from its associated Pivot Grid.
PivotGridDataSourceOptions.RetrieveRowCustomTotals Specifies whether or not row custom totals should be passed to a Chart from its associated Pivot Grid.
PivotGridDataSourceOptions.RetrieveRowGrandTotals Specifies whether or not row grand totals should be passed to a Chart from its associated Pivot Grid.
PivotGridDataSourceOptions.RetrieveRowTotals Specifies whether or not row totals should be passed to a Chart from its associated Pivot Grid.
Limiting of the number of series and points PivotGridDataSourceOptions.MaxAllowedPointCountInSeries Limits the number of incoming points in a Chart’s series that are auto-created, based on the associated Pivot Grid.
PivotGridDataSourceOptions.MaxAllowedSeriesCount Limits the number of a Chart’s series that are auto-created, based on the associated Pivot Grid.
Additional options PivotGridDataSourceOptions.SelectionOnly Specifies whether or not only the currently selected cells of a Pivot Grid are reflected in its associated Chart.
PivotGridDataSourceOptions.UpdateDelay Specifies the delay (in milliseconds) that occurs before passing the changes made in a Pivot Grid to its associated Chart.

The Automatic Settings

Automatic Binding Settings

The PivotGridDataSourceOptions.AutoBindingSettingsEnabled property automatically adjusts the following options.

To modify these settings, handle the ChartControl.CustomizeAutoBindingSettings event, raised after applying them.

Automatic Layout Settings

The ChartControl.AutoLayoutSettingsEnabled property automatically adjusts the chart’s layout differently for two main diagram types.

For series labels of both diagram types, the SeriesLabelBase.ResolveOverlappingMode is set to Default (if possible), or to HideOverlapped (when the labels count is too large for the current diagram size).

Note

Before updating this property, the ChartControl.CustomizeResolveOverlappingMode event is raised.

Finally, the Legend.MaxHorizontalPercentage and the Legend.MaxVerticalPercentage properties of the chart’s legend are automatically set to best fit.

Note

Before updating the above properties, the ChartControl.CustomizeLegend event is raised.

See Also