Blogs

Woody Pewitt - DevExpress Analytics Blog

Simple Pivot and Charting Integration (Coming in 2010 vol2)

     

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.

chartControl_Datasource 
Setting DataSource property

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

RetrieveRowGrandTotals_Property

bound_chart_No_Totals

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.

Published Nov 11 2010, 11:00 AM by Woody Pewitt (DevExpress)
Bookmark and Share

Comments

 

Steve Sharkey said:

An excellent addition/enhancement - looking forward to 10.2 now.

November 12, 2010 2:37 AM
 

Woody Pewitt's DevExpress Blog said:

With the new Simple Pivot and Charting Integration feature there are several new features that are enabled

November 12, 2010 12:11 PM
 

Woody Pewitt - DevExpress Analytics Blog said:

With the new Simple Pivot and Charting Integration feature there are several new features that are enabled

November 16, 2010 12:51 PM
 

Woody Pewitt (DevExpress) said:

Steve glad to know you are looking forward to getting it in to your hands!

November 16, 2010 10:12 PM
 

Woody Pewitt - DevExpress Analytics Blog said:

The Pivot team is excited to get this latest volume of DXperience to see all the new features in Pivot

December 7, 2010 5:49 PM
More from DevExpress
Live Chat
Have a pre-sales question?
Need assistance with your evaluation?
We are here to help.
Chat is one of the many ways you can contact members of the DevExpress Team. We are available Monday-Friday between 8:30am and 5:00pm Pacific Time.
If you need additional product information, require pre-sales assistance, or want help with your order, write to us at info@devexpress.com or call us at
+1 (818) 844-3383.