Skip to content

Gauge

Compare an actual value with its target on a radial scale.

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

Loading chart…

Compare an actual result with a target on a semicircular scale. Author min/max when gauges must be comparable across cards; an automatic domain can differ between readings.

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

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 createGaugeChart after the host mounts. This factory fixes the chart type to gauge.

<div id="chart" style="width: 100%; height: 450px;"></div>
Complete runnable TypeScript example with sample data
import { createGaugeChart } from '@revolist/charts/gauge';
const container = document.getElementById('chart')!;
const chart = await createGaugeChart({
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": "Margin",
"path": [
"Margin"
],
"labels": [
"Margin"
],
"depth": 1,
"kind": "leaf"
},
{
"id": "preview-category-2",
"label": "Retention",
"path": [
"Retention"
],
"labels": [
"Retention"
],
"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"
}
],
"values": [
[
72,
80
],
[
58,
65
],
[
84,
82
]
],
"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"
}
],
"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-1\",\"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": 58
}
},
{
"id": "[\"preview-category-1\",\"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": 65
}
},
{
"id": "[\"preview-category-2\",\"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": 84
}
},
{
"id": "[\"preview-category-2\",\"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": 82
}
}
],
"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-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-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"
}
]
}
},
"bindings": {
"actual": [
"preview-series-0"
],
"target": [
"preview-series-1"
]
},
"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
scaleMin0-1000000 to 1000000; step 1
scaleMax100-1000000 to 1000000; step 1
segments11 to 100; step 1
needlefalsetrue or false

The schema's scale defaults are editor presets. If you omit an authored maximum, the renderer can derive its effective scale from actual/target values. Set min/max explicitly for comparable gauges.

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.
  • KPI value — Summarize actual, target, and variance in a compact KPI card.
  • 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