3D layered area chart
Each series as a solid layer filled down to the floor, one behind the other. Good for two to four series over time, on a cover page.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
import 'nervure/3d';
const spec = {
type: 'area3d',
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
series: [
{ name: 'North', data: [49.7, 44.4, 44.7, 38.6, 32.4, 35.1, 36.4, 31.9, 27.8, 23.2, 18.6, 27.4] },
{ name: 'South', data: [33.9, 25.7, 24.8, 20.7, 16.8, 21.7, 13.7, 13.1, 15.3, 14.9, 21.5, 16.5] },
{ name: 'East', data: [46.2, 53.7, 49.2, 50.9, 48.9, 41.6, 46.8, 43.6, 43.3, 52.2, 59.4, 57.3] },
],
};
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 area3d takes:
/** Areas as solid layers filled down to the floor, one behind the other, or stacked into one block. */
interface Area3DSpec extends Base3D {
type: 'area3d';
categories: string[];
series: Series3D[];
/** The series piled up in one block instead of one behind the other. */
stacked?: boolean;
/** With `stacked`, every category is 100 % high. */
percent?: boolean;
/** Depth of a layer, as a share of the room between two layers: 0.55 by default. */
thickness?: number;
min?: number;
max?: number;
legend?: boolean | LegendOptions;
}
interface Base3D extends Base {
/** Where the eye stands, in degrees: `azimuth` turns around the vertical axis, `elevation` rises from the floor (0) to straight above (90). */
view?: { azimuth?: number; elevation?: number };
/** Drag the chart, or focus its turn button and use the arrow keys, to turn the view. Home on the button goes back to `view`. */
rotate?: boolean;
}
interface Series3D {
name: 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