Version

Configuring Key Performance Indicators (KPIs) Visualization (xamPivotGrid, xamPivotDataSelector)

Topic Overview

Purpose

This topic explains how to customize the way Key Performance Indicators (KPIs) are visualized in the xamPivotGrid™ and xamPivotDataSelector™ controls.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

This topic explains conceptually how the KPIs data from a multi-dimensional (OLAP) data set is visualized in Ultimate UI for WPF®.

This topic explains how to bind the xamPivotGrid control to data using the XmlaDataSource™ component.

Configuring KPI Visualization Overview

Configuring KPI visualization summary

An individual indicator can be visualized in the xamPivotGrid by drag-and-dropping it from the metadata tree to the Measures area of the pivot grid or by programmatically adding it to its Measures collection.

When applicable (depending on its KPI type), a KPI can be visualized as either a value or a graphical representation (icon).

A pre-defined set of graphical representations (shapes set) is available by default. This setting is controlled by the Graphic property of the KpiCellTemplate objects.

Further customization, such as specifying a user choice of images representing the different KPIs values states (-1, 0 and 1), is possible by setting the Graphic property to “ThreeStateImages ” and then providing the desired image sources (For details, see Configuring KPI visualization summary chart). An alternative approach would be to override the Template property of a KpiCellTemplate instance, providing a custom template.

Configuring KPI visualization summary chart

The following table explains briefly the configurable aspects of KPI visualization in the pivot grid (the xamPivotGrid and xamPivotDataSelector controls) and maps them to the properties with which this configuration is achieved. The green-highlighted tasks in the table are further detailed in this help as individual procedures.

Configurable aspect2 Task Details Properties / Events

KPI visualization in the metadata tree 2

Preventing KPIs from displaying

KPIs are displayed by default; you need to explicitly disable KPI data from displaying.

KPI visualization in the pivot grid 2

Displaying KPIs in the pivot grid programmatically

Add a KpiMeasure to the Measures collection of the DataSourceBase instance.

Graphical representation 2

Choosing a pre-defined visualization

Set the Indicator and the Graphic> properties of the KpiCellTemplate.

Configuring a custom visualization

Using properties

Set the Graphic property of the KpiCellTemplate to ThreeState Images” and then provide the images corresponding to each state as values of the respective properties.

Displaying KPIs in the Pivot Grid Programmatically

Introduction

To display the value of a KPI or visualize its graphical representation in the xamPivotGrid programmatically, access a KpiMeasure member from the ICube.Measures collection and add to the DataSourceBase.Measures collection. You need to do this for all KPIs you want to display.

The particular procedure below demonstrates how to add a Status -based KPI graphical representation to the cells of a xamPivotGrid using XMLA as data source (the Adventure Works DW 2008 database).

Preview

The following screenshot is a preview of the final result.

xamPivotGrid Configuring KPIs Visualization 1.png

Prerequisites

To complete the procedure, you need the following:

  • A WPF application with a page

  • Instances of xamPivotGrid and xamPivotDataSelector that use XMLA as data source (the Adventure Works DW 2008 database) added to the page

Steps

The following steps demonstrate how to display KPIs in the pivot grid programmatically.

1. Obtain the KPI item by its unique name.

Obtain the KPI item from the ICube.Kpis * collection.*

In C#:

IKpi kpi = dataSource.Cube.Kpis["Product Gross Profit Margin"];

In Visual Basic:

Dim kpi As IKpi = dataSource.Cube.Kpis("Product Gross Profit Margin")

2. Specify the metadata type of the KPI member.

Select the desired metadata type member from the IKpi object created in step 1.

In this procedure, select a Status member.

In C#:

KpiMeasure kpiStatusMeasure = (KpiMeasure)dataSource.Cube.Measures[kpi.KpiStatus];

In Visual Basic:

Dim kpiStatusMeasure As KpiMeasure = DirectCast(dataSource.Cube.Measures(kpi.KpiStatus), KpiMeasure)

3. Specify the area in which to display the KPI item.

Add the KpiMeasure to the Measures collection of xamPivotGrid ’s data source so that it gets displayed in the Measures area.

In C#:

IMeasureViewModel mvm = dataSource.CreateMeasureViewModel(kpiStatusMeasure);
dataSource.Measures.Add(mvm);

In Visual Basic:

Dim mvm As IMeasureViewModel = dataSource.CreateMeasureViewModel(kpiStatusMeasure)
dataSource.Measures.Add(mvm)

Specifying a Pre-Defined KPI Visualization

Introduction

A graphical representation of a KPI derived from the Analysis Service (graphic type) is visualized using predefined templates corresponding to that type by default when the respective KpiMeasure has been added to the Measures collection of the DataSourceBase class.

In this procedure, a Status-based key performance indicator is configured to be visualized in the cells of a _xamPivotGrid control using arrow-like shapes (There is a set of predefined shapes in the GraphicType enumeration for visually representing KPI member items.).

Preview

The following screenshot is a preview of the final result.

xamPivotGrid Configuring KPIs Visualization 2.png

Prerequisites

To complete the procedure, you need the following:

  • A WPF application with a page

  • An instance of xamPivotGrid using XMLA as data source (the Adventure Works DW 2008 database) added to the page.

