Step line
A value that changes at moments and stays: a rate, a price, a tariff (step line).
72.8 KB of code · core 29.5 + 11 blocks 43.3
Policy rate, %
The rate fell from 5.5% to 4% during 2024, rose once in May 2025, and has stood at 3.75% since December 2025.
How it is made: curve "step" holds each value until the next row, then jumps: a rate, a price list, a tariff, a stock level. Each row is the day a value took effect; the last row repeats the current value at the end of the period, or the line would stop at the last change.
What the report is made of
The composer reads the JSON below and puts into the page the core and only the blocks its chart uses: 11 of the 59, 72.8 KB of code, minified, which is 34% of the 215.9 KB that the core and every block weigh together. The report file is 79.2 KB: that code, the data, the styles and the page around them.
| Block | What it does | Share of the code | KB |
|---|---|---|---|
core.composed-plain A report with plain data: no checks, no decoder. Most reports. | A report with plain data: no checks, no decoder. Most reports. | 29.5 | |
lib.curve The path of a line: straight segments, a smooth curve that never overshoots, or steps. Shared by line and area. | The path of a line: straight segments, a smooth curve that never overshoots, or steps. Shared by line and area. | 1.2 | |
lib.pointer Where the pointer is on the chart, and following a mouse or a finger once a frame. Shared by tooltip, crosshair, zoom and brush. | Where the pointer is on the chart, and following a mouse or a finger once a frame. Shared by tooltip, crosshair, zoom and brush. | 1.7 | |
lib.ticks Round steps and ticks (1, 2 or 5 × 10ⁿ). Shared by the number scales and the histogram bins. | Round steps and ticks (1, 2 or 5 × 10ⁿ). Shared by the number scales and the histogram bins. | 0.7 | |
scale.linear Numbers to positions, with round ticks. | Numbers to positions, with round ticks. | 1.6 | |
scale.time Dates to positions, ticks in days, months or years (UTC). | Dates to positions, ticks in days, months or years (UTC). | 4.1 | |
mark.area Filled areas, stacked or not. | Filled areas, stacked or not. | 2.9 | |
mark.line A line per series, with optional end labels. | A line per series, with optional end labels. | 4.4 | |
guide.axis Axes: formatted labels, a title, long categories wrapped. | Axes: formatted labels, a title, long categories wrapped. | 11.7 | |
guide.grid Grid lines at the ticks. | Grid lines at the ticks. | 0.6 | |
interaction.tooltip The values under the pointer. | The values under the pointer. | 10.7 | |
renderer.svg Draws into SVG: sharp, selectable, prints well. The default. | Draws into SVG: sharp, selectable, prints well. The default. | 3.9 | |
| Total | The core 29.5 and 11 blocks 43.3 | 72.8 |
The JSON
This is the whole input. data holds the datasets, each chart is a spec that names one.
In a checkout of the repository: node scripts/compose.js skills/blockcharts/recipes/step-line.json report.html.
Saved as page.json, it composes the same with the skill's own runtime/compose.js.
step-line.json
{
"title": "Step line",
"data": {
"rate": [
{ "date": "2024-01-01", "rate": 5.5 },
{ "date": "2024-03-20", "rate": 5.25 },
{ "date": "2024-06-12", "rate": 5.0 },
{ "date": "2024-09-18", "rate": 4.5 },
{ "date": "2024-11-07", "rate": 4.25 },
{ "date": "2024-12-18", "rate": 4.0 },
{ "date": "2025-05-07", "rate": 4.25 },
{ "date": "2025-09-17", "rate": 4.0 },
{ "date": "2025-12-10", "rate": 3.75 },
{ "date": "2026-06-30", "rate": 3.75 }
]
},
"charts": [
{
"title": "Policy rate, %",
"note": "The rate fell from 5.5% to 4% during 2024, rose once in May 2025, and has stood at 3.75% since December 2025.",
"how": "curve \"step\" holds each value until the next row, then jumps: a rate, a price list, a tariff, a stock level. Each row is the day a value took effect; the last row repeats the current value at the end of the period, or the line would stop at the last change.",
"spec": {
"data": "rate",
"size": [720, 300],
"scales": { "x": { "type": "time" }, "y": { "type": "linear", "domain": [3, 6] } },
"guides": [
{ "type": "grid", "scale": "y" },
{ "type": "axis", "scale": "x", "format": { "month": "short", "year": "2-digit" } },
{ "type": "axis", "scale": "y", "format": { "minimumFractionDigits": 1, "suffix": "%" } }
],
"marks": [
{ "type": "area", "x": "date", "y": "rate", "curve": "step", "toBottom": true, "fade": true, "fill": "var(--bc-c0, #3a6fe4)" },
{ "type": "line", "x": "date", "y": "rate", "curve": "step", "stroke": "var(--bc-c0, #3a6fe4)" }
],
"interaction": [
{ "type": "tooltip", "fields": ["rate"], "formats": { "date": "date", "rate": { "minimumFractionDigits": 2, "suffix": "%" } } }
]
}
}
]
}
The report the composer makes from it is one standalone file (79.2 KB): open it from disk, mail it, print it.
In a page of your own
The charts above use the basic kit (42.9 KB gzipped), the smallest one that has the blocks this example needs:
lib.curve, lib.pointer, lib.ticks, scale.linear, scale.time, mark.area, mark.line, guide.axis, guide.grid, interaction.tooltip, renderer.svg.
The HTML below loads it from the jsDelivr CDN, pinned to version 0.0.5; to serve it from your own site, put its file there
(the files of a release) and change the address.
HTML
<script src="https://cdn.jsdelivr.net/npm/blockcharts@0.0.5/release/kits/basic.js"></script>
<script type="application/json" id="bc-data">
{"rate":[{"date":"2024-01-01","rate":5.5},{"date":"2024-03-20","rate":5.25},{"date":"2024-06-12","rate":5},{"date":"2024-09-18","rate":4.5},{"date":"2024-11-07","rate":4.25},{"date":"2024-12-18","rate":4},{"date":"2025-05-07","rate":4.25},{"date":"2025-09-17","rate":4},{"date":"2025-12-10","rate":3.75},{"date":"2026-06-30","rate":3.75}]}
</script>
<script type="application/json" data-bc-chart>
{
"data": "rate",
"size": [
720,
300
],
"scales": {
"x": {
"type": "time"
},
"y": {
"type": "linear",
"domain": [
3,
6
]
}
},
"guides": [
{
"type": "grid",
"scale": "y"
},
{
"type": "axis",
"scale": "x",
"format": {
"month": "short",
"year": "2-digit"
}
},
{
"type": "axis",
"scale": "y",
"format": {
"minimumFractionDigits": 1,
"suffix": "%"
}
}
],
"marks": [
{
"type": "area",
"x": "date",
"y": "rate",
"curve": "step",
"toBottom": true,
"fade": true,
"fill": "var(--bc-c0, #3a6fe4)"
},
{
"type": "line",
"x": "date",
"y": "rate",
"curve": "step",
"stroke": "var(--bc-c0, #3a6fe4)"
}
],
"interaction": [
{
"type": "tooltip",
"fields": [
"rate"
],
"formats": {
"date": "date",
"rate": {
"minimumFractionDigits": 2,
"suffix": "%"
}
}
}
],
"alt": "Policy rate, %"
}
</script>