3D pictorial chart
Units counted with 3D houses, cubes or trees, one lane for each item. Good for counts people grasp at once: homes sold, cars, trees planted.
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: 'pictorial3d',
icon: 'house',
unit: 10,
data: [
{ name: 'North', value: 154 },
{ name: 'South', value: 125 },
{ name: 'East', value: 76 },
{ name: 'West', value: 145 },
],
};
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 pictorial3d takes:
/** Units counted with 3D icons in an isometric grid: one lane for each item. */
interface Pictorial3DSpec extends Base3D {
type: 'pictorial3d';
data: Item[];
/** Value of one icon: chosen so that the longest lane has at most 40 icons by default. */
unit?: number;
/** `cube` (default), `house`, `car`, `tree` or `cylinder`. */
icon?: 'cube' | 'house' | 'car' | 'tree' | 'cylinder';
/** Icons in a row before the lane goes on in a second row: 10 by default. */
perRow?: 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;
}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