Skip to main content

Scatter Chart

A scatter/bubble chart component built using Recharts v3. Visualize two-variable correlation data with series-based API, bubble mode via zKey, customizable colors, gradients, glow effects, and interactive legend.

Installation

$ npx shadcn@latest add @orecus/scatter-chart
Registry:
@orecus/chart@orecus/color-utils@orecus/chart-utils@orecus/card

Component

Height vs Weight

Two-group correlation analysis

Price vs Sales Volume

Single series price elasticity

Props

PropTypeDefaultDescription
series*ScatterSeries[]Array of series, each with a name and data array
xKey*stringData key for x-axis values
yKey*stringData key for y-axis values
zKeystringData key for dot size (bubble mode)
zRange[number, number][4, 20]Min/max dot radius for bubble mode
colorsThemeColor[]["primary", "blue", "green"]Theme colors for each series
variant'default' | 'gradient''gradient'Stroke style
glowbooleantrueAdd colored glow/blur effect behind dots
dotSizenumber6Base dot radius (when no zKey)
shape'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye''circle'Recharts native dot shape
valueFormatter(value: number) => stringFormatter for values in tooltip
xAxisFormatter(value: number) => stringFormatter for x-axis tick labels
yAxisFormatter(value: number) => stringFormatter for y-axis tick labels
xLabelstringX-axis label
yLabelstringY-axis label
showXAxisbooleantrueShow x-axis
showYAxisbooleantrueShow y-axis
showGridLinesbooleantrueShow grid lines
showLegendbooleantrueShow legend
showTooltipbooleantrueShow tooltip on hover
autoMinValuebooleanfalseAuto-calculate min value for axes
referenceLinesChartReferenceLine[]Reference lines (targets, thresholds, averages)
interactiveLegendbooleanfalseAllow clicking legend items to toggle series visibility
legendIndicator'square' | 'circle' | 'line''circle'Legend indicator shape
legendWrapbooleantrueAllow legend items to wrap
tooltipSortByValuebooleanfalseSort tooltip items by value (descending)
cardPropsCardPropsProps passed to the Card wrapper