Charts ยท console.warn
a populationPyramid needs exactly two halves...
Printed by Charts, prefixed [lattice], since 1.85.0.
Warnings reference › chart:pyramid:halves
- Identifier
chart:pyramid:halves- Raised by
- Charts
- Since
- 1.85.0
What happened
A populationPyramid mirrors two halves about a central axis, but its binding produced a different number: the series column held one value or more than two, or fewer than two measures were given. With one half it draws that half alone; with more than two it draws the first two.
The fix
Split y by a series column holding exactly two values (the first is drawn on the left), or name the two columns: measures: [{ col: 'male' }, { col: 'female' }]. Filter the grid to two values if the column holds more.
The smallest fix
createChart({ grid, container, type: 'populationPyramid', x: 'age', measures: [{ col: 'male' }, { col: 'female' }] });
Reference
Covered in full at the API reference.