Atomic charts for apps, pages and reports
Only the chart code your page needs. Nothing more.
blockcharts is a chart library cut into atoms: a scale, a bar, an axis, a tooltip — each one a tiny block. A page carries exactly the blocks its charts use, never the whole library. Install it from npm and drop a ready component into React, Vue, Svelte or Angular — or ask Claude for a dashboard as one HTML file.
- Components for React, Vue, Svelte, Angular
- Core 12.2 KB gzipped
- Blocks 0.4–12 KB each
- Free, MIT license
Revenue against plan
Live, from the executive-dashboard recipe — see the whole dashboard. Point at the lines, or tap them.
What is inside executive-dashboard.html
24 of 59 blocks. The other 35 never reach the page.
A chart library is usually one bundle that every page downloads whole. Here every scale, mark, axis and interaction is its own tiny block, and the file carries only the ones its charts name: 111.9 KB of code instead of 215.9 KB.
in the file not needed, not shipped sizes in KB, minified
Get started
One package, any framework or none
Ready components for React, Vue and Svelte, a custom element for Angular and any page, and the same charts from plain JavaScript with BC.chart.
npm install blockcharts - Install the packageTyped for TypeScript, no dependencies; React, Vue and Svelte are optional peers.
- Import a kit once
blockcharts/kits/basic.mjsfor bars, lines and areas, or another kit: the only chart code your app carries. - Drop in a componentGive it a JSON spec and your rows, or call
BC.chart(element, spec)yourself. A click on a bar comes back to your code with its row; on a server a component renders an empty element and draws in the browser.
import 'blockcharts/kits/basic.mjs'; // once, before a chart mounts
import { useRef } from 'react';
import { BlockChart } from 'blockcharts/react';
const spec = {
scales: { x: { type: 'band' }, y: { type: 'linear', zero: true } },
guides: [
{ type: 'axis', scale: 'x' },
{ type: 'axis', scale: 'y', format: 'compact' },
],
marks: [{ type: 'rect', x: 'region', y: 'total' }],
interaction: [{ type: 'tooltip' }],
};
export function Regions({ rows, onPick }) {
const chart = useRef(null); // chart.current.setView('x', null)
return (
<BlockChart
ref={chart}
spec={spec}
data={rows}
onClick={(d) => onPick(d.values.region)}
/>
);
} <script setup>
import 'blockcharts/kits/basic.mjs';
import { BlockChart } from 'blockcharts/vue';
defineProps(['rows']);
const emit = defineEmits(['pick']);
const spec = {
scales: { x: { type: 'band' }, y: { type: 'linear', zero: true } },
guides: [
{ type: 'axis', scale: 'x' },
{ type: 'axis', scale: 'y', format: 'compact' },
],
marks: [{ type: 'rect', x: 'region', y: 'total' }],
interaction: [{ type: 'tooltip' }],
};
</script>
<template>
<BlockChart
:spec="spec"
:data="rows"
@click="(d) => emit('pick', d.values.region)"
/>
</template> <script>
import 'blockcharts/kits/basic.mjs';
import { blockchart } from 'blockcharts/svelte';
let { rows, onpick } = $props();
const spec = {
scales: { x: { type: 'band' }, y: { type: 'linear', zero: true } },
guides: [
{ type: 'axis', scale: 'x' },
{ type: 'axis', scale: 'y', format: 'compact' },
],
marks: [{ type: 'rect', x: 'region', y: 'total' }],
interaction: [{ type: 'tooltip' }],
};
const onClick = (d) => onpick(d.values.region);
</script>
<div use:blockchart={{ spec, data: rows, onClick }}></div> import 'blockcharts/kits/basic.mjs';
import 'blockcharts/element';
import { Component, CUSTOM_ELEMENTS_SCHEMA, input, output } from '@angular/core';
@Component({
selector: 'app-regions',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<block-chart [spec]="spec" [data]="rows()"
(bc-click)="pick.emit($event.detail.values.region)"></block-chart>
`,
})
export class RegionsComponent {
rows = input.required<object[]>();
pick = output<string>();
spec = {
scales: { x: { type: 'band' }, y: { type: 'linear', zero: true } },
marks: [{ type: 'rect', x: 'region', y: 'total' }],
interaction: [{ type: 'click' }],
};
} import BC from 'blockcharts/kits/basic.mjs';
const spec = {
scales: { x: { type: 'band' }, y: { type: 'linear', zero: true } },
guides: [
{ type: 'axis', scale: 'x' },
{ type: 'axis', scale: 'y', format: 'compact' },
],
marks: [{ type: 'rect', x: 'region', y: 'total' }],
interaction: [{ type: 'tooltip' }],
};
BC.data('sales', rows); // named: several charts can share it
const chart = BC.chart(document.getElementById('chart'), {
...spec,
data: 'sales',
interaction: [{ type: 'click' }],
});
chart.host.addEventListener('bc-click', (e) => {
openRegion(e.detail.values.region); // the clicked row
}); The Claude skill
From a spreadsheet to a report in one request
No app to write: install the skill once, then give Claude the data and say what you want to see.
- Your dataPaste a table into the chat or point to a CSV file. Dirty exports are fine: totals per month or per region are computed in the page.
- Claude describes the chartsAs a short JSON description, never as code. The composer checks every chart against the real data and names each mistake, so Claude fixes it before you see anything.
- You get one HTML fileInteractive charts with tooltips, zoom and a clickable legend. Email it, attach it to a ticket, put it in a shared folder — it opens anywhere, offline.
Download the skill and upload it under Settings → Capabilities → Skills. Code execution must be on: Claude runs the composer in its sandbox and hands you the HTML file.
Unpack the folder into the agent’s skills folder (for Claude Code: ~/.claude/skills). It needs Node.js 22 or later.
curl -fsSL https://blockcharts.online/blockcharts.skill -o /tmp/blockcharts.zip
mkdir -p ~/.claude/skills && unzip -o /tmp/blockcharts.zip -d ~/.claude/skills Invoke-WebRequest https://blockcharts.online/blockcharts.skill -OutFile $env:TEMP\blockcharts.zip
Expand-Archive $env:TEMP\blockcharts.zip $env:USERPROFILE\.claude\skills -Force Then just ask: “make an HTML report of monthly revenue by region from sales.csv”. More on scopes and updates in docs/skill.md.
How it works
Charts described as data, built from blocks
There is no chart code to get wrong. A chart is a few lines of JSON; the page is assembled from exactly the blocks those lines name.
A chart is a JSON spec
Data, named scales, marks, axes and interactions. The same description a person or an agent can read.
{
"data": "orders",
"scales": {"x": {"type": "band"}, "y": {"type": "linear"}},
"marks": [{"type": "rect", "x": "region", "y": "revenue"}],
"interaction": [{"type": "tooltip"}]
} Validated against the data
Unknown columns, wrong scale types, broken formats — reported with their place in the JSON. Nothing is written while a chart is wrong.
charts[1].marks[0].y:
unknown field "revnue" in dataset "orders" Only the blocks it names
The spec of step 1 needs 7 blocks: lib.pointer, lib.ticks, scale.band, scale.linear, mark.rect, interaction.tooltip, renderer.svg. Only those, the core and the data go into the file.
sales-report.html
core + 7 blocks + data
opens from disk, offline In numbers
A report carries its charts, not a whole library
Minified sizes of the code inside each composed page of the examples, next to everything blockcharts has. The data comes on top, gzipped when it is large.
Customizable
Change anything, from a color to a whole new block
Atoms compose in any way you need. Nothing to fork, no plugin system to learn: the built-in blocks use the same contract you do.
- 1 Parameters
Each block documents its own: currency and date formats in any locale, axis titles, bar radius, tooltip fields, zoom limits. Every parameter →
- 2 CSS
Colors are CSS variables and shapes have classes. A brand palette, dark mode or a print style is a stylesheet, not a spec change. Themes →
- 3 Your set of blocks
Build a kit with exactly the blocks you draw — bars and a tooltip, nothing else — or let the loader fetch them per page. Kits and the loader →
- 4 Functions by name
A tooltip with your own content is a function registered once with BC.defineFn and named from the spec, so specs stay JSON. The handle API →
- 5 Blocks of your own
A block is a small script calling BC.define — the same contract as the built-in ones. Validated, themed, and shipped only where it is used. Write a block →
A new block: a target line
BC.define({
role: 'guide', type: 'target', version: 1,
params: { scale: { kind: 'scale', required: true },
value: { kind: 'number', required: true } },
render(spec, ctx) {
const y = ctx.scales[spec.scale](spec.value), { x, w } = ctx.plot;
return { overlay: [{ type: 'path', d: `M${x} ${y}H${x + w}`,
style: { stroke: 'var(--bc-c2)', strokeDash: [5, 4] } }] };
},
}); Used in a spec
{ "type": "target", "scale": "y", "value": 50000 } Your colors
.report {
--bc-c0: #0b5cad; /* your brand blue */
--bc-text: #33415c;
--bc-grid: #e8edf5;
} The principles
Atoms first: why a report stays small
blockcharts principles v1.1 — how a page gets exactly the code its charts need and what follows from it, written down for a person writing a report, an agent writing one for them, and anyone writing a block. With the requirements every page, block and composer must meet.
§1
Exactly what the charts need, nothing more
A page carries the core and only the blocks its charts use. They are read from the specs and their declared dependencies — never listed by hand, so the list is never too long.
§2
Blocks are atoms
One role, one job: scales, transforms, marks, guides, interactions, renderers. A bar chart is band + linear + rect; a new kind of chart is a recipe, or one new block.
§3
Customizable at every level
Parameters, CSS variables and classes, your own set of blocks, functions by name, and blocks of your own on the same contract as the built-in ones.
§4
The page is the product
A report is one HTML file. It opens from disk, works offline, needs no server or account — everything it needs is inside it, and nothing it does not.
§5–7
The chart is data, checked
Plain JSON, everything declared once. Every chart is validated against the real data before the file is written; each problem names its place in the JSON.
§8–10
Light, repeatable, private
Big data is gzipped or binary, long series decimated. The same input gives the same bytes. A report loads nothing from the network.
For the people who read the report
A dashboard your team can just open
No BI seat to buy, no link that stops working, no deck of static screenshots.
Opens anywhere
One .html file: double-click it, email it, attach it to a ticket, keep it next to the data. No server, no login, no internet needed.
Interactive, not a screenshot
Tooltips with formatted numbers, zoom and pan on time series, drag to select, click the legend to hide a series and watch the rest rescale.
Numbers you can trust
Every chart is checked against the data before the file exists. Money, percentages and dates are formatted the same way on every machine.
Fast with real data
A year of hourly readings or tens of thousands of points stays smooth: long lines are thinned to what the screen can show, big scatters drawn on a canvas.
Looks like your company
Charts take their colors and fonts from CSS variables: your palette, light and dark themes, clean printing — without touching a chart.
Your data stays yours
The composer runs on your machine or in Claude’s sandbox. The report fetches nothing and reports nothing: no scripts from elsewhere, no analytics, no tracking.
Four ways in
One set of blocks, however you ship it
In an app, install from npm and use a component. In a page of your own, one script tag. For a report file to send around, the agent skill — pick by where the charts will live.
Components
For apps in React, Vue, Svelte, Angular
Install from npm, import a kit once, and use a ready component: BlockChart for React and Vue, an action for Svelte, the <block-chart> element for Angular and any page. Clicks come back with the row.
import { BlockChart } from 'blockcharts/react'; Get started → One script tag
For your own pages
A kit is the core and a set of blocks in one file, from npm, a CDN or your own site — 42.9 KB gzipped for bars, lines and areas. Charts are JSON in the HTML.
npm install blockcharts Try a kit → Loader
For sites with many different charts
A 2.0 KB script finds the charts on a page and fetches only the blocks they use, with SRI hashes from the release manifest.
<script src=".../0.0.5/loader.js" data-auto></script> Try the loader → Agent skill
For report files, from a table
Claude writes the JSON, the bundled composer checks it against the data and writes one HTML file that opens anywhere. The same composer runs from a script or CI.
make a report of revenue by region from sales.csv Get the skill → Gallery
The charts business reports are made of
Each one is a recipe the skill ships, drawn live here. Open one to see its JSON and the report the composer makes from it.
Waterfall
How a start value becomes an end value through gains and losses (profit bridge)
Moving average and running total
A moving average over noisy daily values; a running total per series
Slope chart
How each item changed between two points (before and after, two years)
Product portfolio
Two numeric variables and a third as the size of each bubble
Stacked bars with a line, and shares of the stack
Stacked bars with a line of another measure (a margin) on a second axis; segments labelled with their share of the bar
Your next dashboard, with nothing extra in it
Install blockcharts from npm, drop a component into your app, and ship only the chart code it uses. For a report file, the Claude skill does it from a table.