Scatter and bubble chart reference

Scatter and bubble examples

Contents: Use cases, Chart IDs, Minimal spec, Data, Options, Annotations, Sizing, Fixtures.

XY point cloud with group colors, spiral point labels, and area-true bubbles. Type scatter. Aliases: bubble.

Use cases

Chart IDs

Minimal spec

{
  "type": "scatter",
  "data": {
    "points": [
      { "id": "a", "label": "A", "x": 10, "y": 40 },
      { "id": "b", "label": "B", "x": 20, "y": 55 },
      { "id": "c", "label": "C", "x": 30, "y": 45 }
    ]
  },
  "options": {
    "axisTitles": { "x": "Price ($)", "y": "Quality score" },
    "title": "Quality is highest for the mid-priced offer",
    "source": "Illustrative data"
  }
}

Data

A cell is a number, null or a value object; see Value cell.

PathTypeRequiredMeaning
pointsarrayyesObservations with x/y coordinates and optional bubble sizes. Rows: x,y; optional size,label,group.
points[].idstringyesUnique point identity used by labels, annotations and interaction records.
points[].groupstringGroup id controlling shared legend identity and styling.
points[].labelstringDisplayed point name. If no point has an authored label, each point defaults to its id. If any point has an authored label, including an empty string, points with omitted labels stay unnamed on the plot and in omission notes. Their ids remain in interaction and data records.
points[].xcellyesHorizontal coordinate in the x-axis units.
points[].ycellyesVertical coordinate in the y-axis units.
points[].sizenumberBubble magnitude; proportional to area by default, or diameter when sizeBy requests it.
points[].fillstringExplicit CSS fill for this point, overriding group paint.
points[].markerstringPoint symbol overriding its group marker. One of 'circle', 'square', 'triangle', 'diamond', 'none'.
points[].scenariostringAC, PY, PL, FC (or ACT, BUD, FCST, LY for last year). Codes and aliases accept any case. Scenario controlling the point paint convention.
points[].countnumberObservations behind this point. options.minCount filters on this field and refuses when it is absent.
groupsarrayNamed point groups supplying shared legend and styling information.
groups[].idstringyesGroup identity referenced by point.group.
groups[].labelstringDisplayed group name in the legend; defaults to the group id.
groups[].colorRolestringTheme color role shared by points in this group. One of good, bad, warn, neutral, neutralLight, highlight, total, others; series-N for step N of the theme ramp, 1-based (series-2 is color.series[1]); or status-<key> for a theme status color. A hex color goes in fill.
groups[].markerstringDefault marker shape for points in this group. One of 'circle', 'square', 'triangle', 'diamond', 'none'.

Options

