3D area chart
Several series as ribbons, one behind the other. Good for three or four series over time, each with its own shape.
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: 'ribbon3d',
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
series: [
{ name: 'North', data: [49.6, 43.7, 44, 37.2, 30.3, 33.3, 34.8, 29.8, 25.2, 20.1, 14.9, 24.8] },
{ name: 'South', data: [34.2, 25.1, 24.1, 19.5, 15.3, 20.6, 11.7, 11.1, 13.5, 13.1, 20.5, 14.9] },
{ name: 'East', data: [46.3, 54.6, 49.7, 51.6, 49.3, 41.2, 47, 43.4, 43.1, 53, 61, 58.7] },
{ name: 'West', data: [40.6, 39, 39.1, 40.2, 37.6, 48.3, 46.1, 41.3, 36.9, 28.2, 24.5, 15.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 ribbon3d takes:
/** Areas of several series as ribbons, one behind the other. */
interface Ribbon3DSpec extends Base3D {
type: 'ribbon3d';
categories: string[];
series: Series3D[];
/** Depth of a ribbon, as a share of the room between two ribbons: 0.6 by default. */
thickness?: number;
/** Straight lines between the points (default) or smooth ones. */
curve?: 'linear' | 'smooth';
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