Tag
A newer version of this page is available. Switch to the current version.

PivotGridFieldBase.KPIGraphic Property

Gets or sets a graphic set used to indicate KPI values.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.PivotGrid.v19.1.Core.dll

Declaration

[DefaultValue(PivotKPIGraphic.ServerDefined)]
[XtraSerializableProperty]
public PivotKPIGraphic KPIGraphic { get; set; }

Property Value

Type Default Description
PivotKPIGraphic

ServerDefined

A PivotKPIGraphic enumeration value that specifies the graphic set used to indicate KPI values.

Available values:

Show 16 items
Name Description
None

No image is displayed.

ServerDefined

The KPI graphic type is defined by the server.

Shapes

KPIGraphic_Shapes_-1KPIGraphic_Shapes_0KPIGraphic_Shapes_1

TrafficLights

KPIGraphic_TrafficLights_-1KPIGraphic_TrafficLights_0KPIGraphic_TrafficLights_1

RoadSigns

KPIGraphic_RoadSigns_-1KPIGraphic_RoadSigns_0KPIGraphic_RoadSigns_1

Gauge

KPIGraphic_Gauge_-1KPIGraphic_Gauge_0KPIGraphic_Gauge_1

ReversedGauge

KPIGraphic_ReversedGauge_-1KPIGraphic_ReversedGauge_0KPIGraphic_ReversedGauge_1

Thermometer

KPIGraphic_Thermometer_-1KPIGraphic_Thermometer_0KPIGraphic_Thermometer_1

ReversedThermometer

KPIGraphic_ReversedThermometer_-1KPIGraphic_ReversedThermometer_0KPIGraphic_ReversedThermometer_1

Cylinder

KPIGraphic_Cylinder_-1KPIGraphic_Cylinder_0KPIGraphic_Cylinder_1

ReversedCylinder

KPIGraphic_ReversedCylinder_-1KPIGraphic_ReversedCylinder_0KPIGraphic_ReversedCylinder_1

Faces

KPIGraphic_Faces_-1KPIGraphic_Faces_0KPIGraphic_Faces_1

VarianceArrow

KPIGraphic_VarianceArrow_-1KPIGraphic_VarianceArrow_0KPIGraphic_VarianceArrow_1

StandardArrow

KPIGraphic_StandardArrow_-1KPIGraphic_StandardArrow_0KPIGraphic_StandardArrow_1

StatusArrow

KPIGraphic_StatusArrow_-1KPIGraphic_StatusArrow_0KPIGraphic_StatusArrow_1

ReversedStatusArrow

KPIGraphic_ReversedStatusArrow_-1KPIGraphic_ReversedStatusArrow_0KPIGraphic_ReversedStatusArrow_1

Remarks

Since KPI supports graphic representation for its Status and Trend values, these values can be replaced with images. OLAP supports 12 graphic sets such as shapes, smiley faces, traffic lights, etc. Use the KPIGraphic property to specify the required graphic set.

If the KPIGraphic property is not set to PivotKPIGraphic.ServerDefined, KPI graphics can be displayed for table data sources, as well. In this instance, valid KPI values are -1 (bad), 0 (neutral) and 1 (good).

To learn more, see Key Performance Indicators (KPIs).

Examples

The following example shows how to display KPI graphics in a PivotGridControl bound to a regular data source.

The Pivot Grid Control is bound to the “Sales Person” view in the Northwind database. To display KPI graphics, we create an unbound field whose values correspond to images contained within a KPI graphic set.

In this example, the unbound field values depend on the “Extended Price” field values: if the “Extended Price” field value is less than 100,000, the unbound field value is “-1”, if the “Extended Price” field value is less than 150,000, the unbound field value is “0”. In other cases, the unbound field value is “1”.

The PivotGridOptionsData.DataFieldUnboundExpressionMode property is set to DataFieldUnboundExpressionMode.UseSummaryValues to calculate unbound expressions for data fields against summary values. The PivotGridFieldBase.KPIGraphic property specifies a graphic set used to visualize unbound field values.

The following image shows the result of the KPI values visualization:

ex-WF-PivotGrid-RegularDataSorceKPI

using System;
using System.Windows.Forms;
using DevExpress.XtraPivotGrid;

namespace WindowsFormsApp_RegularDataSourceKPI
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // Binds the pivot grid to data.
            this.salesPersonTableAdapter.Fill(this.nwindDataSet.SalesPerson);

            // Specifies that unbound expressions for data fields are calculated against summary values.
            pivotGridControl1.OptionsData.DataFieldUnboundExpressionMode = 
                DataFieldUnboundExpressionMode.UseSummaryValues;

            // Creates a new unbound "Status" field to show KPI values.
            PivotGridField unboundField = pivotGridControl1.Fields.Add("Status", PivotArea.DataArea);

            // Sets a column's unbound type and specifies an unbound expression.
            unboundField.UnboundType = DevExpress.Data.UnboundColumnType.Integer;
            unboundField.UnboundExpression = 
                string.Format("(Iif([{0}]<100000,-1,Iif([{0}]<150000,0,1)))", 
                fieldExtendedPrice1.ExpressionFieldName);

            // Sets the Data Header Area within which the "Status" Field can be positioned.
            unboundField.AllowedAreas = DevExpress.XtraPivotGrid.PivotGridAllowedAreas.DataArea;

            // Specifies a graphic set used to indicate KPI values.
            unboundField.KPIGraphic = PivotKPIGraphic.Faces;

        }
    }
}
See Also