DevExpress PivotControl关联ChartControl

Integration with the Chart Control

 

The Pivot Grid presents multidimensional data in a cross-tabular form, allowing end-users to perform various data shaping operations.

以交叉表的形式展示多维数据, 允许用户显示数据变形.

They can customize the report to reshape data and get a layout that fits their specific data analysis needs.

Pivot Grid control allows end-users to go further and visualize data displayed in the pivot grid using the Chart Control.

Note

Watch the Video DevExpress WinForms Pivot Grid: Integration with Chart Control (YouTube)

This topic contains the following sections.

Expanded Binding Overview 如何绑定

 

The ChartControl retrieves data from the Pivot Grid control in the following manner.

  • The Series data member values are generated based on Pivot Grid control columns.
  • The argument data member values are generated based on Pivot Grid control rows.
  • The Value data member contains summary values.

Series and argument data members are created based on column/row headers (e.g., '1994', 'Produce Total', 'Grand Total').

If a column/row is identified by multiple fields, the corresponding data member value is constructed from the respective field values connected by the '|' sign (e.g., '1995 | January', 'Beverages | Chai').

 

Expanded Implementation

 

To set a Pivot Grid control as the Chart control data source, do one of the following:

By default, the ChartControl visualizes data that is selected in the Pivot Grid control. To display all the data in the Pivot Grid control, set the PivotGridOptionsChartDataSource.SelectionOnly property to false.

To change the default behavior in order to create a series data member based on rows and an argument data member based on columns, set the PivotGridOptionsChartDataSourceBase.ProvideDataByColumns property to false.

 

Note

Use the PivotGridOptionsChartDataSourceBase.DataProvideMode property to control whether or not Pivot Grid control should pass to Chart control only values from the lowest aggregation level.

 

 

Expanded Binding and Layout Options

 

When the PivotGridControl instance is assigned to the ChartControl.DataSource property, the chart bindings and layout are auto-adjusted. If necessary, you can manually specify ChartControl binding settings that define how to create a diagram from supplied data.

There are two modes of providing binding settings to ChartControl: automatic and manual. You can specify which one to use via the ChartControl.AutoBindingSettingsEnabled property.

When binding settings are applied, you can manually specify layout settings that define how to display a diagram. As with binding settings, you can let ChartControl adjust these settings automatically (in this instance, you can manually customize them by handling various events) or specify them manually. Use the ChartControl.AutoLayoutSettingsEnabled property to specify whether or not layout settings are automatically adjusted.

For a list of binding and layout settings, see the Pivot Charting topic in the XtraCharts Suite documentation.

 

Expanded Data Types Specifics

 

If a Pivot Grid control contains multiple data fields with different data types (PivotGridField.DataType), Cell values are converted to System.Decimal (if possible). Use the PivotGridOptionsChartDataSourceBase.ProvideCellValuesAsType property to override this behavior by explicitly specifying a data type to which Cell values should be converted.

Chart control supports only Numeric and DateTime series point values (see Series Scale Types to learn more). To convert cell values into an appropriate type in a custom manner, handle the PivotGridControl.CustomChartDataSourceData event.

When choosing a Chart type, note that only Series with a single value per Series point are supported.

 

Expanded Member Table

 

The Pivot Grid control provides multiple options that enable you to specify how its data is interpreted by the ChartControl. These options are represented by a PivotGridOptionsChartDataSource class instance, and accessed via the PivotGridControl.OptionsChartDataSource property.

PropertyDescription
PivotGridOptionsChartDataSourceBase.ProvideDataByColumnsGets or sets whether series in a chart control are created for PivotGrid columns or rows.
PivotGridOptionsChartDataSource.SelectionOnlyGets or sets whether a chart control must display selected cells or all the data of the PivotGrid control.
PivotGridOptionsChartDataSourceBase.ProvideEmptyCellsGets or sets whether empty cells should be processed by the Chart control.
PivotGridOptionsChartDataSourceBase.DataProvideModeGets or sets what data the pivot grid should pass to a bound chart control.
PivotGridOptionsChartDataSourceBase.ProvideColumnCustomTotalsGets or sets whether column custom totals should be passed to a chart control.
PivotGridOptionsChartDataSourceBase.ProvideColumnGrandTotalsGets or sets whether column grand totals are passed to a chart control.
PivotGridOptionsChartDataSourceBase.ProvideRowCustomTotalsGets or sets whether row custom totals should be displayed in a chart control.
PivotGridOptionsChartDataSourceBase.ProvideRowGrandTotalsGets or sets whether row grand totals are passed to a chart control.
PivotGridOptionsChartDataSourceBase.ProvideRowTotalsGets or sets whether row Totals are passed to a chart control.
PivotGridOptionsChartDataSourceBase.FieldValuesProvideModeGets or sets how field values are passed to the chart control.
PivotGridOptionsChartDataSourceBase.ProvideCellValuesAsTypeGets or sets the type to which cell values are converted, before they are exported to the Chart Control.
PivotGridOptionsChartDataSourceBase.ProvideColumnFieldValuesAsTypeGets or sets the type to which the column field values are converted before they are exported to the chart control.
PivotGridOptionsChartDataSourceBase.ProvideRowFieldValuesAsTypeGets or sets the type to which the row field values are converted, before they are exported to the chart control.
PivotGridOptionsChartDataSourceBase.MaxAllowedPointCountInSeriesGets or sets the maximum number of points allowed in a series.
PivotGridOptionsChartDataSourceBase.MaxAllowedSeriesCountGets or sets the maximum number of series allowed in the chart data source.
PivotGridOptionsChartDataSource.UpdateDelayGets or sets the delay between changing the cell focus or selection, and updating the bound Chart control.

Note

 

Note that PivotGridOptionsChartDataSourceBase.Provide...Totals properties is in effect when the PivotGridOptionsChartDataSourceBase.DataProvideMode is set to the PivotChartDataProvideMode.UseCustomSettings.

 

Expanded Example

 

Expanded See Also

General Chart Options - Launch the demo

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值