Mode share
How people travel, split by mode with an icon for each, against a target or another year. Good for mobility plans, commuter surveys and city reports.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
import 'nervure/themes';
const spec = {
type: 'modeshare',
name: '2026',
data: [
{ mode: 'walk', value: 22 },
{ mode: 'bike', value: 6 },
{ mode: 'bus', value: 11 },
{ mode: 'metro', value: 17 },
{ mode: 'car', value: 31 },
],
compare: {
name: '2030 goal',
data: [
{ mode: 'walk', value: 25 },
{ mode: 'bike', value: 14 },
{ mode: 'bus', value: 13 },
{ mode: 'metro', value: 21 },
{ mode: 'car', value: 14 },
],
},
};
export default function Example() {
return <Chart spec={spec} style={{ height: 340 }} />;
}Or import this chart alone: what each import weighs.
Options
Beside the fields shared by every chart (title, format, heading, export…), type modeshare takes:
/** Share of each way of travelling, with an icon for each, and a second split to compare with. */
interface ModeShareSpec extends Base {
type: 'modeshare';
/** Trips, people or kilometres by mode. */
data: { mode: TravelMode; value: number; name?: string; color?: string }[];
/** Name of `data`: `Today`, `2026`… */
name?: string;
/** A second split drawn under the first one: a target or another year. */
compare?: { name: string; data: { mode: TravelMode; value: number }[] };
legend?: boolean | LegendOptions;
}
/** A way of moving, drawn with its own icon. */
type TravelMode = 'walk' | 'bike' | 'scooter' | 'bus' | 'tram' | 'metro' | 'train' | 'car' | 'carpool' | 'plane';Style it
- Colours:
theme.palette,chart.setColor(name, colour), or--nervure-palettein your CSS. More - Marks:
[data-series="name"], parts:[data-part="axes"],legend,series. What you change is kept in exports. - Movement:
animation: falsedraws at once. More - Files:
chart.download('png'),svg,csv. More