Points placed by two numbers, with a third number as the size of each bubble. Use it to compare items on three measures at once.
Charts need Recharts. Install it once with
yarn add recharts, then import from@bolio-ui/core/charts. The package stays out of your bundle until you use a chart.
Each point has an x, a y and a z. The z sets the area of the bubble.
sizeRange is the area of the smallest and of the biggest bubble, in square pixels.
| Attribute | Description | Type | Accepted values | Default |
|---|---|---|---|---|
| data | the series to plot | ScatterSeries[] | ScatterSeries | - |
| height | height of the chart, in pixels | number | - | 300 |
| sizeRange | area of the smallest and the biggest bubble, in square pixels | [number, number] | - | [40, 600] |
| zLabel | name of the size in the tooltip | string | - | z |
| xAxisLabel | title of the x axis | string | - | - |
| yAxisLabel | title of the y axis | string | - | - |
| withLegend | show the legend | boolean | - | false |
| withTooltip | show the values of a bubble on hover and focus | boolean | - | true |
| withXAxis | show the x axis | boolean | - | true |
| withYAxis | show the y axis | boolean | - | true |
| withGrid | show the grid lines | boolean | - | true |
| valueFormatter | how a number is written | (value: number) => string | - | thousands separators, en-US |
| ... | native props, passed to the root | HTMLAttributes | 'aria-label', 'className', ... | - |
type ScatterSeries = {
name: string // identifies the series
label?: string // shown in the legend, `name` when missing
color?: string // any CSS color, a theme color when missing
points: Array<{ x: number; y: number; z?: number }>
}
The ref points at the root div.
Name the chart with aria-label, or with aria-labelledby pointing at a heading. A named chart becomes a group. The chart can be focused. Arrow Left and Right then move through the data and show the values in the tooltip.
Size and color are hard to compare without sight, so write the pattern you see in text, or offer the points in a Table.