Skip to content

KPI value

Summarize actual, target, and variance in a compact KPI card.

Chart ID: kpi. Independent import: @revolist/charts/kpi.

Loading chart…

Read the actual value directly alongside its target and variance. Use a chart with an axis when change over a sequence matters more than the current headline value.

Bind actual and target to stable numeric series IDs. The chart compares supplied results with supplied benchmarks; it does not calculate targets from other observations.

The roles below describe the chart's data contract. Generic category/value roles resolve from the dataset; explicitly bind specialized numeric roles as shown in the complete example.

Data roleField count
category1 or more
actual1
target1
variance0–1

Download the complete sample data and settings (JSON). See Data & Configuration for mapping, null values, updates and lifecycle rules.

Install the package using the installation guide, give the host an explicit height, and call createKpiChart after the host mounts. This factory fixes the chart type to kpi.

<div id="chart" style="width: 100%; height: 450px;"></div>
Complete runnable TypeScript example with sample data
import { createKpiChart } from '@revolist/charts/kpi';
const container = document.getElementById('chart')!;
const chart = await createKpiChart({
container,
"dataset": {
"revision": 0,
"source": "client",
"categories": [
{
"id": "preview-category-0",
"label": "Revenue",
"path": [
"Revenue"
],
"labels": [
"Revenue"
],
"depth": 1,
"kind": "leaf"
},
{
"id": "preview-category-1",
"label": "Retention",
"path": [
"Retention"
],
"labels": [
"Retention"
],
"depth": 1,
"kind": "leaf"
},
{
"id": "preview-category-2",
"label": "Margin",
"path": [
"Margin"
],
"labels": [
"Margin"
],
"depth": 1,
"kind": "leaf"
}
],
"series": [
{
"id": "preview-series-0",
"label": "Actual",
"columnPath": [
"Actual"
],
"labels": [
"Actual"
],
"kind": "leaf",
"prop": "preview-0"
},
{
"id": "preview-series-1",
"label": "Target",
"columnPath": [
"Target"
],
"labels": [
"Target"
],
"kind": "leaf",
"prop": "preview-1"
},
{
"id": "preview-series-2",
"label": "Variance",
"columnPath": [
"Variance"
],
"labels": [
"Variance"
],
"kind": "leaf",
"prop": "preview-2"
}
],
"values": [
[
72,
80,
-8
],
[
91,
88,
3
],
[
64,
70,
-6
]
],
"analyticalFrame": {
"fields": [
{
"id": "pivot:category",
"label": "pivot:category",
"role": "dimension",
"semanticType": "category"
},
{
"id": "pivot:series",
"label": "pivot:series",
"role": "dimension",
"semanticType": "category"
},
{
"id": "preview-series-0",
"label": "Actual",
"role": "measure",
"semanticType": "number",
"sourceField": "preview-0"
},
{
"id": "preview-series-1",
"label": "Target",
"role": "measure",
"semanticType": "number",
"sourceField": "preview-1"
},
{
"id": "preview-series-2",
"label": "Variance",
"role": "measure",
"semanticType": "number",
"sourceField": "preview-2"
}
],
"observations": [
{
"id": "[\"preview-category-0\",\"preview-series-0\"]",
"dimensions": {
"pivot:category": {
"value": "Revenue",
"label": "Revenue",
"path": [
"Revenue"
],
"labels": [
"Revenue"
]
},
"pivot:series": {
"value": "Actual",
"label": "Actual",
"path": [
"Actual"
],
"labels": [
"Actual"
]
}
},
"measures": {
"preview-series-0": 72
}
},
{
"id": "[\"preview-category-0\",\"preview-series-1\"]",
"dimensions": {
"pivot:category": {
"value": "Revenue",
"label": "Revenue",
"path": [
"Revenue"
],
"labels": [
"Revenue"
]
},
"pivot:series": {
"value": "Target",
"label": "Target",
"path": [
"Target"
],
"labels": [
"Target"
]
}
},
"measures": {
"preview-series-1": 80
}
},
{
"id": "[\"preview-category-0\",\"preview-series-2\"]",
"dimensions": {
"pivot:category": {
"value": "Revenue",
"label": "Revenue",
"path": [
"Revenue"
],
"labels": [
"Revenue"
]
},
"pivot:series": {
"value": "Variance",
"label": "Variance",
"path": [
"Variance"
],
"labels": [
"Variance"
]
}
},
"measures": {
"preview-series-2": -8
}
},
{
"id": "[\"preview-category-1\",\"preview-series-0\"]",
"dimensions": {
"pivot:category": {
"value": "Retention",
"label": "Retention",
"path": [
"Retention"
],
"labels": [
"Retention"
]
},
"pivot:series": {
"value": "Actual",
"label": "Actual",
"path": [
"Actual"
],
"labels": [
"Actual"
]
}
},
"measures": {
"preview-series-0": 91
}
},
{
"id": "[\"preview-category-1\",\"preview-series-1\"]",
"dimensions": {
"pivot:category": {
"value": "Retention",
"label": "Retention",
"path": [
"Retention"
],
"labels": [
"Retention"
]
},
"pivot:series": {
"value": "Target",
"label": "Target",
"path": [
"Target"
],
"labels": [
"Target"
]
}
},
"measures": {
"preview-series-1": 88
}
},
{
"id": "[\"preview-category-1\",\"preview-series-2\"]",
"dimensions": {
"pivot:category": {
"value": "Retention",
"label": "Retention",
"path": [
"Retention"
],
"labels": [
"Retention"
]
},
"pivot:series": {
"value": "Variance",
"label": "Variance",
"path": [
"Variance"
],
"labels": [
"Variance"
]
}
},
"measures": {
"preview-series-2": 3
}
},
{
"id": "[\"preview-category-2\",\"preview-series-0\"]",
"dimensions": {
"pivot:category": {
"value": "Margin",
"label": "Margin",
"path": [
"Margin"
],
"labels": [
"Margin"
]
},
"pivot:series": {
"value": "Actual",
"label": "Actual",
"path": [
"Actual"
],
"labels": [
"Actual"
]
}
},
"measures": {
"preview-series-0": 64
}
},
{
"id": "[\"preview-category-2\",\"preview-series-1\"]",
"dimensions": {
"pivot:category": {
"value": "Margin",
"label": "Margin",
"path": [
"Margin"
],
"labels": [
"Margin"
]
},
"pivot:series": {
"value": "Target",
"label": "Target",
"path": [
"Target"
],
"labels": [
"Target"
]
}
},
"measures": {
"preview-series-1": 70
}
},
{
"id": "[\"preview-category-2\",\"preview-series-2\"]",
"dimensions": {
"pivot:category": {
"value": "Margin",
"label": "Margin",
"path": [
"Margin"
],
"labels": [
"Margin"
]
},
"pivot:series": {
"value": "Variance",
"label": "Variance",
"path": [
"Variance"
],
"labels": [
"Variance"
]
}
},
"measures": {
"preview-series-2": -6
}
}
],
"matrixCells": [
{
"categoryId": "preview-category-0",
"seriesId": "preview-series-0",
"observationId": "[\"preview-category-0\",\"preview-series-0\"]",
"measureFieldId": "preview-series-0"
},
{
"categoryId": "preview-category-0",
"seriesId": "preview-series-1",
"observationId": "[\"preview-category-0\",\"preview-series-1\"]",
"measureFieldId": "preview-series-1"
},
{
"categoryId": "preview-category-0",
"seriesId": "preview-series-2",
"observationId": "[\"preview-category-0\",\"preview-series-2\"]",
"measureFieldId": "preview-series-2"
},
{
"categoryId": "preview-category-1",
"seriesId": "preview-series-0",
"observationId": "[\"preview-category-1\",\"preview-series-0\"]",
"measureFieldId": "preview-series-0"
},
{
"categoryId": "preview-category-1",
"seriesId": "preview-series-1",
"observationId": "[\"preview-category-1\",\"preview-series-1\"]",
"measureFieldId": "preview-series-1"
},
{
"categoryId": "preview-category-1",
"seriesId": "preview-series-2",
"observationId": "[\"preview-category-1\",\"preview-series-2\"]",
"measureFieldId": "preview-series-2"
},
{
"categoryId": "preview-category-2",
"seriesId": "preview-series-0",
"observationId": "[\"preview-category-2\",\"preview-series-0\"]",
"measureFieldId": "preview-series-0"
},
{
"categoryId": "preview-category-2",
"seriesId": "preview-series-1",
"observationId": "[\"preview-category-2\",\"preview-series-1\"]",
"measureFieldId": "preview-series-1"
},
{
"categoryId": "preview-category-2",
"seriesId": "preview-series-2",
"observationId": "[\"preview-category-2\",\"preview-series-2\"]",
"measureFieldId": "preview-series-2"
}
]
}
},
"bindings": {
"actual": [
"preview-series-0"
],
"target": [
"preview-series-1"
],
"variance": [
"preview-series-2"
]
},
"presentation": {
"dataLabels": false
}
});
// When the host unmounts:
// chart.destroy();

Await updates before reading a snapshot or exporting. Call chart.destroy() when the host unmounts. See the live catalog to interact with this type.

Set these fields in chartOptions. The option schema validates supported keys, ranges and choices; updating chartOptions replaces that authored object.

OptionDefaultAccepted values
markOpacity10.2 to 1; step 0.05

Titles, legends, theme and labels belong to presentation or the corresponding top-level setting. Axis, color, navigation and interaction support depends on the selected chart; see Data & Configuration.

  • Bullet — Compare actual values with explicit targets.
  • Gauge — Compare an actual value with its target on a radial scale.
  • Progress gauge — Show progress toward a target on a radial track.
  • Linear gauge — Compare a value with an explicit linear scale and target.

Charts overview · Installation · Data & Configuration