@graphysdk/geom-mekko
Beta. This geom is on a
0.xversion line: a minor release may change its aesthetics, params, style or look. Use a caret range (^0.1.0) to take only patches.
A Marimekko geom for the Graphy charting SDK. It draws a 100% stacked column chart whose columns are as wide as their totals, so each cell's area is its share of the whole: a market's size across, each company's share of it up.
Learn more at graphy.dev.
Install
npm install @graphysdk/geom-mekko @graphysdk/react
Requires React 19. Its only peer is @graphysdk/react.
Usage
Data is one row per cell. Map the column to x, the cell's amount to y and its group to color. The share axis is continuous, so declare scale.x.continuous(); it is ticked with each column's name at its center:
import { createGraphyKit, GraphRenderer } from '@graphysdk/react';
import { mekko } from '@graphysdk/geom-mekko';
const kit = createGraphyKit({ plugins: [mekko] });
const spec = kit.pipe(
kit.createSpec({ x: 'market', y: 'revenue', color: 'company' }),
kit.geom.mekko(),
kit.scale.x.continuous(),
kit.scale.y.continuous()
);
export function Markets({ data }) {
return (
<kit.GraphProvider spec={spec} data={data}>
<GraphRenderer />
</kit.GraphProvider>
);
}
Add kit.coord.flip() for a horizontal mekko. Style the cells with kit.style.geom.mekko().
Docs
Feedback
This geom is released early to hear what works. Tell us on Discord.
Licence
This package is available under PolyForm Noncommercial, Small Business, or a 32-day Free Trial. Free Trial is local or internal evaluation only — it does not cover a public page. See what you can do under the trial.