3D column chart
Columns standing on a floor, the series side by side, with a grid on the back walls; drag to turn it. Good for a cover page or a slide, with few categories and few series.
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: 'columns3d',
categories: ['Q1', 'Q2', 'Q3', 'Q4'],
series: [
{ name: '2024', data: [61, 51, 33, 58] },
{ name: '2025', data: [30, 29, 69, 63] },
{ name: '2026', data: [37, 39, 36, 36] },
],
};
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 columns3d takes:
/** Columns standing on a floor, the series side by side in each category, with a grid on the back walls. */
interface Columns3DSpec extends Base3D {
type: 'columns3d';
categories: string[];
series: Series3D[];
/** `box` by default. */
shape?: 'box' | 'cylinder' | 'cone' | 'pyramid';
/** Share of a category taken by its columns, from 0.2 to 1: 0.7 by default. */
width?: number;
/** Lowest and highest value of the vertical axis. */
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