Log In
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
  [Collapse]Chart Control
   [Expand]Product Information
   [Expand]Getting Started
   [Expand]Design-Time Features
   [Expand]Visual Elements
     How to: Add a Chart to a Web Application
     How to: Add a Chart to a Web Page (Runtime Sample)
     How to: Add a Chart to an ASPxCallbackPanel during its Callback (Runtime Sample)
     How to: Bind a Web Chart to Data (Runtime Sample)
     How to: Bind a Web Chart to an ASPxPivotGrid
     How to: Show Custom Data Over a Web Chart Using ASPxPopupControl
     How to: Use the Client-Side Model of the WebChartControl
     How to: Show Custom Tooltips for a WebChartControl
     How to: Invoke the Client Chart Designer
     How to: Configure a Chart for Printing
  [Expand]Grid View
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]HTML Editor
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Expand]eXpressApp Framework
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Bind a Web Chart to an ASPxPivotGrid

This tutorial describes how to create a Web page with two linked controls: an ASPxPivotGrid bound to a data source, and a WebChartControl bound to that pivot grid.

Note that in order to synchronize both controls during callbacks, they should both be placed within an ASPxCallbackPanel, and have their EnableCallbacks properties disabled.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E1242.

This tutorial consists of the following sections.

Expanded Bind a Pivot Grid to Data

  1. Create a new ASP.NET Web Application (Visual Studio 2010, 2012, 2013, 2015 or 2017), or open an existing one.

  2. Drop the ASPxPivotGrid control from the DX.17.2: Data & Analytics toolbox tab onto the Web page.

  3. To bind the pivot grid to a database, click its smart tag, and in the invoked actions list, expand the drop-down menu for the Choose Data Source entry.

    And, click New data source... link.

  4. Then, proceed with the steps of the Data Source Configuration Wizard, to connect to your data source. In this example, we'll use the gsp.mdb file (which is shipped with the installation of the ASP.NET Chart Control), copied to the application's folder.

  5. After you've connected to a data source, click the pivot grid's smart tag again, and in its actions list, choose Fields....

  6. In the invoked dialog, click Retrieve fields.

  7. Among the obtained fields, remove the ID field, since it is unnecessary in this project.

  8. Then, for each field, specify its Area property. In particular:

    - for the Region field, set this property to ColumnArea;

    - for the Year field, set this property to RowArea;

    - and, for the GSP field, set this property to DataArea.

    To close the dialog, and apply the changes, click OK.

Now, the pivot grid has been successfully bound to data, and it's only left to create a Web chart bound to this grid. This is explained in the next section of this tutorial.

Expanded Bind a Chart to the Pivot Grid

  1. Add a chart to the Web page.
  2. Then, click its smart tag, and in the invoked actions list, expand the Choose Data Source drop-down menu, and select the ASPxPivotGrid1.

  3. Then, you can adjust chart's options, e.g. enable tooltips by setting the WebChartControl.ToolTipEnabled to true, and disable a crosshair cursor setting the WebChartControl.CrosshairEnabled to false.

Expanded Get the Result

The WebChartControl has now successfully bound to the ASPxPivotGrid. Run the application, and view the result.

Note that after you filter the grid's columns and rows right in the browser, this has an immediate effect on the linked chart.

Expanded See Also

How would you rate this topic?​​​​​​​