@graphysdk/geom-dumbbell
Beta. This geom is on a
0.xversion line: a minor release may change its aesthetics, style parts or look. Use a caret range (^0.1.0) to take only patches.
A dumbbell geom for the Graphy charting SDK. It compares values within each category: a dot per value, joined by a connector from the smallest to the largest.
Learn more at graphy.dev.
Install
npm install @graphysdk/geom-dumbbell @graphysdk/react
Requires React 19. Its only peer is @graphysdk/react.
Usage
Data is long, one row per dot. Map the category to x, the value to y and the group to color:
import { createGraphyKit, GraphRenderer } from '@graphysdk/react';
import { dumbbell } from '@graphysdk/geom-dumbbell';
const kit = createGraphyKit({ plugins: [dumbbell] });
const spec = kit.pipe(
kit.createSpec({ x: 'role', y: 'salary', color: 'sex' }),
kit.geom.dumbbell(),
kit.scale.x.discrete(),
kit.scale.y.continuous({ zero: false }),
kit.scale.color.discrete()
);
export function PayGap({ data }) {
return (
<kit.GraphProvider spec={spec} data={data}>
<GraphRenderer />
</kit.GraphProvider>
);
}
Add kit.coord.flip() for a horizontal dumbbell. Style the dots with kit.style.geom.dumbbell() and the connector with kit.style.geom.dumbbell.connector().
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.
For a commercial licence, talk to us.