Horizon chart
Many long series, each in a thin folded strip. Good for dozens of series on one screen.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'horizon',
categories: [
'0 h', '1 h', '2 h', '3 h', '4 h', '5 h', '6 h', '7 h', '8 h', '9 h', '10 h', '11 h',
'12 h', '13 h', '14 h', '15 h', '16 h', '17 h', '18 h', '19 h', '20 h', '21 h', '22 h',
'23 h', '24 h', '25 h', '26 h', '27 h', '28 h', '29 h', '30 h', '31 h', '32 h', '33 h',
'34 h', '35 h', '36 h', '37 h', '38 h', '39 h', '40 h', '41 h', '42 h', '43 h', '44 h',
'45 h', '46 h', '47 h',
],
series: [
{
name: 'North',
data: [
7.2, 13.9, 9.1, 13, 20.3, 24.6, 20.2, 14.5, 9.7, 3.4, 9.7, 13.3, 17.2, 17.7, 22.3, 18.3,
23.2, 21.1, 25.9, 19.5, 19.9, 21.4, 27.1, 33.7, 32.4, 30.6, 31.9, 34.1, 34.1, 33, 38.4,
37.9, 43.6, 38.8, 41.6, 45.7, 40.8, 47.5, 50.6, 45, 50.2, 48.9, 53.4, 51.6, 57.4, 53.3,
55.1, 62.3,
],
},
{
name: 'South',
data: [
4, 0.1, 1, 5.1, 0.6, 7.8, 2.9, -3.5, 4, 10.6, 6.5, 9.9, 14.2, 20.4, 26.8, 33, 32, 36.2,
38.2, 41.9, 47.5, 50.4, 50.8, 56.3, 56.1, 51, 49.4, 46.4, 45.6, 47.9, 49.1, 47.6, 47.9,
44.5, 43.2, 42, 44.4, 44.3, 49.6, 55.6, 50.5, 57.7, 59.5, 62.6, 66.4, 72.3, 72, 70.3,
],
},
{
name: 'East',
data: [
4, 6.1, 1.7, 7, 12.7, 9.9, 15.6, 16.6, 15.8, 15.7, 11.8, 13.6, 10.1, 6.5, 11.1, 16.1, 22,
22.9, 23.3, 29.9, 29.6, 23.9, 29, 30.6, 25.9, 31.4, 31.2, 30.3, 33.2, 28.9, 31.7, 36.2,
32.5, 31.8, 37.4, 39.4, 41.4, 41.9, 36.9, 37.4, 42.1, 36.5, 38.7, 45.3, 48.9, 43.5, 41.1,
47.5,
],
},
{
name: 'West',
data: [
-3.7, -7.3, -8.6, -14.3, -20.8, -14.3, -8.7, -5.3, -8.6, -5.8, -11.1, -14.8, -9.8, -4.2,
-4.2, 1.9, -0.6, -0.2, 6.4, 0, 2.8, 6.1, 10.9, 6.7, 10.7, 16.1, 19.1, 19.3, 16, 10.5, 8.5,
12.7, 10, 11.2, 7.3, 12.8, 17.2, 16.6, 21.8, 22.5, 18.6, 15.5, 19.6, 14.5, 12.1, 18, 16.5,
11.9,
],
},
{
name: 'Centre',
data: [
-1, 2.6, 4.9, 4.8, 7.4, 4.2, 0.8, 2.5, -1.9, -0.1, 6.9, 5.9, 6.9, 11.6, 8.1, 3.8, 4.1, 8.5,
11.2, 5.8, 3.5, 7.9, 2.9, 1, 8.5, 8.1, 5.5, 12, 15.1, 15.9, 18.5, 23.4, 30.7, 37.8, 38.3,
45.5, 52.9, 57.4, 51.1, 46.5, 46.4, 51, 56.4, 62.2, 68.4, 66, 66, 61.6,
],
},
],
};
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 horizon takes:
interface HorizonSpec extends Base {
type: 'horizon';
categories: string[];
series: { name: string; data: number[] }[];
bands?: number;
up?: string;
down?: string;
}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