PathTypeValuesDefaultMeaning
labelsfalse | objectfalse (or another value of its type)Point labels. Names print by default; labels.value adds each point's value. false turns both off.
labels.valuebooleantrue prints each point's value: the size on a bubble chart, y otherwise. It sits inside a bubble it fits with a contrasting ink, otherwise beside its point, and the name moves beside the bubble. Default false.
legendstring | object'top', 'bottom', 'right', 'left', 'none', 'auto' (or another value of its type)Key position. Multiple drawn groups get a key by default unless point labels name each group. 'none' hides the key; unnamed groups warn. Point names alone do not identify groups.
valueAxis.clampobjectCap one or both axes and draw the points beyond the cap at the edge as open markers, with a derived footnote counting them.
valueAxis.clamp.minnumberLower bound of the vertical axis, the short form of clamp.y.min.
valueAxis.clamp.maxnumberUpper bound of the vertical axis, the short form of clamp.y.max.
valueAxis.clamp.xobjectBounds of the horizontal measure.
valueAxis.clamp.x.minnumberLower bound; points below it are drawn at the lower edge and counted in a footnote.
valueAxis.clamp.x.maxnumberUpper bound; points above it are drawn at the upper edge and counted in a footnote.
valueAxis.clamp.yobjectBounds of the vertical measure, the long form of clamp.min and clamp.max.
valueAxis.clamp.y.minnumberLower bound; points below it are drawn at the lower edge and counted in a footnote.
valueAxis.clamp.y.maxnumberUpper bound; points above it are drawn at the upper edge and counted in a footnote.
viewDomainobjectVisible numeric domain. Source means, classifications and bubble sizing keep all observations.
viewDomain.xarrayExact horizontal viewport limits.
viewDomain.yarrayExact vertical viewport limits.
axisTitlesobjectAxis titles, e.g. { x: 'Price index', y: 'Perceived quality' }.
axisTitles.xstringTitle identifying the horizontal measure and its units.
axisTitles.ystringTitle identifying the vertical measure and its units.
axisFormatobjectPer-axis format-by-example, each falling back to format: { x: '$0', y: '0%' } prints the cost ticks as $2 and the score ticks as 60%. Tick labels, point values, hover values, zone, clamp and quadrant text and the accessible description use the format of the coordinate's axis; bubble sizes keep format.
axisFormat.xstringFormat-by-example for x values, such as '$0.0'.
axisFormat.ystringFormat-by-example for y values, such as '0%'.
minCountnumberDrop points whose points[].count is below this threshold, with a derived footnote counting them. Refused when the points carry no count.
sizeBystring'area', 'diameter''area'Map bubble magnitude to area by default, or to diameter.
maxPointLabelsinteger300Maximum number of point labels considered by the label solver; defaults to 300.
quadrantsobjectTwo-by-two classification with explicitly declared axis cut points; cannot be combined with zones.
quadrants.xnumber | objectVertical cut point (REQUIRED): a number, or { stat: 'median' | 'mean' } over the plotted x values.
quadrants.x.statstring'median', 'mean'Unweighted statistic of plotted coordinates used as the declared cut point.
quadrants.ynumber | objectHorizontal cut point (REQUIRED): a number, or { stat: 'median' | 'mean' } over the plotted y values.
quadrants.y.statstring'median', 'mean'Unweighted statistic of plotted coordinates used as the declared cut point.
quadrants.labelsobjectBox captions; each rendered caption carries its own box count.
quadrants.labels.tlstringCaption for the upper-left quadrant.
quadrants.labels.trstringCaption for the upper-right quadrant.
quadrants.labels.blstringCaption for the lower-left quadrant.
quadrants.labels.brstringCaption for the lower-right quadrant.
quadrants.tintstring'none', 'alternating'Neutral checkerboard wash only; good/bad quadrant coloring is not offered because the engine cannot know axis polarity. Use options.highlight for emphasis.
quadrants.captionPlacementstring'corner', 'centre'Place quadrant captions in their corner or center.
quadrants.axisNamesobjectShort axis names for the method note (methodNote: true). With both names and two declared cut points the note is one line: 'Cuts: share at 1 and growth at 8; a point on a cut counts right and above.' Otherwise the full cut-point sentence prints.
quadrants.axisNames.xstringShort name of the horizontal axis, e.g. 'share'.
quadrants.axisNames.ystringShort name of the vertical axis, e.g. 'growth'.
zonesobjectAuthored grid or polygon classifications; cannot be combined with quadrants.
zones.grid (zones branch 1)objectPartition strategy zones with ordered x and y cut points.
zones.grid.x (zones branch 1)arrayStrictly increasing x thresholds partitioning the plot into columns.
zones.grid.y (zones branch 1)arrayStrictly increasing y thresholds partitioning the plot into rows.
zones.grid.cells (zones branch 1)arrayNamed cells receiving authored classification labels and tones.
zones.grid.cells[].id (zones branch 1)stringUnique identity for this strategy-grid cell.
zones.grid.cells[].column (zones branch 1)integerZero-based horizontal interval index, increasing from left to right.
zones.grid.cells[].row (zones branch 1)integerZero-based vertical interval index in increasing y-value order.
zones.grid.cells[].label (zones branch 1)stringVisible caption for this strategy-grid cell.
zones.grid.cells[].tone (zones branch 1)string'neutral', 'good', 'bad', 'warn', 'info', 'none'Authored semantic fill tone for this cell; none draws no fill and keeps the caption and grid rules. Unauthored cells take the neutral wash.
zones.grid.cells[].labelAt (zones branch 1)string'plot', 'key', 'both'Where the label goes: plot (default) captions it inside the zone, key puts it in the legend row with the zone's fill as its swatch, both does both. key and both need a label and a tone other than none.
zones.grid.cells[].a11y (zones branch 1)stringAccessible description of this cell classification.
zones.grid.xLabels (zones branch 1)arrayLabels for the x intervals; provide one more label than x thresholds.
zones.grid.yLabels (zones branch 1)arrayLabels for the y intervals; provide one more label than y thresholds.
zones.regions (zones branch 2)arrayAuthored polygon regions used instead of a rectangular partition.
zones.regions[].id (zones branch 2)stringUnique identity for this polygon classification region.
zones.regions[].points (zones branch 2)arrayAt least three ordered polygon vertices in data coordinates.
zones.regions[].points[].x (zones branch 2)numberPolygon vertex x coordinate in data units.
zones.regions[].points[].y (zones branch 2)numberPolygon vertex y coordinate in data units.
zones.regions[].smooth (zones branch 2)booleanSmooth the boundary through the authored polygon vertices.
zones.regions[].label (zones branch 2)stringVisible caption for the polygon region.
zones.regions[].tone (zones branch 2)string'neutral', 'good', 'bad', 'warn', 'info', 'none'Authored semantic fill tone for this region; none draws the outline only.
zones.regions[].labelAt (zones branch 2)string'plot', 'key', 'both'Where the label goes: plot (default) captions it inside the zone, key puts it in the legend row with the zone's fill as its swatch, both does both. key and both need a label and a tone other than none.
zones.regions[].a11y (zones branch 2)stringAccessible description of this polygon classification.
trendboolean | objectLinear trend line: an ordinary least squares fit over the drawn points, dashed across the fitted x range only, under the points and clipped to the plot. Slope, intercept and r² go into the claim records (reading.derived); the key entry of each line prints its slope and r², and the plot prints no equation. A fit over fewer than 3 points or points that share one x is left out with trend-undefined. The fit is in the values on any scale, so on a log axis the line is drawn as the curve it makes there.
trend.groupsstring | array'all', 'each' (or another value of its type)Which points one fit runs over: all (default) for one line, each for one line per group in its color, or a list of group ids for those groups.
trend.labelstringAuthored text at an end of the first trend line (the right end first, clear of the points), such as 'Linear trend'. It also names the line's key entry.
frontierobjectPareto line: the engine keeps every drawn point that no other point beats on both axes (at least as good on both and better on one; exact ties both stay) and draws a dotted ink line through them in x order, under the points. Keyed in the legend row with its dotted stroke; point labels keep off it and cross it only on a halo. geometry.derived.frontier lists the point ids. A frontier of one point draws no line and warns frontier-single-point; a listed group without drawn points warns frontier-group-empty.
frontier.xstring'min', 'max'Which x is better: min for lower (a cost), max for higher.
frontier.ystring'min', 'max'Which y is better: max for higher (a score), min for lower.
frontier.labelstringKey label of the line; default 'Pareto line'.
frontier.extendbooleanRun the line a short way past its first and last point, in the direction of the end segments, clipped to the plot. Default false.
frontier.groupsstring | array'all' (or another value of its type)Points the frontier runs over: all drawn points (default) or the drawn points of the listed groups, as one line.
sizeLegendboolean | objectBubble size key: nested circles sharing one bottom tangent, each value printed at the top of its circle, inside the plot in the first corner (bottom-right, top-right, bottom-left, top-left) that no bubble touches; with none free it sits bottom-right and warns size-legend-overlaps-points. Drawn by default whenever a point carries a positive size; false turns it off. Refused when no point carries a size. A key larger than the plot is not drawn and warns size-legend-no-room. Without label an info lint size-legend-unnamed asks for the measure's name. legend: 'none' also drops this key and warns legend-off; set legend to a value that shows it, or set sizeLegend: false to drop it on purpose.
sizeLegend.valuesarraySizes the key circles show, largest drawn outermost; default round sizes from the data range: the largest in the data range and one half of it or less, none below the smallest bubble. Rings are drawn at the plot's scale and the key row grows to fit them; a ring is at most one eighth of the card height across. A size above the largest bubble is left out with size-legend-value-out-of-range, and with none left the key shows the defaults; a size below the smallest bubble is drawn at scale and named in an info.
sizeLegend.labelstringName of the size measure above the key, such as 'Revenue, €bn'.
qualitativeAxesbooleanAxes that read as directions, not scales: no tick numbers and no gridlines; each axis prints strings.axisLow ('Lower') and strings.axisHigh ('Higher') at its ends and its title in bold between two arrows, the y axis in a column left of the plot. Needs axisTitles. Positions keep their numeric scale.
methodNotebooleanDefault false. true adds the method footnotes: axes that do not start at zero, and for quadrants the cut points with their source, the tie rule, the shading, units on a cut point, empty boxes and a divider that falls outside the range. Clipped and dropped points are required for interpretation and print regardless.

