Gallery › Line chart
Line chart: Library visits by month
A category column (years, months, dates), then one or more number columns.
Line chart of Burnt End and Glimmer by Month, from Jan 2026 to Sep 2026. Burnt End went from 4,210 in Jan 2026 to 4,705 in Sep 2026, a change of +495 (+11.8%). Its highest is 6,480 (Jul 2026) and its lowest 4,030 (Feb 2026). Glimmer went from 2,105 in Jan 2026 to 2,540 in Sep 2026, a change of +435 (+20.7%). Its highest is 3,520 (Jul 2026) and its lowest 2,105 (Jan 2026).
- Burnt End
- Glimmer
| Month | Burnt End | Glimmer |
|---|---|---|
| Jan 2026 | 4,210 | 2,105 |
| Feb 2026 | 4,030 | 2,210 |
| Mar 2026 | 4,675 | 2,380 |
| Apr 2026 | 4,590 | 2,440 |
| May 2026 | 4,820 | 2,610 |
| Jun 2026 | 6,120 | 3,390 |
| Jul 2026 | 6,480 | 3,520 |
| Aug 2026 | 5,210 | 2,875 |
| Sep 2026 | 4,705 | 2,540 |
Source: Halcyon County sample data (fictional, for the demo)
The spec
This is everything OSCharts needed to draw the chart above. The data is a table: named columns and rows, the way it sits in a spreadsheet.
{
"id": "library-visits",
"type": "line",
"title": "Library visits by month",
"subtitle": "Burnt End and Glimmer branches, 2026",
"source": "Halcyon County sample data (fictional, for the demo)",
"data": {
"columns": [
"Month",
"Burnt End",
"Glimmer"
],
"rows": [
[
"2026-01",
4210,
2105
],
[
"2026-02",
4030,
2210
],
[
"2026-03",
4675,
2380
],
[
"2026-04",
4590,
2440
],
[
"2026-05",
4820,
2610
],
[
"2026-06",
6120,
3390
],
[
"2026-07",
6480,
3520
],
[
"2026-08",
5210,
2875
],
[
"2026-09",
4705,
2540
]
]
}
}
Put it on a page
In a browser, load the two files and mount the chart:
<link rel="stylesheet" href="oscharts.css">
<script src="oscharts.js" defer></script>
<div id="chart"></div>
<script type="module">
OSCharts.mount(document.getElementById("chart"), spec);
</script>
Or render it on a server or in a build step, so the chart is in the page before any JavaScript runs:
import { render } from "oscharts";
const html = render(spec); // a complete, accessible <figure>
Command line: npx oscharts render spec.json > chart.html