While in the past developers could get the XtraChart and XtraPivotGrid controls to bind so that a chart could be displayed for the default or user selected cells of data. This is a huge capability for end users but it was not an intuitive process and somewhat lacked control for the developer. For 2010 vol2 the charting team and the pivot team has worked together to make integration between the Chart and PivotGrid controls for WinFormas and ASP.NET really easy with a great deal of control for the developer.
Now at design time (or runtime via code) the DataSource or DataSourceID property can be set to a local Pivot Grid (as seen in the screen shot in WinForms). Once this property is set the settings the ChartControl.PivotGridDataSourceOptions or WebChartControl.PivotGridDataSourceOptions properties objects will control how the chart will be rendered.
The steps are quite straight forward and I will have a video demoing this shortly after 10.2 ships.
In a Winforms or ASP.NET project once you have a PivotGridControl (or, an ASPxPivotGrid) bound to a datasource. Add a ChartControl (or WebChartControl) on to the same form and open the smart tag, in the actions list, choose the Pivot Grid as the chart's data source. Now you will have a functioning chart of data in the Pivot control.
|
Setting DataSource property
|
|
Resulting Default Chart
|
Now comes the fun part if you are not satisfied with the automatically generated chart you have the capability to adjust many of possible options via the chart's PivotGridDataSourceOptions property. 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.
For example, Grand Totals could be excluded for rows from the chart, to do this, disable the RetrieveRowGrandTotals property, and launch the application.


If none of the available options meets your requirements, you can handle one of the special events available for the chart control, e.g. CustomizeAutoBindingSettings, CustomizeResolveOverlappingMode, CustomizeSimpleDiagramLayout, and others. In these event handlers, you can adjust all the settings affected by the AutoBindingSettingsEnabled and AutoLayoutSettingsEnabled properties, so the chart's output is in your full control.
For example, to manually define the resolve overlapping mode for series point labels, handle the corresponding event:
using DevExpress.XtraCharts;
// ...
private void chartControl1_CustomizeResolveOverlappingMode(object sender, CustomizeResolveOverlappingModeEventArgs e) {
e.ResolveOverlappingMode = ResolveOverlappingMode.HideOverlapped;
}
We think this will provide a great experience for developers and your end users. Please let us know what you think.