Plus the shared options. This type does not accept detailFields, labelPosition, valueAxis.break, hatchStrength, rounding. This type ignores animate, debug, rowLabels, categoryAxis, categoryLabels, secondaryAxis, sort, topN, bandFraction with an option-ignored warning.

Annotations

An annotation anchor is a category or item id string, or an object with categoryId plus optional seriesId, segmentId and edge (start, end, total); pointId addresses a scatter point. Category anchors, including from/to, take category ids, not category labels.

KindPurposeRequiredAnchorsOptional fieldsNotes
diffDraws a level-difference arrow between two anchors and computes either percent change or their signed value difference.from, tofrom: AnchorRef; to: AnchorRefmode: relative | absolute | reversed | both, default relative. relative prints the percent change from 'from' to 'to', reversed the change from 'to' to 'from', absolute the value difference, both the value difference with the percent change beside it.Mode defaults to relative. Relative and reversed changes need a nonzero base; negative bases use its absolute magnitude and emit a warning. Absolute mode reports the raw value difference. A hidden label removes its arm.
deltaComputes the signed difference between an anchored value and another anchor or literal, then places a collision-managed label at the first anchor.at, vsat: AnchorRef; vs: AnchorRef | numbermode: absolute | relative | both, default absolute. absolute prints at minus vs, relative the percent change from vs to at, both the two as '+149 (+36%)'. relative and both need a nonzero vs.
absReads the anchored data value and places its formatted absolute value in a collision-managed label.atat: AnchorRef
notePlaces authored text at an anchored data element through collision avoidance, with an optional icon or status chip.at, textat: AnchorRef
calloutPlaces authored free text at an anchored data element, routing a leader when displaced and honoring the preferred side.at, textat: AnchorRefpreferSide: left | right | above | below. Side the solver tries first; the label keeps a leader when it moves. headline: string. A bold first line over the text, which then prints in plain type; ${value} in it prints the anchored value from the data. Example: "headline": "${value}", "text": "Peak in handheld-loom demand" prints 153 in bold over the words. arrow: boolean, default false. An arrow from the text to the anchored point, in the arrow standard of theme marks.arrow: the text stands far enough out for a 24 px shaft, level with the point right or left of it, or over or under it, where there is room. With no such seat it draws without the arrow and warns callout-arrow-no-room. Not with icon or status. Example: "arrow": true.
valueLineDraws a reference line at an authored value or an engine-computed mean, with optional tolerance shading and attainment fill between the line and resolved actuals.from: categoryId (optional); to: categoryId (optional)value: number | 'mean', default mean. A number draws the line there; mean has the engine compute it. valueKind: 'fraction'. Multiply a numeric value and its tolerance by 100 before layout: 0.35 draws at 35%. Independent of data.valueKind. Omit it for values already in percent points; not valid with mean. label: string | false. Name plus value; ${value} sets its position. A number already in the name is kept once. false hides it. side: left | right, default right. Side of the plot the label sits on. tolerance: number | { low, high }. A number shades that distance on both sides of the line; low and high shade an authored corridor. On column, bar and dot the key names the band with its bounds, "Target range: 95 to 105"; without a key the band prints its bounds itself.No anchor is required. Value defaults to mean. Scoped means are line-only: seriesId and paired from/to compute a primary-axis mean and limit its stroke to those bands; other types refuse scope fields for a mean. Numeric values cannot use scope fields except as a category clip with tolerance or attainment. A secondary-axis line needs an acknowledged secondary scale and an explicit numeric value. Optional tolerance shades a value-axis band; optional attainment fills between the line and resolved actuals.
textPlaces authored text at a point through the label solver: on the point, or above, below, right or left of it. The text prints as written.at, textat: AnchorRef | { categoryId, value }A point is an anchor or { categoryId, value } with value in axis units. A value outside the plot, a chart with no value scale or an anchor that does not resolve warns bad-anchor and draws nothing; the axis does not grow. The text prints as written, ${value} included. It takes id and priority, and no other field.
lineDraws a straight line between two points or from a text annotation, in the ink and rule width of a bracket; a stretch that would cross text is cut.from, tofrom: AnchorRef | { categoryId, value } | { annotationId }; to: AnchorRef | { categoryId, value } | { annotationId }dashed: boolean, default false. Draws the line in the dash of a reference line.A point is an anchor or { categoryId, value } with value in axis units. A value outside the plot, a chart with no value scale or an anchor that does not resolve warns bad-anchor and draws nothing; the axis does not grow. An end { annotationId } names a text annotation: the line starts or ends at the nearest edge of that text, at every size, and is not drawn when the text is not. A { categoryId, value } end stands on the category's center. A stretch that would cross text is cut and warns draw-crosses-text. It takes dashed and id, and no other field.
arrowDraws a straight arrow between two points or from a text annotation to a point, in the theme arrow look (marks.arrow); a stretch that would cross text is cut.from, tofrom: AnchorRef | { categoryId, value } | { annotationId }; to: AnchorRef | { categoryId, value } | { annotationId }dashed: boolean, default false. Draws the shaft in the dash of a reference line.A point is an anchor or { categoryId, value } with value in axis units. A value outside the plot, a chart with no value scale or an anchor that does not resolve warns bad-anchor and draws nothing; the axis does not grow. An end { annotationId } names a text annotation: the arrow starts or ends at the nearest edge of that text, at every size, and is not drawn when the text is not. A { categoryId, value } end stands on the category's center. A stretch that would cross text is cut and warns draw-crosses-text. It takes dashed and id, and no other field.
boxDraws an unfilled box with two points as opposite corners, wrapping whole category bands, in the ink and rule width of a bracket; text inside the box stays free.from, tofrom: AnchorRef | { categoryId, value }; to: AnchorRef | { categoryId, value }dashed: boolean, default false. Draws the edges in the dash of a reference line.A point is an anchor or { categoryId, value } with value in axis units. A value outside the plot, a chart with no value scale or an anchor that does not resolve warns bad-anchor and draws nothing; the axis does not grow. from and to are opposite corners, the box has no fill, and text inside it stays free. A { categoryId, value } corner spans that category's whole band, so the box wraps whole bars, values and markers; from and to on one category wrap that category. A stretch that would cross text is cut and warns draw-crosses-text. It takes dashed and id, and no other field.

