KPI Scorecard – 3 metrics
Three KPI cards with the latest value, change and sparkline, and a trend chart for the selected one.
When to use it
Use it as the top strip of a dashboard: the latest value of each key metric, its change and a sparkline, with one click to the full trend.
Questions it answers
- How did each KPI move against last month or last year?
- Which metrics are trending the wrong way?
- What did the scorecard look like in a past month?
How to use it
- On your dashboard page, add a grid with the columns below (or map your own header names – see below). Keep it on the same page – tuck it behind the chart rather than hiding it, and make it tall.
- Add an HTML container (one that runs JavaScript) and paste the snippet.
- View the page. The chart finds the grid, reads every row and draws itself; it updates when filters change the grid.
| Default header | Key | What it's for | |
|---|---|---|---|
Month Key | month | Required | Month. |
Metric 1 … Metric 3 | v1 … v3 | Required | Three metrics. |
<div data-chart-embed="kpi-scorecard" style="height:100%"></div>
<script>
(function () {
var s = document.createElement("script");
s.src = "https://viz.kaijxnes.com/charts/kpi-scorecard-1.1.0.js";
s.integrity = "sha384-guo3/dbqo2UCktPlTwqOD9R5RVjVI0pYuxl8Ec8Fp3dNsRwXSnqp16YgnALFOc5D";
s.crossOrigin = "anonymous";
document.head.appendChild(s);
})();
</script>- Script URL
https://viz.kaijxnes.com/charts/kpi-scorecard-1.1.0.js- Integrity (SRI)
sha384-guo3/dbqo2UCktPlTwqOD9R5RVjVI0pYuxl8Ec8Fp3dNsRwXSnqp16YgnALFOc5D- Chart.js
https://viz.kaijxnes.com/chart.umd-4.4.1.js·sha384-dug+JxfBvklEQdJ4AYuBBAIScUz0bVN73xpy273gcAwHjb3qI0fXmuYNaNfdyYJG
Your own column names
The chart looks for the default headers above. If your grid's headers are different, map them by key with data-columns on the placeholder – the chart then shows your names too. data-labels (same keys) changes just the on-screen names, and data-title changes the heading. For grids that draw rows in batches, data-grid-class and data-scroll-class name the grid's container and its scroll box so every row is read.
<div data-chart-embed="kpi-scorecard" data-columns='{"month":"Your Month Header","v1":"Your Metric Header"}' data-title="Your title" style="height:100%"></div>
<script>
(function () {
var s = document.createElement("script");
s.src = "https://viz.kaijxnes.com/charts/kpi-scorecard-1.1.0.js";
s.integrity = "sha384-guo3/dbqo2UCktPlTwqOD9R5RVjVI0pYuxl8Ec8Fp3dNsRwXSnqp16YgnALFOc5D";
s.crossOrigin = "anonymous";
document.head.appendChild(s);
})();
</script>What it does
- The KPI Scorecard script with three metrics in the grid
Data & security
- Reads only what is drawn on the page for the viewer, so the viewer's normal permissions still apply
- Calculations happen in the viewer's browser; nothing is uploaded or sent anywhere
- The only downloads are this script and Chart.js, both integrity-checked
- No logins, API keys, cookies or browser storage
Other versions
This page uses the KPI Scorecard script – the snippet is the same, only the grid has different columns.