PivotGridFieldBase.KPIGraphic Property
Gets or sets a graphic set used to indicate KPI values.
Namespace: DevExpress.XtraPivotGrid
Assembly: DevExpress.PivotGrid.v24.2.Core.dll
Declaration
[DefaultValue(PivotKPIGraphic.ServerDefined)]
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:
Name | Description |
---|---|
None | No image is displayed. |
ServerDefined | The KPI graphic type is defined by the server. |
Shapes | |
TrafficLights | |
RoadSigns | |
Gauge | |
ReversedGauge | |
Thermometer | |
ReversedThermometer | |
Cylinder | |
ReversedCylinder | |
Faces | |
VarianceArrow | |
StandardArrow | |
StatusArrow | |
ReversedStatusArrow |
Remarks
KPI supports graphic representation for its Status and Trend values. OLAP supports 12 graphic sets such as shapes, smiley faces, traffic lights, etc. Use the KPIGraphic
property to specify the graphic set.
If the KPIGraphic
property is not set to PivotKPIGraphic.ServerDefined, KPI graphics can be displayed for table data sources. In this instance, valid KPI values are -1
(bad), 0
(neutral), and 1
(good).
Refer to the following topic for more information: Key Performance Indicators (KPIs).
Example
The following example shows how to display KPI graphics in the Pivot Grid bound to the Northwind database. The image below illustrates the resulting UI.
To display KPI graphics, create a Pivot Grid field and bind it to the following expression:
(Iif(Sum([{0}])<100000,-1,Iif(Sum([{0}])<150000,0,1)))", fieldExtendedPrice.ExpressionFieldName)
The field values depend on the Extended Price field values. If the Extended Price field value is less than 100000, the field value is -1
. If the Extended Price field value is less than 150000, the field value is 0
. In other cases, the field value is 1
.
Use the PivotGridFieldBase.KPIGraphic
property to specify a graphic set used to visualize field values.
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);
// Creates a new "Status" field to show KPI values.
PivotGridField KPIField = pivotGridControl1.Fields.Add();
KPIField.Area = PivotArea.DataArea;
KPIField.Caption = "Status";
// Sets a column's data binding and specifies an expression.
KPIField.DataBinding = new ExpressionDataBinding(
string.Format("(Iif(Sum([{0}])<100000,-1,Iif(Sum([{0}])<150000,0,1)))",
fieldExtendedPrice.ExpressionFieldName));
// Sets the Data Header Area within which the "Status" Field can be positioned.
KPIField.AllowedAreas = DevExpress.XtraPivotGrid.PivotGridAllowedAreas.DataArea;
// Specifies a graphic set used to indicate KPI values.
KPIField.KPIGraphic = PivotKPIGraphic.Faces;
}
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the KPIGraphic 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.