Sizing

Floor 480 × 360 px; fit fill. Below 480 px wide or 360 px high, down to the compact floor of 280 × 240 px, the chart draws in compact mode; belowMinimum: 'refuse' refuses there instead.

Below the floor a render is refused with size-below-floor and the pixels it needs. measure returns the natural and comfortable size for a given spec; see Sizing in the manual.

Fixtures

IDKindUse case
price-quality-brandsexampleBrand scatter: price vs perceived quality, every point labeled
price-volume-trendexampleScatter with a least-squares trend line; the key prints its slope and r²
price-quality-trend-by-tierexampleOne least-squares trend line per group, each in its group color
portfolio-bubblesexampleBubble portfolio: ROC vs revenue CAGR, bubble = revenue, sector groups
dense-40-thinningtortureTorture: 40 points — labels thin via collision, none overlap
cluster-spiraltortureTorture: three tight clusters force the label spiral outward
auto-off-350tortureTorture: 350 points auto-disable all point labels
dense-paths-6000tortureTorture: 6,000 points in two groups draw as one path per group
negative-quadrantstortureTorture: all four quadrants, scenario hollow markers, marker shapes
bubble-size-edge-casestortureTorture: diameter sizing with zero, missing, and invalid sizes
zoom-preserves-bubble-sizetortureZoom retains source means and bubble sizing
scatter-clampedexampleOutliers clipped at the axis edge, thin sites dropped by count
growth-share-matrixexampleStrategy matrix: growth-share with declared cut points at 1.0x share and 8% growth
risk-impact-likelihoodexampleStrategy matrix: 12 risks split at the median of both ratings (even n)
torture-quadrant-degeneratetortureTorture: cut point off-domain collapses the 2x2 to a 1x2, one box holds everything
portfolio-nine-boxexampleNine-box portfolio: authored 3×3 cells with axis-band labels
competitive-positionexampleCompetitive-position map with smooth authored strategic contours
legend-edge-bubblesexampleBubble labels at the plot edge under the sector key row
option-mean-quadrantstorturePortfolio positions relative to the mean
option-info-gridtortureAn information zone marks the review area
option-region-tonestortureThree regions distinguish operating conditions
scatter-compact-380exampleScatter in a 380px dashboard column
scatter-below-minimum-refusetorturebelowMinimum refuse on a canvas at the minimum
scatter-clamped-both-axesexampleBoth axes bounded through clamp.x and clamp.y
scatter-clamped-floorexampleA floor and a cap on the vertical axis through clamp.min and clamp.max
portfolio-bubbles-key-valuesexampleA bubble size key showing the authored sizes 8 and 2
portfolio-nine-box-describedexampleStrategy-grid cells that carry an accessible description
competitive-position-describedexamplePolygon regions that carry an accessible description
dense-40-first-twenty-labelstortureAt most 20 of the 40 point labels considered by the solver
score-vs-cost-logexampleScore vs. cost per task on a log cost axis, with vendor groups and zones
log-both-stores-revenueexampleBoth axes on a log scale, with median quadrants
log-y-under-a-decadeexampleA log vertical axis over less than one decade, with a trend and a value line
score-vs-cost-frontierexampleScore vs cost with a Pareto line, per-axis tick units and a keyed quadrant
coverage-error-frontierexamplePareto line toward higher coverage and lower error, with a cell captioned and keyed
competitive-position-keyedexamplePolygon regions keyed in the legend row, captioned in the plot, or outlined without a wash
store-format-markerstortureFive store formats, one marker each, a label-only peer median
selected-labels-onlytortureOnly selected points carry visible names
callouts-in-notestortureCrowded callouts name their note destination
story-use-case-matrixexampleStory stepper: an intro and five focus steps over a bubble matrix