Skip to main content

PivotCustomChartDataSourceDataEventArgs.Value Property

Gets or sets a value to be displayed in a ChartControl.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v23.2.dll

NuGet Package: DevExpress.Win.PivotGrid

Declaration

public object Value { get; set; }

Property Value

Type Description
Object

A Object class descendant representing the value to be displayed.

Example

The following example demonstrates how to add custom text to data prepared by the PivotGridControl, to display it in a ChartControl.

For this, it is necessary to handle the PivotGridControl.CustomChartDataSourceData event. In this event handler, you can determine the item type via the PivotCustomChartDataSourceDataEventArgs.ItemType property and change the PivotCustomChartDataSourceDataEventArgs.Value according to your custom requirements.

View Example

private void pivotGridControl1_CustomChartDataSourceData(object sender, 
PivotCustomChartDataSourceDataEventArgs e) {
    if(e.ItemType == PivotChartItemType.RowItem) {
        if(e.FieldValueInfo.Field == fieldCategoryName) {
            e.Value = CategoryEncodeTable[e.FieldValueInfo.Value.ToString()];
        } else if(e.FieldValueInfo.Field == fieldProductName) {
            string product =  
                ProductEncodeTable[e.FieldValueInfo.Value.ToString()];
            string category = 
            CategoryEncodeTable[e.FieldValueInfo.GetHigherLevelFieldValue(fieldCategoryName).ToString()];
            e.Value = product + '[' + category + ']';
        }
    }
    if(e.ItemType == PivotChartItemType.ColumnItem) {
        if(e.FieldValueInfo.ValueType == PivotGridValueType.GrandTotal) {
            e.Value = "Total Sales";
        }
    }
    if(e.ItemType == PivotChartItemType.CellItem) {
        e.Value = Math.Round(Convert.ToDecimal(e.CellInfo.Value), 0);
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Value property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also