Charts - Scatter & Bubble

Point-based charts for correlations, clusters, and distributions. Scatter plots with optional bubble sizing.

#Usage

import {
    ChartAnnotation,
    ChartCanvas,
    ChartCaption,
    ChartDataLabels,
    ChartDecimation,
    ChartExportMenu,
    ChartHover,
    ChartItem,
    ChartLegend,
    ChartNavigator,
    ChartReferenceBand,
    ChartReferenceLine,
    ChartScatter,
    ChartSvg,
    ChartTitle,
    ChartTooltip,
    ChartXAxis,
    ChartYAxis,
    ChartZoom
} from '@primeui/vue-chart';
<ChartSvg>
    <ChartScatter :data="data" value-x-field="valueXField" value-y-field="valueYField" />
    <ChartXAxis />
    <ChartYAxis />
</ChartSvg>

Scatter charts reveal correlations, clusters, and distributions across two numeric dimensions. Both axes are continuous by default. Add sizeField to encode a third dimension as bubble radius.

#Basic

Set valueXField and valueYField to map numeric data fields. Add ChartXAxis and ChartYAxis to render axes with labels and gridlines.

Loading Demo...

#Bubble

Set sizeField to a numeric data field to encode a third dimension as bubble radius. Each point's radius scales between minSize and maxSize based on its value. Sizing is area-based, so the perceived bubble size grows in line with the underlying number.

Loading Demo...

#Colors

Pass a static color, array (cycles by index), field name, or function to color to control point fill. Use a static value for a uniform series color or a callback for per-point coloring based on data.

Loading Demo...

#Gradient Color

Pass a gradient object to color to apply a gradient fill to every point. Radial gradients are centered at each point and sized to the point radius, which gives bubbles a sense of depth. Linear gradients span the full chart area, the same as bars and lines.

Loading Demo...

#Markers

Set markerShape to differentiate series visually. The built-in shapes are circle, square, triangle, cross, and star. Use markerSize to control the radius and pointRotation to orient the shape. In bubble mode markerSize is ignored and the radius comes from the size field instead.

Loading Demo...

#Custom Markers

Set renderMarker to replace built-in shapes with custom content. In SVG mode return a VNode centered at the origin; the chart handles translation to each point's position. In Canvas mode the context is pre-translated to the point, so draw at origin and return null.

Loading Demo...

#Border

Set pointBorderColor and pointBorderStrokeWidth to add an outline stroke around each marker. A white border helps separate overlapping points and makes multi-series charts easier to read at a glance.

Loading Demo...

#Declarative

Define data points inline using ChartItem children instead of a data array. Each ChartItem accepts value-x and value-y for coordinates, plus color for per-point color overrides.

Loading Demo...

#Title & Caption

Add ChartTitle to display a title above the chart and ChartCaption for a descriptive line beneath it. Adding both reduces the available chart area.

Loading Demo...

For full configuration see Title & Caption.

#Hover

ChartHover brightens the hovered point while the rest stay at normal opacity. Set brightness to control the lightening factor, and set dimOpacity below 1 when you intentionally want non-hovered points to fade. Use hoverPointRadius on ChartScatter to control how much the marker enlarges; the default is markerSize × 1.3.

Loading Demo...

For full configuration see Hover.

#Tooltip

Add ChartTooltip to show data details on hover. Unlike line charts, scatter tooltip hit-testing uses 2D Euclidean distance. The nearest point within pointHitRadius pixels is highlighted regardless of axis position.

Loading Demo...

For full configuration see Tooltip.

#Legend

Add ChartLegend to display an interactive legend. Each ChartScatter series appears as a separate entry; click any item to toggle that series.

Loading Demo...

For full configuration see Legend.

#Axes

Use label on ChartXAxis and ChartYAxis to add axis titles. Set startFromZero to anchor the axis at zero, tickCount to control tick density, and type="logarithmic" for data spanning multiple orders of magnitude.

Loading Demo...

For full configuration see Axes.

#Data Labels

Add ChartDataLabels to display sparse point labels or values. Set display to value, percentage, both, label, label-percentage, or none.

Loading Demo...

For full configuration see Data Labels.

#Zoom & Navigator

Add ChartZoom with mode="xy" to zoom both axes at once. Drag a rectangle to select a region. Add ChartNavigator for a mini overview below the chart. This is handy for dense scatter plots where zooming reveals clusters.

Loading Demo...

For full configuration see Zoom & Pan and Navigator.

#Annotation

Use ChartAnnotation to render custom content overlaid on the chart area. The render callback receives chartArea, center, xScale, yScale, textColor, isDark, and ctx (Canvas mode only). Use xScale and yScale to position annotations at specific data coordinates. Use this for quadrant labels and callouts on extreme points. On multi-axis charts use getScale('y2') to position against a secondary axis by its ID. In SVG mode return a VNode. In Canvas mode draw to ctx and return null.

Loading Demo...

For full configuration see Annotation.

#Reference Lines & Bands

Add ChartReferenceLine to draw threshold or divider lines. Set both x and y reference lines to divide the chart into quadrants. Setting both creates quadrant divisions for scatter plots. Add ChartReferenceBand to highlight acceptable value ranges.

Loading Demo...

For full configuration see Reference Lines & Bands.

#Decimation

Add ChartDecimation to downsample large scatter datasets before rendering. Set algorithm to 'lttb' (shape-preserving), 'min-max' (peak-preserving), or 'k-means' (cluster-based, optimized for scatter). Set samples to control the target output point count.

For full configuration see Decimation.

