Travel time rings
Rings of minutes around a starting point, and the places each one reaches. Good for commutes, where to live, and the reach of a shop or a station.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'isochrone',
origin: 'Tunis Marine',
mode: 'transit',
rings: [10, 20, 30, 45],
places: [
{ name: 'La Goulette', bearing: 90, minutes: 16 },
{ name: 'Carthage', bearing: 65, minutes: 19 },
{ name: 'La Marsa', bearing: 50, minutes: 22 },
{ name: 'Ariana', bearing: 345, minutes: 28 },
{ name: 'Bardo', bearing: 285, minutes: 30 },
{ name: 'Manouba', bearing: 270, minutes: 34 },
{ name: 'Ben Arous', bearing: 185, minutes: 41 },
{ name: 'Radès', bearing: 140, minutes: 44 },
{ name: 'Hammam-Lif', bearing: 160, minutes: 46 },
],
};
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 isochrone takes:
/** Rings of travel time around a starting point, with the places reached. */
interface IsochroneSpec extends Base {
type: 'isochrone';
origin: string;
/** Minutes: 10, 20, 30 by default. */
rings?: number[];
/** `bearing` in degrees: 0 north, 90 east. */
places: { name: string; minutes: number; bearing: number }[];
mode?: 'walk' | 'bike' | 'car' | 'transit';
onItemClick?: (name: string) => void;
}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