Install
@graphysdk/react and nothing else. Register the plugin once with createGraphyKit, which adds kit.geom.mekko() and binds kit.GraphProvider to the same plugin:
A mekko chart
Pass one row per cell. Map the column tox, the cell’s amount to y and its group to color:
Column order
Passsort to run the columns in another order: 'descending' runs them largest first, 'ascending' smallest first, and a list names them in order, any column it leaves out following in data order. An unknown sort is reported as a warning, and the columns keep data order.
The share axis
Both axes run from 0 to 100%. The axis along the columns is continuous, so declarescale.x.continuous(), not scale.x.discrete(): a discrete axis gives every category the same width. It is ticked with each column’s name at the column’s center, and draws no grid line through the columns.
The other axis reads each cell’s share of its column, in percentages. It has no title by default, since the share is a variable the geom writes; give it one in the config:
Horizontal
Addkit.coord.flip(). The columns run down the chart as rows, the first at the top, and the shares run across.
Styling
Every cell is one observation, styled withkit.style.geom.mekko():
The cells abut, so the border is what parts them. A chart-wide
style.geom() reaches the cells as it reaches a bar.
A cell’s fill takes a pattern (diagonal, crosshatch or dots) or a gradient as well as a colour. A pattern replaces the colour the scale gives, so set it as an override, and pick a group out with where. Hatching every group but one lets the groups read apart without colour alone:
The share variables
The geom writes two shares as variables you can name in alabel, a highlight or an entry’s where. Both are fractions, in the percentage format:
Hover and highlight
Hovering a cell emphasises it. The tooltip is headed by its column, and lists each group’s share of that column, with the hovered one marked:Not yet supported
- The editor’s chart-type picker and the chart agent. In editable mode the mekko renders, hovers, selects and takes annotations on a cell’s center, but it is authored in code.
- Amounts in the tooltip. It gives each group’s share of the column, not its amount or the column’s share of the total.
- Column labels that would overlap. The share axis prints every column’s name, however narrow its column; a very narrow column’s name can run into its neighbour’s.
- Data labels.
dataLabelsprints nothing on a cell yet. - Warnings for dropped amounts. A zero, negative or non-finite amount is left out without a warning.
- A discrete share axis. Declaring
scale.x.discrete()draws the cells in the wrong places, with no warning. - Polar coordinates. A mekko draws under
coord.cartesian()andcoord.flip()only.

