BubbleChart

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.

General

Each point has an x, a y and a z. The z sets the area of the bubble.

Many series and size

sizeRange is the area of the smallest and of the biggest bubble, in square pixels.

APIs

BubbleChart.Props

AttributeDescriptionTypeAccepted valuesDefault
datathe series to plotScatterSeries[]ScatterSeries-
heightheight of the chart, in pixelsnumber-300
sizeRangearea of the smallest and the biggest bubble, in square pixels[number, number]-[40, 600]
zLabelname of the size in the tooltipstring-z
xAxisLabeltitle of the x axisstring--
yAxisLabeltitle of the y axisstring--
withLegendshow the legendboolean-false
withTooltipshow the values of a bubble on hover and focusboolean-true
withXAxisshow the x axisboolean-true
withYAxisshow the y axisboolean-true
withGridshow the grid linesboolean-true
valueFormatterhow a number is written(value: number) => string-thousands separators, en-US
...native props, passed to the rootHTMLAttributes'aria-label', 'className', ...-

ScatterSeries

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 }>
}

Ref

The ref points at the root div.

Accessibility

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.

Edit this page on GitHub