A poster that counts at scale. Blocks of thousands of unit icons fill most of the sheet, a second band counts reference groups with the same icon at the same size in a muted colour, and a bottom row holds three small graphics: squares sized by area with a ratio bracket, thick bars with the numbers inside, and shares as nested outlines or filled silhouettes.
Block bars
Compares 3 to 12 values as thick rounded bars from a zero baseline, with each value printed inside the end of its bar and the category beneath.
- Use when
- A short series or ranking that should read as a bold graphic with no axis: ticket sales in each of six years, two paired measures in five regions. Add
detailfor a second small figure above each bar andmarkerfor an event between two bars. - Avoid when
- More than 12 bars, more than two series or stacked parts (use bar chart); negative values (use diverging bar chart); a long time series (use line chart); values that differ by more than about 50 times, where the short bars vanish (use proportional area).
Preview
import { BlockBar } from "insightcharts";
const data = [
{ year: "2020", tickets: 18400, seats: "41% of seats" },
{ year: "2021", tickets: 22900, seats: "49% of seats" },
{ year: "2022", tickets: 31200, seats: "58% of seats" },
{ year: "2023", tickets: 36800, seats: "64% of seats" },
{ year: "2024", tickets: 41500, seats: "69% of seats" },
{ year: "2025", tickets: 48200, seats: "74% of seats" },
];
export function Example() {
return (
<BlockBar
data={data}
name="year"
value="tickets"
detail="seats"
format="integer"
marker={{ after: "2021", label: "Second screen opened" }}
title="The Portholm Film Festival sold 48,200 tickets in 2025"
subtitle="Tickets sold per year and share of available seats filled, 2020 to 2025"
source="Illustrative data"
note="Invented figures for a fictional festival"
/>
);
}{
"type": "block-bar",
"data": [
{ "year": "2020", "tickets": 18400, "seats": "41% of seats" },
{ "year": "2021", "tickets": 22900, "seats": "49% of seats" },
{ "year": "2022", "tickets": 31200, "seats": "58% of seats" },
{ "year": "2023", "tickets": 36800, "seats": "64% of seats" },
{ "year": "2024", "tickets": 41500, "seats": "69% of seats" },
{ "year": "2025", "tickets": 48200, "seats": "74% of seats" }
],
"name": "year",
"value": "tickets",
"detail": "seats",
"format": "integer",
"marker": { "after": "2021", "label": "Second screen opened" },
"title": "The Portholm Film Festival sold 48,200 tickets in 2025",
"subtitle": "Tickets sold per year and share of available seats filled, 2020 to 2025",
"source": "Illustrative data",
"note": "Invented figures for a fictional festival"
}Render with import { Insight } from "insightcharts" and <Insight spec={spec} />. Nested specs resolve by name; nothing else to import.
Composition
Used in
2 infographics use block bars.
Infographics
2A poster of change over a run of periods: a full-width ribbon of bands whose thickness is each entity's value and whose order is its rank (ribbon-chart), a strip of two to four dated figures under it, and a bottom row with one measure per period as thick bars (block-bar) and one share at several dates as nested outlines (nested-shares).
Installation
$ pnpm dlx shadcn@latest add @insightcharts/block-barThe CLI copies the source into your project and needs the @insightcharts registry in components.json; see installation. With the package, import it by name:
import { BlockBar } from "insightcharts";Examples
Paired series
import { BlockBar } from "insightcharts";
const data = [
{ line: "Coast line", weekday: 41200, weekend: 26800 },
{ line: "Valley line", weekday: 33500, weekend: 12900 },
{ line: "Airport link", weekday: 27100, weekend: 29400 },
{ line: "Harbour loop", weekday: 15800, weekend: 9200 },
];
export function Example() {
return (
<BlockBar
data={data}
name="line"
value={["weekday", "weekend"]}
names={{ weekday: "Weekday", weekend: "Weekend day" }}
format="compact"
title="The Airport link carried 29,400 passengers on a weekend day"
subtitle="Average daily passengers by rail line, weekdays and weekend days, 2025"
source="Illustrative data"
note="Invented figures for a fictional network"
/>
);
}{
"type": "block-bar",
"data": [
{ "line": "Coast line", "weekday": 41200, "weekend": 26800 },
{ "line": "Valley line", "weekday": 33500, "weekend": 12900 },
{ "line": "Airport link", "weekday": 27100, "weekend": 29400 },
{ "line": "Harbour loop", "weekday": 15800, "weekend": 9200 }
],
"name": "line",
"value": ["weekday", "weekend"],
"names": { "weekday": "Weekday", "weekend": "Weekend day" },
"format": "compact",
"title": "The Airport link carried 29,400 passengers on a weekend day",
"subtitle": "Average daily passengers by rail line, weekdays and weekend days, 2025",
"source": "Illustrative data",
"note": "Invented figures for a fictional network"
}Render with import { Insight } from "insightcharts" and <Insight spec={spec} />. Nested specs resolve by name; nothing else to import.
Highlight, click to select
import { BlockBar } from "insightcharts";
const data = [
{ country: "Norway", share: 89 },
{ country: "Sweden", share: 58 },
{ country: "Netherlands", share: 35 },
{ country: "Germany", share: 19 },
{ country: "Spain", share: 9 },
];
export function Example() {
return (
<BlockBar
data={data}
name="country"
value="share"
format={"{value}%"}
highlight="Germany"
select
title="Battery electric cars were 19% of new cars sold in Germany in 2025"
subtitle="Battery electric share of new passenger car sales, five countries, 2025"
source="Illustrative data"
note="Rounded, invented for illustration"
/>
);
}{
"type": "block-bar",
"data": [
{ "country": "Norway", "share": 89 },
{ "country": "Sweden", "share": 58 },
{ "country": "Netherlands", "share": 35 },
{ "country": "Germany", "share": 19 },
{ "country": "Spain", "share": 9 }
],
"name": "country",
"value": "share",
"format": "{value}%",
"highlight": "Germany",
"select": true,
"title": "Battery electric cars were 19% of new cars sold in Germany in 2025",
"subtitle": "Battery electric share of new passenger car sales, five countries, 2025",
"source": "Illustrative data",
"note": "Rounded, invented for illustration"
}Render with import { Insight } from "insightcharts" and <Insight spec={spec} />. Nested specs resolve by name; nothing else to import.
Stress: twelve bars, long labels, uneven values
import { BlockBar } from "insightcharts";
const data = [
{ port: "Greater Northern Container Terminal", teu: 9400, d: "31% of total" },
{ port: "Southport", teu: 6100, d: "20%" },
{ port: "Marlow Quay", teu: 4300, d: "14%" },
{ port: "Eastern Approaches Deepwater Port", teu: 3900, d: "13%" },
{ port: "Whitby Sands", teu: 2200, d: "7%" },
{ port: "Fenwick", teu: 1500, d: "5%" },
{ port: "Old Harbour", teu: 1100, d: "4%" },
{ port: "Tidewater", teu: 800, d: "3%" },
{ port: "Cape Ferrand", teu: 420, d: "1.4%" },
{ port: "Lyme", teu: 260, d: "0.9%" },
{ port: "St Agnes Island Ferry Port", teu: 90, d: "0.3%" },
{ port: "Dunmore", teu: 30, d: "0.1%" },
];
export function Example() {
return (
<BlockBar
data={data}
name="port"
value="teu"
detail="d"
format="integer"
title="Greater Northern handled 9,400 thousand containers in 2025"
subtitle="Container throughput by port, thousand TEU, 2025"
source="Illustrative data"
note="Invented figures for a fictional country"
/>
);
}{
"type": "block-bar",
"data": [
{ "port": "Greater Northern Container Terminal", "teu": 9400, "d": "31% of total" },
{ "port": "Southport", "teu": 6100, "d": "20%" },
{ "port": "Marlow Quay", "teu": 4300, "d": "14%" },
{ "port": "Eastern Approaches Deepwater Port", "teu": 3900, "d": "13%" },
{ "port": "Whitby Sands", "teu": 2200, "d": "7%" },
{ "port": "Fenwick", "teu": 1500, "d": "5%" },
{ "port": "Old Harbour", "teu": 1100, "d": "4%" },
{ "port": "Tidewater", "teu": 800, "d": "3%" },
{ "port": "Cape Ferrand", "teu": 420, "d": "1.4%" },
{ "port": "Lyme", "teu": 260, "d": "0.9%" },
{ "port": "St Agnes Island Ferry Port", "teu": 90, "d": "0.3%" },
{ "port": "Dunmore", "teu": 30, "d": "0.1%" }
],
"name": "port",
"value": "teu",
"detail": "d",
"format": "integer",
"title": "Greater Northern handled 9,400 thousand containers in 2025",
"subtitle": "Container throughput by port, thousand TEU, 2025",
"source": "Illustrative data",
"note": "Invented figures for a fictional country"
}Render with import { Insight } from "insightcharts" and <Insight spec={spec} />. Nested specs resolve by name; nothing else to import.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| namerequired | string | Category field: one bar (or one pair of bars) per value. | |
| valuerequired | string | string[] | Value field, or two fields for paired bars. | |
| series | string | Field that splits long-format rows into paired series. | |
| detail | string | Field holding a short secondary label printed above each bar, e.g. "3.5% of GDP". | |
| marker | { after: string; label?: string } | A dotted line after the named category, marking an event, with an optional label. | |
| orientation | "auto" | "vertical" | "horizontal" | "auto" | auto draws columns and switches to horizontal bars on narrow widths. |
| names | Record<string, string> | Display names for series keys. |
Common chart props 29
Every chart built with defineChart accepts these on top of its own props.
| Prop | Type | Description |
|---|---|---|
| data | DataInput | Rows, CSV text, a URL, { url, path }, an async function, or an Arrow-style table. Omit inside <InsightData>. |
| transform | Transform | Transform[] | A pipeline of transforms applied before drawing. |
| title | string | The title. One plain statement of what the data shows, with the number and the period ("Monthly churn fell from 4.2% to 2.1% in 2024"), or a plain label ("Monthly churn, 2024"). One clause, no figures of speech. |
| subtitle | string | Measure, unit, population, period. |
| source | string | Data source, shown as "Source: ...". |
| note | string | Method notes or caveats. |
| height | number | string | CSS height of the plot. Default 360. |
| aspect | number | Width / height. Overrides height. |
| highlight | string | string[] | The entity (or entities) the title is about. Every other series is drawn in grey. |
| annotations | Annotation[] | Reference lines, shaded bands and callouts, in data coordinates. |
| format | FormatSpec | How to print values: "compact", "percent", "currency:USD", "{value} kg", Intl options, or a function. |
| legend | boolean | Show the legend. Default: shown when there are two or more series. |
| select | boolean | string | Make marks clickable to filter. Inside <InsightData> the selection filters every other chart. Pass a field name, or true to use the chart's category field. |
| onSelect | (values: string[], field: string) => void | Called with the selected values whenever the selection changes. |
| option | EChartsOption | ((option: EChartsOption, ctx: BuildContext) => EChartsOption) | Deep-merged over the generated ECharts option, or a function that receives and returns it. Use it for ECharts settings no prop covers. |
| theme | ThemeInput | A theme, or a partial set of tokens merged over the surrounding theme, for this chart only. |
| mode | ModeInput | "auto" (default) follows the page, "system" follows the OS, or force "light" / "dark". |
| renderer | RendererInput | "auto" (default) uses SVG for light charts and canvas for heavy ones. |
| animate | boolean | Set false to disable animation. Reduced-motion preferences are always respected. |
| lazy | boolean | Mount the chart only when it scrolls near the viewport. Default true. |
| group | string | Link tooltips with other charts sharing this group id. |
| exportable | boolean | ExportFormat[] | Show an export menu: true or a list of formats from png, jpeg, svg, pdf, csv, json. |
| table | boolean | Show a collapsible "View data" table under the chart. |
| alt | string | Accessible description: the chart type and measures, then the main pattern and the notable values. |
| id | string | Stable id for this chart's selection in the shared store. |
| onEvents | Record<string, ChartEventHandler> | ECharts event handlers, e.g. { click: (params, chart) => {} }. Prefix a name with zr: to bind to the canvas itself. |
| onReady | (chart: EChartsInstance) => void | Called with the ECharts instance once it is created. |
| className | string | Class name for the outer <figure>. |
| style | CSSProperties | Inline style for the outer <figure>. |