Overview

Following is a conceptual overview of the process:

  1. Configuring the data source

  2. Choosing the KPI member to be used

  3. Specifying the metadata type of the KPI member

  4. Changing the default graphics

  5. Applying the cell template

Steps

The following steps demonstrate how to visualize a Status-based KPI in the cells of xamPivotGrid using arrow-like shapes.

Configure the data source.

Configure the data source for the xamPivotGrid control. In this procedure, use the following settings:

In XAML:

<igOlap:XmlaDataSource
ServerUri="http://sampledata.infragistics.com/olap/msmdpump.dll"
Database="Adventure Works DW 2008"
Cube="Adventure Works"
Columns="[Product].[Category]"
Rows="[Date].[Fiscal]"
Measures="[Measures].[Internet Revenue Status]"/>

1. Choose the KPI member to be used.

To indicate which KPI is going to be used, set the MemberName property of a new KpiCellTemplate instance to the desired value.*In this procedure, set the MemberName property to *“ Internet Revenue *. *

In XAML:

----<ig:KpiCellTemplate MemberName="Internet Revenue"/>
----

2. Specify the metadata type of the member item.

Set the Indicator property of the KpiCellTemplate instance to the desired metadata type.

In this procedure, set the Indicator property to “ Status ”.

In XAML:

<ig:KpiCellTemplate MemberName="Internet Revenue" Indicator="Status"/>

3. Change the default graphics.

From the set of predefined shapes corresponding to the values of the GraphicType enumeration, select a shape to use and set the desired shape as a value for the Graphic property of the KpiCellTemplate object .

In this procedure, set the Graphic property to “ StandardArrow ”.

In XAML:

 <ig:KpiCellTemplate MemberName="Internet Revenue" Indicator="Status" Graphic="StandardArrow"/>

For a list of pre-defined shapes, please refer to the API documentation.

4. Apply the cell template.

Add the KpiCellTemplate object to the KpiCellTemplates collection of the xamPivotGrid .

In XAML:

 <ig:XamPivotGrid.KpiCellTemplates>
                <ig:KpiCellTemplate MemberName="Internet Revenue" Indicator="Status" Graphic="StandardArrow"/>
            </ig:XamPivotGrid.KpiCellTemplates>

Configuring a Custom Visualization Using Properties

Introduction

To provide a custom visualization, you need a set of custom images to represent each KPI state. You set the Graphic property of the KpiCellTemplate object to ThreeState Images” and then provide the images corresponding to each state as values of the respective properties. To apply the template to the cells of the xamPivotGrid the KpiCellTemplate object must be added to xamPivotGrid ’s KpiCellTemplates collection.

Preview

The following screenshot is a preview of the final result.

xamPivotGrid Configuring KPIs Visualization 3.png

Prerequisites

To complete the procedure, you need the following:

  • A WPF application with a page

  • An instance of xamPivotGrid using XMLA as data source (the Adventure Works DW 2008 database) added to the page.

Steps

The following steps demonstrate how to configure a custom KPI member item visualization using properties.

  1. Configure the data source.

Configure the data source for the xamPivotGrid control. In this procedure, use the following settings:

In XAML:

<igOlap:XmlaDataSource
ServerUri="http://sampledata.infragistics.com/olap/msmdpump.dll"
Database="Adventure Works DW 2008"
Cube="Adventure Works"
Columns="[Product].[Category]"
Rows="[Date].[Fiscal]"
Measures="[Measures].[Product Gross Profit Margin Status]"/>
  1. Configure the use of custom images.

Indicate that three images are going to be explicitly provided to visualize the different KPI values. To do this, set the Graphic property of the KPICellTemplate object to “ ThreeStateImages ”.

In XAML:

<ig:XamPivotGrid.KpiCellTemplates>
                <ig:KpiCellTemplate MemberName="Product Gross Profit Margin"
                                    Indicator="Status"
                                    Graphic="ThreeStateImages"/>
</ig:XamPivotGrid.KpiCellTemplates>
  1. Specify the images.

Use the following snippet to provide the sources of the three images to be displayed as indicators of the three possible KPI member item values- 0, -1 and 1:

In XAML:

<ig:XamPivotGrid.KpiCellTemplates>
                <ig:KpiCellTemplate MemberName="Product Gross Profit Margin"
                                    Indicator="Status"
                                    Graphic="ThreeStateImages"
                                    NegativeImageSource="..\..\StatusFlagRed256.png"
                                    ZeroImageSource="..\..\StatusFlagYellow256.png"
                                    PositiveImageSource="..\..\StatusFlagGreen256.png"/>
            </ig:XamPivotGrid.KpiCellTemplates>

Configuring a Custom Visualization Using a Custom Template

Configuring a custom template summary

It is possible to apply a custom template for the graphical representation of a KPI by overriding Template property of an instance of. The KpiCellTemplate object is then added to xamPivotGrid ’s KpiCellTemplates collection. Such an overriding takes precedence over setting the Graphic type to “ThreeStateImages and providing the image sources (the approach described in Configuring a Custom Visualization Using Properties).

The DataContext of the template depends on the value for the respective cell. This allows for direct binding to display/ get this value and for using an IValueConverter to translate the value into the required 3-state custom representation in the custom template.