#Animation

Pass the chart-root animation prop (<ChartSvg> / <ChartCanvas>) to control entrance and update transitions. Points fade in on entrance and animate to new positions on data updates.

For full configuration see Animation.

#Export

Add ChartExportMenu to let users download the chart as PNG, SVG, or PDF.

See Export for format options and programmatic export.

#Responsive

See Responsive for container sizing, aspect ratio, and breakpoint configuration.

#Accessibility

See Accessibility for ARIA labels, keyboard navigation, and screen reader support.

#API

#ChartScatter

Visual styling props with type accessor → R accept a static value, a per-item array, a field name (keyof T), or a callback (ctx: ItemContext<T>) => R | undefined. Color-family arrays cycle modulo length; other accessor arrays clip and fall back to the series default.

PropTypeDefaultDescription
dataT[]-Data array. Mutually exclusive with ChartItem children
valueXFieldaccessor → number'x'X-axis numeric field
valueYFieldaccessor → number'y'Y-axis numeric field
sizeFieldaccessor → number-Bubble radius field. When set, activates bubble mode, radius scales between minSize and maxSize
boostboolean | 'auto''auto'High-performance point rendering. 'auto' activates it when more than 50,000 points are visible; true / false force it on or off
coloraccessor → FillValuedefault palettePoint fill color. Accepts hex, RGB, gradient objects, or per-item callback. Color-family arrays cycle by index
opacityaccessor → number1Marker fill opacity in [0, 1]. Per-point via array/callback/field-name. Multiplies into hover and dim effects
namestring-Series name, used in legend and tooltip
keyFieldstring-Field name for stable item identity across data updates
idstringautoUnique dataset identifier
ordernumberautoRendering z-order. 0 = bottom
markerSizeaccessor → number6Marker radius in pixels (scatter mode). Ignored in bubble mode, radius is driven by sizeField. Per-point array/callback supported
markerShapeaccessor → string'circle'Built-in enum ('circle' | 'square' | 'triangle' | 'cross' | 'star') or any custom SVG path d string. Per-item via array, keyof T, or callback (ctx) => string where ctx is ItemContext<T> & { size: number }
pointRotationaccessor → number0Marker rotation in degrees (0 = upright). Per-point via array/callback
minSizenumber4Minimum bubble radius in bubble mode (px)
maxSizenumber40Maximum bubble radius in bubble mode (px)
pointBorderColoraccessor → FillValue-Marker border stroke color
pointBorderStrokeWidthaccessor → number1Marker border stroke width (px)
pointBorderDashaccessor → number[]-Marker border dash pattern [dash, gap, ...]. Also accepts named shortcuts ('solid', 'dashed', 'dotted')
pointBorderDashOffsetaccessor → number0Phase offset of the marker border dash pattern
pointBorderJoinStyle'round' | 'bevel' | 'miter''miter'Marker border path join style
pointHitRadiusnumber10Invisible hover detection radius. Hit-testing uses 2D distance, nearest point within this radius is selected
hoverPointRadiusnumbermarkerSize × 1.3Marker radius when hovered (px)
pointHoverBackgroundColorFillValue-Marker fill color on hover
pointHoverBorderColorFillValue-Marker border color on hover
pointHoverBorderStrokeWidthnumber-Marker border width on hover (px)
connectNullsboolean | 'gap' | 'connect' | 'zero''gap'Null value handling. 'gap'/false = skip the point (default). 'zero' = plot null x or y values at 0, keeping the point visible at the axis. 'connect' behaves the same as 'gap' for scatter, there is no line to bridge
renderMarker(context: PointRenderContext) => unknown-Custom marker renderer. SVG: return a VNode centered at origin. Canvas: draw to ctx and return null
xAxisIdstring-Bind to a specific X-axis by ID
yAxisIdstring-Bind to a specific Y-axis by ID

#PointRenderContext

Passed to the renderMarker callback for each data point.

FieldTypeDescription
xnumberPixel X coordinate of the point
ynumberPixel Y coordinate of the point
indexnumberData index
valuenumber | nullY-axis value
categorystringCategory label, populated when using a category axis. Empty string for pure numeric X/Y scatter plots
dataTOriginal data item from the data array
colorstringResolved point color
sizenumberCurrent marker radius in pixels, larger when hovered
isHoveredbooleanWhether this point is currently hovered
opacitynumberComputed opacity from hover dim effects (0–1). Apply to the custom marker to respect dimOpacity
ctxCanvasRenderingContext2D | undefinedCanvas context, present only in Canvas mode
drawImagefunction | undefinedDraw an image from a URL at a position relative to origin. Handles loading and caching automatically. Canvas mode only
animatefunction | undefinedRegister a continuous animation on a numeric property, drives the canvas RAF loop while active. Canvas mode only

#ItemContext

Passed to every accessor → R callback. Return undefined to fall back to the series-level default for that item.

FieldTypeDescription
datumTOriginal data row
valuenumber | nullResolved numeric value (when applicable)
indexnumberPosition within the dataset
seriesIndexnumberOrder of this series within the chart
seriesIdstringDataset id
categorystring?Resolved category label, when applicable
sizenumber?Current marker pixel size, populated for marker accessors

#ChartItem

Use ChartItem as children of ChartScatter instead of a data array for inline point definitions.

PropTypeDescription
value-xnumberX-axis coordinate
value-ynumberY-axis coordinate
category-xstringX-axis category
category-ystringY-axis category
sizenumberBubble radius value, activates bubble mode for this item
colorstringOverride color for this point