Skip to content

Bar Chart 3D

A matrix of heights as 3-D bars (Wolfram's BarChart3D), rendered by <notatio-bar-chart-3d>. data[j][i] is the bar in row j, column i; a flat list reads as a single row.

Each bar is a box drawn as its top face plus the two side faces that turn toward the viewer — the back pair is always hidden, so it is never emitted. Bars are painted back-to-front on the depth of their base centre, and shaded by height on the same ramp the other 3-D figures use. The projection is the shared orthographic camera (azimuth / elevation, no perspective), so the whole figure is a pure function of its attributes.

Bars

A 3×3 matrix

source
<notatio-bar-chart-3d data="[[1,2,3],[2,4,3],[3,1,5]]" />

A single row

A flat list is one row of bars — the 3-D counterpart of a plain BarChart.

source
<notatio-bar-chart-3d data="[3,1,4,1,5,9,2,6]" label="digits of π" />

Labelled categories

col-labels and row-labels take comma-separated categories, drawn just outside the near floor edges.

source
<notatio-bar-chart-3d data="[[4,2,3],[1,5,2]]" col-labels="a,b,c" row-labels="x,y" />

Tighter packing, steeper view

gap is the space between neighbouring bars as a fraction of a cell; at 0 the bars touch.

source
<notatio-bar-chart-3d data="[[1,2,3,4],[2,3,4,5],[3,4,5,6],[4,5,6,7]]" gap="0.05" elevation="45" azimuth="40" />

Negative values

When the data straddles zero, the zero plane sits inside the cube and negative bars hang beneath it.

source
<notatio-bar-chart-3d data="[[-2,1,3],[2,-1,1]]" />

A pinned height scale

zrange pins the height scale so several charts can be compared; axes="false" drops the projected axis box.

source
<notatio-bar-chart-3d data="[[1,2],[2,3]]" zrange="0,10" axes="false" />

Roadmap

  • Per-row colouring, à la ChartStyle, for grouped comparisons.
  • Value labels floating above each bar.
  • Drag-to-rotate, shared with the other 3-D figures.