ScatterMatrix
Creates a scatter plot matrix from an array of data: a square grid of
small multiples with a scatter plot for every pair of dimensions, and
each dimension’s histogram on the diagonal. Each row of data is a point in
every panel. Every panel in a row shares its y axis, and every panel in a
column its x axis, labeled and titled along the grid’s left and bottom
edges.
Basic example
Section titled “Basic example”Fisher’s iris measurements: four dimensions, so a 4 × 4 grid. The panel in row i and column j plots dimension j across and dimension i up, so each pair appears twice, once on each side of the diagonal, mirrored. groupBy colors the flowers by species, stacks each histogram by species, and adds a legend; click a species in the legend to hide it, and the histograms recount without it.
Hover a point to highlight that flower in every panel, with its four measurements in the tooltip. Hover a histogram bar to highlight the flowers in that bin everywhere, which shows where one range of one measurement falls on all the others.
Defines the mapping between data and shape. The value can be a String matching a key in each data point (default is "id"), or an accessor Function that returns a unique value for each data point. Additionally, an Array of these values may be provided if the visualization supports nested hierarchies.
Dimension titles
Section titled “Dimension titles”Each entry in dimensions is a data key, an accessor function, or a {value, title} object whose title names the axes. Without dimensions, every numeric key in the data is compared (except the groupBy keys and id). Without groupBy, every mark takes one color and there’s no legend; label names each point in its tooltip.
// Motor Trend road tests of 32 cars, 1973–74 models: miles per gallon,
// horsepower, weight (1,000 lb), and quarter-mile time (s).
const cars = [
["Mazda RX4", 21, 110, 2.62, 16.46],
["Mazda RX4 Wag", 21, 110, 2.875, 17.02],
["Datsun 710", 22.8, 93, 2.32, 18.61],
["Hornet 4 Drive", 21.4, 110, 3.215, 19.44],
["Hornet Sportabout", 18.7, 175, 3.44, 17.02],
["Valiant", 18.1, 105, 3.46, 20.22],
["Duster 360", 14.3, 245, 3.57, 15.84],
["Merc 240D", 24.4, 62, 3.19, 20],
["Merc 230", 22.8, 95, 3.15, 22.9],
["Merc 280", 19.2, 123, 3.44, 18.3],
["Merc 280C", 17.8, 123, 3.44, 18.9],
["Merc 450SE", 16.4, 180, 4.07, 17.4],
["Merc 450SL", 17.3, 180, 3.73, 17.6],
["Merc 450SLC", 15.2, 180, 3.78, 18],
["Cadillac Fleetwood", 10.4, 205, 5.25, 17.98],
["Lincoln Continental", 10.4, 215, 5.424, 17.82],
["Chrysler Imperial", 14.7, 230, 5.345, 17.42],
["Fiat 128", 32.4, 66, 2.2, 19.47],
["Honda Civic", 30.4, 52, 1.615, 18.52],
["Toyota Corolla", 33.9, 65, 1.835, 19.9],
["Toyota Corona", 21.5, 97, 2.465, 20.01],
["Dodge Challenger", 15.5, 150, 3.52, 16.87],
["AMC Javelin", 15.2, 150, 3.435, 17.3],
["Camaro Z28", 13.3, 245, 3.84, 15.41],
["Pontiac Firebird", 19.2, 175, 3.845, 17.05],
["Fiat X1-9", 27.3, 66, 1.935, 18.9],
["Porsche 914-2", 26, 91, 2.14, 16.7],
["Lotus Europa", 30.4, 113, 1.513, 16.9],
["Ford Pantera L", 15.8, 264, 3.17, 14.5],
["Ferrari Dino", 19.7, 175, 2.77, 15.5],
["Maserati Bora", 15, 335, 3.57, 14.6],
["Volvo 142E", 21.4, 109, 2.78, 18.6],
].map(([model, mpg, hp, wt, qsec]) => ({model, mpg, hp, wt, qsec}));
const config = {
data: cars,
dimensions: [
{value: "mpg", title: "Miles per gallon"},
{value: "hp", title: "Horsepower"},
{value: "wt", title: "Weight (1,000 lb)"},
{value: "qsec", title: "Quarter mile (s)"},
],
label: "model",
};
Bins and points
Section titled “Bins and points”binThresholds sets the histograms’ bins: a bin count, or the edges between bins. The tallest bar in each histogram fills most of its panel, and the bars are read against each other rather than an axis. shapeConfig.Circle styles the points (3 pixels in radius by default).
// Motor Trend road tests of 32 cars, 1973–74 models: miles per gallon,
// horsepower, weight (1,000 lb), and quarter-mile time (s).
const cars = [
["Mazda RX4", 21, 110, 2.62, 16.46],
["Mazda RX4 Wag", 21, 110, 2.875, 17.02],
["Datsun 710", 22.8, 93, 2.32, 18.61],
["Hornet 4 Drive", 21.4, 110, 3.215, 19.44],
["Hornet Sportabout", 18.7, 175, 3.44, 17.02],
["Valiant", 18.1, 105, 3.46, 20.22],
["Duster 360", 14.3, 245, 3.57, 15.84],
["Merc 240D", 24.4, 62, 3.19, 20],
["Merc 230", 22.8, 95, 3.15, 22.9],
["Merc 280", 19.2, 123, 3.44, 18.3],
["Merc 280C", 17.8, 123, 3.44, 18.9],
["Merc 450SE", 16.4, 180, 4.07, 17.4],
["Merc 450SL", 17.3, 180, 3.73, 17.6],
["Merc 450SLC", 15.2, 180, 3.78, 18],
["Cadillac Fleetwood", 10.4, 205, 5.25, 17.98],
["Lincoln Continental", 10.4, 215, 5.424, 17.82],
["Chrysler Imperial", 14.7, 230, 5.345, 17.42],
["Fiat 128", 32.4, 66, 2.2, 19.47],
["Honda Civic", 30.4, 52, 1.615, 18.52],
["Toyota Corolla", 33.9, 65, 1.835, 19.9],
["Toyota Corona", 21.5, 97, 2.465, 20.01],
["Dodge Challenger", 15.5, 150, 3.52, 16.87],
["AMC Javelin", 15.2, 150, 3.435, 17.3],
["Camaro Z28", 13.3, 245, 3.84, 15.41],
["Pontiac Firebird", 19.2, 175, 3.845, 17.05],
["Fiat X1-9", 27.3, 66, 1.935, 18.9],
["Porsche 914-2", 26, 91, 2.14, 16.7],
["Lotus Europa", 30.4, 113, 1.513, 16.9],
["Ford Pantera L", 15.8, 264, 3.17, 14.5],
["Ferrari Dino", 19.7, 175, 2.77, 15.5],
["Maserati Bora", 15, 335, 3.57, 14.6],
["Volvo 142E", 21.4, 109, 2.78, 18.6],
].map(([model, mpg, hp, wt, qsec]) => ({model, mpg, hp, wt, qsec}));
const config = {
data: cars,
dimensions: ["mpg", "hp", "wt"],
label: "model",
binThresholds: 12,
shapeConfig: {Circle: {r: 4}},
};
Panels
Section titled “Panels”Each dimension’s axes span every row of data, before the timeline’s period, filter, or a legend click narrows what’s drawn, so the axes hold still as the timeline plays and groups are hidden; the histograms bin on fixed edges too, counting only the rows drawn.
A ScatterMatrix is a set of small multiples, one panel per pair of dimensions, so it always has as many rows and columns as dimensions. facetConfig.padding sets the space between panels (10 pixels by default).
Configuration
import {ScatterMatrix} from "@d3plus/core";
activefalse|functionThe active callback function for highlighting shapes.
aggsobjectCustom aggregation functions keyed by data property.
annotationsunknownDefaultunknownCustom shapes drawn as annotations on the plot: a Shape config object, or an array of them, each with a
shapekey naming the Shape class to use ("Rect","Line", …) and an optionallayer,"back"(the default) or"front". Three more kinds draw chart notes:"Callout"(wrapped text joined to a data point by a connector; seeCalloutAnnotation), and"ReferenceLine"and"ReferenceBand"(whatreferenceLinesandreferenceBandsexpand into).appenddatapoint|array.<datapoint>Adds rows to the chart's data and redraws it: lines extend, the axes slide to take in the new rows, and every mark already drawn tweens to its new place rather than redrawing. Appends that land before the next animation frame share one redraw.
options.windowdrops the oldest rows: a number keeps the latest that many rows, and a time span ("5 minutes","90s","300000ms","1.5 hours"; units frommstoweeks) keeps the rows within that span of the latest time, read fromtime, or else from the discrete axis (a LinePlot'sx).Unlike setting
data, appending keeps the series a viewer hid or soloed in the legend and the period they picked on the timeline. Rows are added to the data the chart holds, after anydataFormat; a later poll (seedataPollingInterval) replaces them.ariaHiddenbooleanDefaulttrueHides the SVG from assistive technology when true (
aria-hidden).aspectRationumberPlot: draws one unit of y
aspectRatiotimes as long as one unit of x, so1makes a unit square square (a 45 degree line rises at 45 degrees). The plot area shrinks along one side, centered, to hold it; the axes keep their domains. A log axis measures in powers of ten (one decade is one unit), and a time axis in milliseconds. Each small multiple holds it in its own panel, and a zoom keeps it (both axes zoom together). Ignored, with a warning, when either axis is a category, pow, or sqrt axis, or a log axis spanning zero. Unset (the default), the plot fills its area.attributionstring|booleanDefaultfalseSets text to be shown positioned absolute on top of the visualization in the bottom-right corner. This is most often used in Geomaps to display the copyright of map tiles. The text is rendered as HTML, so any valid HTML string will render as expected (eg. anchor links work).
attributionIconstring|functionOverrides the "ⓘ" icon a long attribution collapses to (see
attribution), which otherwise renders as an inline SVG. Accepts an HTML string — used as the toggle button's content — or a mount function,(el: HTMLElement) => void | (() => void), called once with the button's reserved icon slot so a live component (a React tree viacreateRoot(el).render(...), or anything else imperative) can be mounted into it. A returned cleanup function runs right before that slot is discarded, which happens whenever the credit's markup regenerates (its text or theme changes), not just once per chart.attributionStylerecordCSS key/value pairs used to style the attribution text.
axisHoverboolean|"x"|"y"DefaultfalseWhether hovering a Plot's mark draws a dashed guide to each axis with a badge showing its value there.
"x"or"y"limits it to that direction. Defaults totrue("x"on BumpChart and Streamgraph).ScatterMatrix draws no axis hover badges: a point's tooltip lists its value on every dimension.
axisHoverConfigobjectStyles the
axisHoverguides and badges.guideConfigtakesstroke(the hovered mark's color by default),strokeWidth(default1),strokeDasharray(default"4 3"), andstrokeOpacity.badgeConfigtakesfill(the hovered mark's color by default),fontColor(a color contrasting the fill by default),fontFamily,fontSize(default12),fontWeight(default400),paddingaround the text (default4), andrxcorner radius (default2). Each is a value or a(d, i) => valueaccessor of the hovered data row.axisPersistbooleanDefaultunknownDetermines whether the x and y axes should have their scales persist while users filter the data, the timeline being the prime example (set this to
trueto make the axes stay consistent when the timeline changes).backControlClassNamestringAn additional CSS class name (or space-separated list of class names) applied to the back button, alongside its fixed
back-controlclass. Setting this automatically disables d3plus's built-in inlinebackControlStyledefault (as long as you haven't already customized it yourself), so a host page's own button styling — Tailwind, Bootstrap, a design system — applies through the cascade with no other configuration needed.backControlStylerecord|falseAn object containing CSS key/value pairs that is used to style the back button. Passing
falsewill remove all default styling. Automatically skipped (as iffalse) once.backControlClassName(...)is set, unless you've explicitly customized this yourself.backgroundConfigrecordDefault{duration: 0, fill: transparent}A d3plus-shape configuration Object used for styling the background rectangle of the inner x/y plot (behind all of the shapes and gridlines).
barPaddingnumberDefault0Padding between bars in pixels.
baselinenumberStarts the value axis at a value, like
yDomain([n])(orxDomain([n])for horizontal charts); the far end comes from the data. Bars, areas, and stems still grow from0, so withbaselineBreakon the axis breaks back to a0tick. A bound inyDomain/xDomainwins. Returns the chart's own baseline when none is set.baselineBreakbooleanWhen a linear value axis's domain stops short of the
baseline(e.g.[1100, 2100]with a baseline of0), keeps the baseline tick and breaks the axis between it and the domain, styled bybaselineBreakConfig. Turned off, a Plot'syDomainstretches to the baseline instead. Defaults totruefor Plots whose marks grow from0(BarChart, AreaPlot, Histogram, Lollipop), elsefalse.binThresholdsnumber|number[]The diagonal histograms' bin edges: a bin count, or an array of interior edges. Defaults to Sturges' rule.
bufferboolean|recordDefaultassign({}, defaultBuffers, {Bar: false, Line: false})Determines whether or not to add additional padding at the ends of x or y scales. The most commone use for this is in Scatter Plots, so that the shapes do not appear directly on the axis itself. The value provided can either be
trueorfalseto toggle the behavior for all shape types, or a keyed Object for each shape type (ie.{Bar: false, Circle: true, Line: false}).cachebooleanDefaulttrueWhether the chart uses the data cache that every chart on the page shares for the files fetched by
data,links,nodes,topojson, andfitObject, so charts loading the same URL share one request and loading it again, or changing a formatter, needs none. The cache uses up to about 50 MB of memory, dropping the least recently used files first. Defaults totrue;falsefetches on every load.clearDataCache()from@d3plus/dataempties the cache.classNamestring|array.<string>|undefinedCSS classes added to the outermost element this chart or component draws into, next to its fixed d3plus classes, so page CSS can target it: a chart's root
<svg class="d3plus-viz">(its<canvas>with the Canvas renderer) and a standalone component's<svg>. Takes a space-separated string or an array. A new value replaces the classes the previous one added; unset adds none. Tooltips take their owntooltipConfig.className.colorstring|false|functionDefines the main color to be used for each data point in a visualization. Can be either an accessor function or a string key to reference in each data point. If a color value is returned, it will be used as is. If a string is returned, a unique color will be assigned based on the string.
When the color is a category that isn't one of the
groupBylevels (for example, points grouped by"country"and colored by"region"), the legend shows one entry per category, labelled by the category. Clicking, shift+clicking, or hovering an entry hides, solos, or highlights every item in that category.colorDefaultscolordefaultsconfigOverrides the default colors used when assigning fills from data and choosing legible text colors:
darkandlight(the text colors picked for contrast against a background),missing(null/undefined values),on/off(true/falsevalues),sequential(the anchor hue for magnitude ramps), andscale(the categorical palette, given as a d3 ordinal scale or an array of colors). Keys are merged into the current defaults, and a Viz passes its overrides down to the shapes and components it draws.colorOrdinalbooleanDefaultfalseTreat a discrete color field as ordered: color it with a single-hue light→dark ramp instead of nominal categorical hues.
colorScalestring|[colorscalefield, colorscalefield]|false|functionDefines the value to be used for a color scale. Can be either an accessor function or a string key to reference in each data point. Two of them (
["a", "b"]) make a bivariate scale: each variable is split into quantile bins, the pair of bins picks a color from a grid, and the key is that grid turned into a diamond (seecolorScaleConfig.bivariateBuckets,bivariateColors, andbivariateLabels). A row missing either value gets no colorScale color.colorScaleConfigobjectA pass-through to the config method of ColorScale.
colorScaleMaxSizenumberDefault600The maximum pixel size for drawing the color scale: width for horizontal scales and height for vertical scales.
colorScalePaddingboolean|functionTells the colorScale whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the colorScale appears centered above the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.
colorScalePositionfalse|panelposition|functionDefines which side of the visualization to anchor the color scale. Acceptable values are
"auto"(the default),"top","bottom","left","right", andfalse."auto"lets the chart choose: inside the chart when it fits there (seelegendInset), otherwise the right side of charts more than 1.5 times as wide as they are tall and the bottom of all others. Any other side keeps the color scale there. Afalsevalue will cause the color scale to not be displayed, but will still color shapes based on the scale.confidenceunknownThe confidence interval as
[lower, upper]bounds (keys or accessors): lines draw a shaded band, bars and points an error bar. Either bound may befalsefor a one-sided interval, and the value axis widens to fit. Pass an array of bands, outermost first ([lower, upper, label]or{lower, upper, label}), to draw nested bands (a fan). Pass{x: [lower, upper], y: [lower, upper]}to bound each axis: the value axis's bounds (y, or x whendiscreteis"y") draw as above, and the other axis's draw on points, as a cross where a point has both. Labels beside points keep clear of error bars, and a bar with an error bar anchors its label at its base (or, outside the bar, past the whisker).falseturns it off.confidenceConfigrecordDefaultfunction{fill: (d, i) => { const { Line, stroke } = this.schema.shapeConfig; const s = Line && Line.stroke !== undefined ? Line.stroke : stroke; return typeof s === "function" ? s(d, i) : s; }, fillOpacity: 0.5}Styles the confidence intervals: a line's band takes Area keys (filled with the line's color), and a bar's error bar takes Path keys (
stroke,strokeWidth, …) pluscapWidth, in pixels or a percentage of the bar (default"50%"). Keys underAreaorBarapply to that shape only.bandOpacityramps nested bands' opacity (default[0.15, 0.6]), andtooltip: falseleaves the bounds out of tooltips.configd3plusconfigMethods that correspond to the key/value pairs and returns this class.
connectGapsconnectgapsDefaulttrueHow a line crosses a missing value (a skipped step, or a
null/NaNvalue):true(the default) or"solid"draws straight through,falsebreaks the line, and"dashed"breaks it and bridges the gap with a short dash. An object styles the bridge:stroke,strokeDasharray(default"2 4"),strokeWidth, andopacity.crosshairConfigrecordDefaultfunction{stroke: () => themed(this._theme, (t) => t.textMuted, colorGray.500), strokeDasharray: 4 3, strokeWidth: 1}Paint for the shared tooltip's crosshair guide line (
stroke,strokeWidth,strokeDasharray,strokeOpacity, …). Merged into the current config.datastring|array.<datapoint>|objectThe primary data array used to draw the visualization. The value passed should be an Array of objects or a String representing a filepath or URL to be loaded. The following filetypes are supported:
csv,tsv,txt, andjson.If your data URL needs specific headers to be set, an Object with a "url" and "headers" (or any other
fetchrequest option) may also be passed. An Object with any other key is a data row, not a request.To transform the data before it is drawn (for example, a JSON API that returns its headers split from its values), set
dataFormat. Passing a formatter as a second argument to this method setsdataFormat; calling it with only data keeps the currentdataFormat.To re-fetch a URL on an interval and redraw when its data changes, set
dataPollingInterval; each poll runsdataFormat.Defaults to an empty array (
[]).dataCutoffnumberDefault2000Maximum number of data points to render before downsampling.
Above this many observations, hovering stops dimming the other marks and redraws skip their transitions. Raised from the usual 100, since following one observation across the panels is what hovering is for.
dataFormatfunctionTransforms
databefore it is drawn: receives the loaded file (or the Array passed asdata) and returns the rows to draw, or a config object holding them asdata(its other keys are applied to the chart). Also set bydata(url, format).dataPollingIntervalnumber|falseDefaultfalseWhen
datacomes from a URL, re-fetches it every this many milliseconds and redraws when it changes, keeping hover, zoom, and legend state. Polling pauses while the tab (or, withdetectVisible, the chart) is hidden, and a failed request keeps the last data. Onlydatais polled. Defaults tofalse(load once).depthnumberActive depth level for nested groupings.
detectResizebooleanDefaulttrueIf the width and/or height of a Viz is not user-defined, it is determined by the size of it's parent element. When this method is set to
true, the Viz will listen for thewindow.onresizeevent and adjust it's dimensions accordingly.detectResizeDelaynumberDefault400When resizing the browser window, this is the millisecond delay to trigger the resize event.
detectVisiblebooleanDefaulttrueToggles whether or not the Viz should try to detect if it visible in the current viewport. When this method is set to
true, the Viz will only be rendered when it has entered the viewport either through scrolling or if it's display or visibility is changed.detectVisibleIntervalnumberDefault1000The interval, in milliseconds, for checking if the visualization is visible on the page. When
detectVisibledefers a render until the visualization scrolls into view, this is also how long it must stay in view before it renders, so visualizations scrolled past quickly are never drawn.detectVisibleUnloadbooleanDefaulttrueWith
detectVisibleon, releases the chart's DOM and scene while it is scrolled out of view and redraws it when it returns, keeping pages with many charts light. Data and config are kept; zoom and selection are not, so setfalseto keep them. Defaults totrue.dimensionsArray<string|function|{value: string|function, title?: string}>The data keys to compare, in order: a key, an accessor, or a
{value, title}object for each. Defaults to every numeric key in the data except thegroupBykeys andid.discreteCutoffnumberDefaultunknownWhen the width or height of the chart is less than or equal to this pixel value, the discrete axis will not be shown. This helps produce slick sparklines. Set this value to
0to disable the behavior entirely.downsampleboolean|numberDefaulttrueThins dense lines and areas to draw: when a series has more than about 2 points per pixel of plot along its axis, it draws a subset chosen by Largest-Triangle-Three-Buckets, which keeps its peaks and dips. A number sets how many points each series draws instead, and
falsedraws every point. Only the drawn path is thinned: hover, tooltips, and the nearest-point lookup still read every row. A zoomed plot thins the part it shows, so zooming in brings back detail. Stacked areas, and a line's confidence bands, keep the same points along the axis so their edges still meet.durationnumberDefault600Default duration of transitions, in milliseconds.
facetstring|false|functionSplits the chart into small multiples: a grid of equally sized panels, one per distinct value of this data key or accessor, each drawing the chart for that value's rows. The panels share one legend, color scale, title, and timeline, color each series the same way, and hover, tooltips, and legend clicks apply across all of them. Pass
falseto draw a single chart. SeefacetConfigfor the grid's layout and shared scales.facetConfigfacetconfigConfiguration for small multiples (see
facet), merged into the current config: -columns/rows: the grid's shape. Chosen by default to make the panels as large as the chart's shape allows. -padding: the space between panels, in pixels (default20). -sort: panel order —"ascending"(default),"descending","data"(first appearance), a comparator over facet values, or an Array of values. -scales:"shared"(default) gives every panel of a chart with axes the same x/y domains;"independent"fits each panel to its own rows. Funnel defaults to"independent"(each panel sized to its own widest stage);"shared"sizes every panel against the widest stage across all panels. PolarArea, RadialBar, RadialLine and RadialArea default to"independent"(each panel's rings and ticks fit its own values);"shared"gives every panel the same value domain. -axes: with shared scales,"outer"(default) labels the axes only along the grid's left and bottom edges;"all"labels every panel. An object sets each axis on its own, as in{x: "all", y: "outer"}: every panel labels its x axis, only the left column labels its y axis, and the panels' plot areas line up. BumpChart defaults to"all", and Marimekko labels its categories on every panel and its 0–100% share axis only along the outer edge, even with independent scales. -title: a(value, data) => stringfunction for each panel's title, orfalseto hide panel titles. -titleConfig: TextBox config for the panel titles (fontSize,fontWeight,fontColor,textAnchor,padding, …). -layout: places each panel on a map-shaped grid:"us-states","eu-countries","world-regions", or{[value]: [row, column]}. Empty cells stay empty, values the grid lacks are left out with a warning, and a named grid titles panels with short codes, showing the full name on hover and heading its marks' tooltips with it.fillBetweenboolean|[string|number, string|number]|array.<[string|number, string|number]>DefaultfalseFills the area between two series' lines, in the color of whichever series is higher, switching color where the lines cross:
truefills between the first two series,[a, b]between the series with idsaandb, and a list of[a, b]pairs fills between each pair. The fill follows the lines' curve and leaves pointer events to the lines. Defaults tofalse.fillBetweenConfigrecordArea styles for
fillBetween(default{fillOpacity: 0.25}). Style accessors receive a data row of whichever series is higher, withaboveandbelowkeys naming the higher and lower series, so afillaccessor can color the A > B and B > A regions apart. Like a confidence band, the fill takestexture,textureDefault,backgroundImage, andbackgroundImageFitfromshapeConfig(orshapeConfig.Area), so a texture accessor that picks a series textures the regions where that series is higher; set them here to style the fill alone, or tofalseto keep it plain.filterfalse|functionPredicate filtering which data points are included, or false to disable.
fontFamilystring|array.<string>The font family used throughout the visualization.
forecastboolean|number|string|date|functionMarks a forecast: a shaded backdrop, a rule, and a "Forecast" label over the forecast stretch, with lines dashed there (see
forecastConfig). A function flags the forecast rows;"auto"(ortrue) flags rows whoseconfidencebounds spread from their line; a discrete-axis value starts the forecast there;falsemarks nothing. Unset (the default), only a trend line projection is marked. Defaults to"auto"on a FanChart.forecastConfigrecordStyles the
forecastmarker: the backdrop'sfillandfillOpacity(default0.05), the rule'sstroke,strokeWidth,strokeOpacity, andstrokeDasharray, thelabeltext (default "Forecast";falsehides it) and its font keys,lineDasharrayfor each line's forecast stretch (default"6 4";falsekeeps lines solid), and an optionaltextureorbackgroundImagefor the backdrop.fill: falseorstroke: falsehides the backdrop or rule.groupBystring|function|array.<string|function>Defines the mapping between data and shape. The value can be a String matching a key in each data point (default is "id"), or an accessor Function that returns a unique value for each data point. Additionally, an Array of these values may be provided if the visualization supports nested hierarchies.
groupPaddingnumberDefaultunknownThe pixel space between groups of bars.
heightnumberOverall height of the visualization in pixels.
Defines the color used for legend shapes when the corresponding grouping is hidden from display (by clicking on the legend).
Defines the opacity used for legend labels when the corresponding grouping is hidden from display (by clicking on the legend).
highlightfalse|functionPersistently emphasizes the data points matching the given predicate: the matching marks keep their color while every other mark is de-emphasized to a neutral gray (the "emphasis" form — highlight one series, gray the rest). Unlike
hover/active(transient, opacity-based),highlightis a standing state that survives pointer movement. Passfalseto clear it.hoverfalse|functionThe hover callback function for highlighting shapes on mouseover.
hoverDistancenumberDefault20How close (px) the pointer must come to a point mark (scatter and bubble points, Network nodes, Geomap points, Radar dots) to hover it, so small points are easy to reach. Defaults to
20;0turns it off.jitterboolean|numberDefaultfalseSpreads a Plot's point marks (Circle and Rect) across their category's band, so points sharing a category don't hide each other:
truespreads them over 0.6 of the band, a number over that share of it (0–1), andfalse(the default;truefor StripPlot) keeps each on its category's center. The band runs across thediscreteaxis; without one, nothing moves. Each point's offset is seeded from its id, so a redraw, resize, or filter never moves it. Aswarmtakes precedence. In BoxWhisker, it spreads theboxPointsacross each box's width instead (defaulttrue).Lets keyboard users move between the chart's marks: the chart is one Tab stop, the arrow keys move to the nearest mark in that direction, Home and End jump to the ends, Enter or Space click the focused mark, and Escape clears it. Defaults to
true;falseremoves the Tab stop.Styles the focus ring around the mark keyboard navigation has focused (see
KeyboardNavConfig).labelstring|false|accessorfn|array.<string>Accessor function, or a constant string applied to every data point's label (unlike
value/nodeId/etc., a string here is not treated as a per-datum object key — pass a function for that).labelConnectorConfigrecordDefault{strokeDasharray: 1 1}The d3plus-shape config used on the Line shapes created to connect lineLabels to the end of their associated Line path.
labelPosition"auto"|"along"|"inside"|"outside"|functionWhere each shape's label goes:
"auto","along","inside", or"outside", or a(d, i) => stringaccessor."auto"picks whichever fits best per shape, and a label with no room is left out.- Rings (Pie, Donut, Sunburst, Chord, RadialBar) and polar charts (Radar, PolarArea, RadialMatrix):
"along"curves the name along its arc."inside"keeps it straight; on a Pie or Donut,"outside"moves it beside the ring with a leader line. - Bars: inside or outside the bar."auto"goes outside when the bar is short. Stacked bars always label inside. - Circles (Plot points, Network nodes, Geomap points): inside the circle, or beside it when it doesn't fit ("outside"always beside)."auto"also moves it beside when a circle drawn over its own covers it, and keeps it inside when no side has room. - Stacked areas:"auto"and"along"run each name along its band;"inside"puts it in the band's largest box.When every stacked area or RadialBar track is named along its shape, the default legend hides. Defaults to
"auto".labelSlidebooleanDefaulttrueCircles (Plot points, Network nodes, Geomap points): whether a label that fits neither inside its circle nor centered on a side of it slides along a side before it hides, clear of the other circles and labels (and, on a Network, crossing as few links as it can). It may also move a neighbor's label aside to make room.
falsekeeps each label centered on a side, or hides it. Defaults totrue.legendboolean|functionDefaultfunctionWhether to display the legend. By default it shows when it has more than one entry and each entry stands for a single group, or when entries are colored by a category that isn't a
groupBylevel. It hides when the chart's own labels already name every entry (seelabelPosition), or when every Circle, Rect, and Bar of a Plot shows its whole label as its legend entry would, and stays while a series is hidden or soloed.falsehides it,truealways shows it, and a(config, data) => booleanfunction decides.legendConfigobjectConfiguration object passed to the legend's config method.
legendFilterInvertboolean|functionDefines the click functionality of categorical legend squares. When set to false, clicking will hide that category and shift+clicking will solo that category. When set to true, clicking will solo that category and shift+clicking will hide that category. The Back button undoes each click (see
legendHistory).legendHistorybooleanDefaulttrueWhether legend clicks go on the chart's Back history, so Back undoes them along with drill-downs, in order. Defaults to
true;falseleaves them off, so Back only steps out of drill-downs.legendInsetboolean|functionDefaulttrueWhether the chart may draw a legend, size legend, or colorScale inside empty space around its marks (over a translucent box, see
legendInsetConfig) instead of in a margin. Only a legend whose position is"auto"can move inside. Defaults totrue; also accepts a function of the resolved config.legendInsetConfigobjectStyle of the box drawn behind a legend placed inside the chart (see
legendInset):fill(defaults to the chart's background color),fillOpacity(0.85),stroke(defaults to a faint contrasting line),strokeWidth(1),rx(corner radius, 4),margin(space between the box's edge and the legend, 6), andpadding(space kept between the box and the chart's marks and edges, 10).legendPaddingboolean|functionTells the legend whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the legend appears centered underneath the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.
legendPositionfalse|panelposition|functionDefines which side of the visualization to anchor the legend. Expected values are
"auto"(the default),"top","bottom","left","right", andfalseto hide it."auto"lets the chart choose: inside the chart when it fits there (seelegendInset), otherwise the right side of charts more than 1.5 times as wide as they are tall and the bottom of all others. Any other side keeps the legend there.legendSortfunctionComparator that orders the legend's entries. By default the legend reads in the order the chart draws: Treemap, Pack, Pie, Donut, Icicle, and Sunburst list their largest entries first; a stacked chart lists its series in stacking order, from the baseline outward (so the default
stackOrder,"descending", lists the largest first); Waffle and Waterfall follow their own order, and Network and ArcDiagram clusters come largest first; every other chart is alphabetical by label. A threshold group always comes last, whatever the sort.legendTooltiptooltipconfigConfiguration object for the legend tooltip.
lineLabelConfiglinelabelconfigOptions for
lineLabels.value: trueadds the line's value at each labeled end after the series name (e.g. "Brazil 37%"), formatted as the y axis formats its ticks (itstickFormatwhen set).valueFormatformats it instead, as a function of the value, the row it belongs to, and the row's index. For along labels,minRadiussets how tightly a label may bend toward its text, in ems (default4), andmaxSlopehow steeply its stretch may climb or fall, in degrees (default45;90for no limit); seeLineLabelConfig. Defaults to{value: false}.lineLabelslinelabelssettingLabels each line with its series name:
trueor"end"past its right end,"start"past its left end,"both"at both ends, or"along"written along the line itself, following its curve on a stretch no steeper than 45° (seelineLabelConfig.maxSlope; a line with none goes unlabeled). A function of each row picks per series (orfalse). End labels that would overlap are moved apart, andlineLabelConfigcan add each end's value. When every line is named along it, the default legend hides. Defaults to"along"on LinePlot, no labels elsewhere.lineMarkerConfigrecordDefaultfunction{fill: (d, i) => colorAssign(this._id(d, i), linkedColorDefaults(this)), r: 3}Shape config for the Circle shapes drawn by the lineMarkers method.
lineMarkersbooleanDefaultunknownDraws circle markers on each vertex of a Line.
linklinkoptionLinks this chart to every other chart with the same group name, so hovering,
active,highlight(including search), and legend hide/solo clicks in one are mirrored in the rest, and a value gets the same categorical color in every chart. Rows match across charts by the value ofby(a data key or accessor), which defaults to the chart's own id. A string is shorthand for{group}; sethover,active,highlight,legend, orcolortofalseto stop sharing that behavior.loadingHTMLstring|functionThe inner HTML of the status message displayed when loading AJAX requests and displaying errors. Must be a valid HTML string or a function that, when passed this Viz instance, returns a valid HTML string.
loadingMessagebooleanDefaulttrueToggles the visibility of the status message that is displayed when loading AJAX requests and displaying errors.
localestring|objectThe locale used for all text and number formatting. Supports the locales defined in d3plus-format. The locale can be a complex Object, a locale code (like "en-US"), or a 2-digit language code (like "en"). If a 2-digit code is provided, the "findLocale" function is used to identify the most approximate locale.
marginalConfigmarginalconfigOptions for
marginals:size, each strip's thickness in pixels, or as a share (up to1) of the chart area's shorter side (default0.15, kept between 16 and 120 pixels);padding, the gap between a strip and the plot (default8);binThresholds, a histogram strip's bins, as a count, interior edges, or a d3-array threshold generator (default Sturges' rule); and how the marks paint:shapeConfig-style keys (fill,fillOpacity,stroke,strokeWidth,strokeOpacity,strokeDasharray,opacity) at the top level style every mark, and underhistogram,box(with itsmedian,whiskerandoutlierparts) ordensity, one kind. Each takes a value or an accessor(d, i)of the mark (itsseries,rows, andbinorbox) and its series' index.marginalsboolean|"histogram"|"box"|"density"|objectDefaultfalseDraws the distribution of a Plot's points along its axes: the x values in a strip above the plot and the y values in a strip to its right, each lined up with its axis.
"histogram"stacks the points in bins,"box"draws a box plot, and"density"a kernel density curve;truemeans"histogram".{x, y}picks each strip (falseor leaving one out draws none). Only for a Plot with two continuous axes and nodiscreteaxis (Scatter, BubbleChart, ConnectedScatter); on a log or time axis the strip bins and smooths along the axis as drawn. The strips split the points by legend entry in their colors, and draw only the points the chart shows. Hovering a point lights the bins and boxes holding it, and hovering a strip's mark lights its points. Off by default.messageMaskstring|booleanDefaultrgba(0, 0, 0, 0.05)The color of the mask displayed underneath the status message when loading AJAX requests and displaying errors. Set to
falseto turn off the mask completely.messageStylerecordDefines the CSS style properties for the status message that is displayed when loading AJAX requests and displaying errors.
minimapbooleanDefaulttrueShows a small overview + draggable-viewport minimap in the chart's top-right corner (beneath the zoom controls, when they show) once the chart is zoomed in. On by default whenever
zoomis enabled.minimapClassNamestringAn additional CSS class name (or space-separated list of class names) applied to the minimap's outer box, viewport box, and zoom-level label, alongside their fixed
d3plus-minimap/d3plus-minimap-viewport/d3plus-minimap-labelclasses. Setting this automatically disables d3plus's built-in inlineminimapStyle/minimapViewportStyle/minimapViewportStyleActive/minimapLabelStyledefaults (as long as you haven't already customized them yourself), so a host page's own styling applies through the cascade with no other configuration needed.minimapLabelStylerecord|falseAn object containing CSS key/value pairs that is used to style the minimap's zoom-level text label (e.g. "2x"). Passing
falsewill remove all default styling. Automatically skipped (as iffalse) once.minimapClassName(...)is set, unless you've explicitly customized this yourself.minimapStylerecord|falseAn object containing CSS key/value pairs that is used to style the minimap's outer box (the full-scene overview). Passing
falsewill remove all default styling. Automatically skipped (as iffalse) once.minimapClassName(...)is set, unless you've explicitly customized this yourself.minimapViewportStylerecord|falseAn object containing CSS key/value pairs that is used to style the minimap's draggable viewport box in its resting state. Passing
falsewill remove all default styling. Automatically skipped (as iffalse) once.minimapClassName(...)is set, unless you've explicitly customized this yourself.minimapViewportStyleActiverecord|falseAn object containing CSS key/value pairs that is used to style the minimap's draggable viewport box while it's being dragged. Passing
falsewill remove all default styling. Automatically skipped (as iffalse) once.minimapClassName(...)is set, unless you've explicitly customized this yourself.noDataHTMLstring|functionThe inner HTML of the status message displayed when no data is supplied to the visualization. Must be a valid HTML string or a function that, when passed this Viz instance, returns a valid HTML string.
noDataMessagebooleanDefaulttrueToggles the visibility of the status message that is displayed when no data is supplied to the visualization.
onstringEvent listener for the specified event typenames. Mirrors the core d3-selection behavior.
orderstring|functionPlot charts: accessor function or string key for the field that orders each series' path, such as a year. Each series' points are joined by a line in that order (a Line follows it instead of the discrete axis), so the line can double back to trace the path two measures took together. Rows that share a series and an order value are aggregated. Arrowheads show the direction (
pathArrows) and the first and last points are labeled (pathLabels). ConnectedScatter joins points in the data's order until it is set. Not used by stacked charts.outlier"circle"|"rect"|boolean|accessorfn|object|functionDefaultfalsePlot charts: rings each outlier and labels it with its name and value (see
outlierConfig), and notes it in its tooltip and aria label. A mark is an outlier when its value-axis value lies past the fences of the values it's compared with.trueuses Tukey's rule: more than 1.5 interquartile ranges past the first or third quartile, the rule BoxWhisker's whiskers follow. An object picks themethod:"iqr"(Tukey's rule,kinterquartile ranges, default1.5),"zscore"(kstandard deviations from the mean, default3), or"mad"(a modified z-score, 0.6745 × the distance from the median over the median absolute deviation, of at leastk, default3.5).groupsets what each mark is compared with:"series"(its line or series, or every point when each series is one point),"discrete"(the other marks in its category),"all", or"auto"(the default: a line or area along its series, other marks within their category). A group needs three values or more. A function flags each row itself. BoxWhisker's boxes draw their own outliers and are left out. Off by default.Box shapes: the shape each outlier draws as (see
BoxConfig).outlierConfigoutlierconfig|recordStyles the
outliermarks: the ring'sstroke(default the chart's text color),strokeWidth(default2),strokeOpacity, andstrokeDasharray;gap, the space between a mark and its ring (default2);r, the ring's radius around a line or area's point (default6);label,falseto draw none or a function returning each outlier's text (default its name and value);labelConfig, the label's TextBox config (itsfontSizedefaults topointLabelConfig's); andtooltip: falseto leave "Outlier" out of tooltips and aria labels. Style keys also take an accessor of the row.Box shapes: the config of each outlier's shape (see
BoxConfig).parentunknownParent config used by the wrapper.
pathArrowsbooleanDefaulttrueWith
order: draws an arrowhead on each segment of a series' path, pointing along it, wherever the segment has room for one (defaulttrue).pathLabelsboolean|functionDefaulttrueWith
order: labels each series' first and last points.true(the default) shows their order values (such as the years),falsenone, and a function(d, i) => stringany text. Each label sits beside its point on the most open side that keeps it in the plot and clear of the points, arrowheads, and other labels, and hides when no side is.pointLabelConfigpointlabelconfigFits and styles circle labels (see
labelPosition):fontMinis the smallest font size a label may shrink to inside its circle before"auto"moves it beside the circle (default10, the size of the chart's smallest text, its total);fontSizeis the size of a label beside its circle (default11);paddingis the space between the circle's edge and that label (default3). The other TextBox keys (fontColor,fontFamily,fontWeight,fontOpacity, …) style the labels beside their circles, which default to the chart's text color. Merged into the current config.reducedMotion"auto"|booleanDefaultautoWhether the chart animates.
"auto"(default) follows the viewer's OS setting, read from the(prefers-reduced-motion: reduce)media query at each draw (server-side rendering counts as not reduced).truealways draws without motion: shapes, axes, legends, zooms, and fades jump straight to their final state.falsealways animates.durationkeeps the value you set either way.referenceBandsarray.<referencebandconfig>Default[]Plot: shaded spans between two values, such as a recession or a target range. Give each entry
x(vertical) ory(horizontal) as[start, end]in data units,x2/y2for the secondary axes, orref: "plot"for fractions of the plot. Optional: alabel(top-left;labelPosition: "end"for top-right) with font keys andmaxWidth,fill/fillOpacity(default the text color at0.08),stroke,strokeWidth,strokeOpacity, andlayer: "front"to draw over the data. A band widens a continuous axis's domain to fit.referenceLinesarray.<referencelineconfig>Default[]Plot: lines across the plot at one value, such as a target or a launch date. Give each entry
x(vertical) ory(horizontal) in data units,x2/y2for the secondary axes, orref: "plot"for a fraction of the plot. Optional: alabelat the line's"end"or"start"(labelPosition) with font keys andmaxWidth,stroke/strokeOpacity(default the text color at0.6),strokeWidth(1),dash(trueor a dash pattern), andlayer: "front"to draw over the data. A line widens a continuous axis's domain to fit.renderfunctionDraws the visualization given the specified configuration. An error thrown while the chart draws (by an accessor in its config, say) is logged with
console.error, and the chart keeps what it last painted.rendererboolean|"svg"|"canvas"Selects which @d3plus/render backend paints the visible output.
"svg"= SvgRenderer (default),"canvas"= CanvasRenderer. Boolean arguments both normalize to"svg".saveControlbooleanDefaulttrueShows a top-left download button that saves the chart, as the reader sees it, as a PNG, SVG, or JPG file. On by default for every chart.
saveControlClassNamestringAn additional CSS class name (or space-separated list of class names) applied to the download button, alongside the fixed
save-control/save-toggleclasses. Setting this automatically disables d3plus's built-in inlinesaveControlStyle/saveControlStyleActive/saveControlStyleHoverdefaults (as long as you haven't already customized them yourself), so a host page's own button styling applies through the cascade with no other configuration needed.saveControlConfigsavecontrolconfigOptions for the download button: the saved file's
filename, theformatsit offers, thebackgroundpainted behind the chart, acallback, and html-to-image options for PNG and JPG files.saveControlMenuClassNamestringAn additional CSS class name (or space-separated list of class names) applied to the download menu, alongside its fixed
d3plus-save-menuclass (each item has the fixedsave-menu-itemclass). Setting this automatically disables d3plus's built-in inlinesaveControlMenuStyle/saveControlMenuItemStyle/saveControlMenuItemStyleHoverdefaults (as long as you haven't already customized them yourself), so a host page's own menu styling applies through the cascade. The menu's position and open/closed display stay inline.saveControlMenuItemStylerecord|falseAn object containing CSS key/value pairs that is used to style each item in the download menu. Passing
falsewill remove all default styling. Automatically skipped (as iffalse) once.saveControlMenuClassName(...)is set, unless you've explicitly customized this yourself.saveControlMenuItemStyleHoverrecord|falseAn object containing CSS key/value pairs that is used to style the download menu item under the pointer or keyboard focus. Passing
falsewill remove all default styling. Automatically skipped (as iffalse) once.saveControlMenuClassName(...)is set, unless you've explicitly customized this yourself.saveControlMenuStylerecord|falseAn object containing CSS key/value pairs that is used to style the download menu: its background, border, shadow, and spacing. Passing
falsewill remove all default styling. Automatically skipped (as iffalse) once.saveControlMenuClassName(...)is set, unless you've explicitly customized this yourself.saveControlStylerecord|falseAn object containing CSS key/value pairs that is used to style the download button. Passing
falsewill remove all default styling. Automatically skipped (as iffalse) once.saveControlClassName(...)is set, unless you've explicitly customized this yourself.saveControlStyleActiverecord|falseAn object containing CSS key/value pairs that is used to style the download button while its menu is open. Passing
falsewill remove all default styling. Automatically skipped (as iffalse) once.saveControlClassName(...)is set, unless you've explicitly customized this yourself.saveControlStyleHoverrecord|falseDefaultfalseAn object containing CSS key/value pairs that is used to style the download button on hover. Passing
falsewill remove all default styling. Automatically skipped (as iffalse) once.saveControlClassName(...)is set, unless you've explicitly customized this yourself.scrollContainerstring|htmlelement|windowIf using scroll or visibility detection, this method allow a custom override of the element to which the scroll detection function gets attached.
searchbooleanDefaulttrueShows a top-left search button that expands into an input; typing highlights shapes whose label matches. On by default for every chart.
searchAccessorfunctionResolves the string the search box matches its typed term against, for a given datum. Defaults to the mark's resolved on-screen label (
viz._drawLabel) — the same text the user reads on the chart. Override it to match against something else instead, e.g. a data field that isn't shown as the label.This is checked alongside, not instead of, every level of the datum's own groupBy hierarchy — searching a leaf's label also matches its ancestor group's cell/legend entry, and vice versa, regardless of this accessor's override.
searchControlClassNamestringAn additional CSS class name (or space-separated list of class names) applied to the search toggle button and input, alongside their fixed
search-controlclasses. Setting this automatically disables d3plus's built-in inlinesearchControlStyle/searchControlStyleActive/searchControlStyleHoverdefaults (as long as you haven't already customized them yourself), so a host page's own button styling — Tailwind, Bootstrap, a design system — applies through the cascade with no other configuration needed.searchControlStylerecord|falseAn object containing CSS key/value pairs that is used to style the search toggle button. Passing
falsewill remove all default styling. Automatically skipped (as iffalse) once.searchControlClassName(...)is set, unless you've explicitly customized this yourself.searchControlStyleActiverecord|falseAn object containing CSS key/value pairs that is used to style the search toggle button while open. Passing
falsewill remove all default styling. Automatically skipped (as iffalse) once.searchControlClassName(...)is set, unless you've explicitly customized this yourself.searchControlStyleHoverrecord|falseDefaultfalseAn object containing CSS key/value pairs that is used to style the search toggle button on hover. Passing
falsewill remove all default styling. Automatically skipped (as iffalse) once.searchControlClassName(...)is set, unless you've explicitly customized this yourself.selectstring|htmlelementThe SVG container element as a d3 selector or DOM element. Defaults to
undefined.selectMode"box"|"lasso"|falseDefaultfalseThe box and lasso selection tool a chart starts with:
"box"or"lasso", orfalse(the default) to start out panning. Whatever it starts with, the zoom controls' Box Select and Lasso Select buttons switch between the tools, or back to panning when the one on is pressed again (the brush-zoom button turns selection off too), and changingselectModelater resets the tool.While a tool is on, a drag over the chart draws a box (or a freehand lasso) instead of panning, and releasing it selects the marks inside, which stay lit while the rest dim (as
activeOpacitydims them), the legend included. A bar or other rectangle is inside when any part of it is, every other mark (a point, a point of a line or area) when its center is, and a line or area stays lit while any of its points is selected. Shift + drag adds to the selection, a click on a mark selects it (Shift + click toggles it, and the chart's own click action, such as drilling down, waits until no select tool is on), and Escape or a click on no mark clears it. With small multiples, a drag selects within the panel it starts in. A wheel or pinch still zooms. Each selection fires the chart'sselectevent with the selected rows (viz.on("select", rows => …)), andselectionreads or sets the selection from code.selectStylerecordSVG attributes for the box or lasso a selection drag draws, such as
fill,fill-opacity,stroke, andstroke-dasharray.selectionselectionvalueThe rows a box or lasso selection holds (see
selectMode), read off the chart as last drawn. Set it from code with an Array of rows (the same objects, or rows with the same values), a predicate over rows, orfalseto clear it: the selected marks stay lit while the rest dim, with or without a select tool on. A selection set here fires noselectevent, and it holds across redraws and data changes for as long as its rows (or the predicate's) are still drawn.shapeConfigd3plusconfigDefault{Circle: {label: false, r: 3}}Configuration object with key/value pairs applied as method calls on each shape. On a Plot, a shape's
width,height,r,x,y, oridreads a string as the data field to read from each row, and any other value as a constant, as the shape's own setters do.ScatterMatrix's points are 3 pixels in radius, so a panel's points stay apart, and carry no labels (the tooltip names them).
shapeSortfunctionA sort comparator that receives each shape class (e.g. "Circle", "Line") as its arguments. Shapes are drawn in groups by type, so this defines the layering order for all shapes of a given type.
sizefalse|plotaccessorargSets the size of bubbles to the given Number, data key, or function.
sizeLegendboolean|functionWhether to display the size legend: a nested-circle key, in the chart's bottom-right corner, for charts that size their marks with a
sizeaccessor (bubble plots, Geomap points viapointSizeand Dorling or Demers cartograms viacartogramSize, Network, Rings). By default it shows whenever marks are sized by more than one value, unless it would take up more than a third of the chart's width or height. Passtrueto always show it,falseto hide it, or a function that receives the resolved chart config, the radius scale, and the legend's measured{width, height, availableWidth, availableHeight}, and returns a boolean.sizeLegendConfigsizelegendconfigConfiguration object passed to the size legend's config method:
values(an array of values to draw, or how many to pick),tickFormat,title(defaults to thesizekey whensizeis set to a string),shapeConfig,lineConfig,labelConfig,titleConfig,padding,lineLength, andlabelPadding.sizeLegendPosition"right"|"bottom"DefaultrightWhich margin the size legend claims in the chart's bottom-right corner.
"right"(the default) widens the right margin, so the chart keeps its full height and the legend sits at the bottom of the right column, below any right-side legend or colorScale."bottom"deepens the bottom margin instead, so the chart keeps its full width and any bottom legend or colorScale narrows to sit beside it.sizeMaxnumberDefault20sizeMinnumberDefault5sizeScalestringDefaultsqrtsizeZerobooleanDefaultfalseAnchors a Plot's size scale at zero, so a mark's size is proportional to its value: with the default
sizeScaleof"sqrt", each circle's area is (a value twice as large draws a circle with twice the area), and with"linear", its radius. The largest value still draws atsizeMax, whilesizeMinno longer sets the smallest mark's radius, so values near zero draw as small as they are. Off by default, except on BubbleChart. Ignored when any size is negative orsizeScaleis"log".stackOffsetstring|stackoffsetfnDefaultstackOffsetDivergingSets the vertical offset applied to stacked series. Accepts a named offset —
"diverging"(default),"none","expand","silhouette", or"wiggle"— or a custom offset function. Unknown names warn and fall back to"diverging". If value is not specified, returns the current stack offset function.stackOrderstackorderinputDefaultstackOrderTotalDescendingSets the order of stacked series, from the bottom of the stack upward. Accepts: - a named order:
"descending"(default) /"ascending"by summed value,"key"/"keyReverse"alphabetically by series key,"none"/"data"for input order, or d3's"insideOut","appearance","reverse"; - an Array of series keys for an explicit order; - a value accessor, or a{value, order}config, to rank series by an aggregate of any data field.Unknown named strings warn and fall back to
"descending". The default legend lists the series in the order they stack, from the baseline outward. If value is not specified, returns the current stack order.stackedbooleanWhether to stack series.
subtitlestring|functionAccessor function or string for the visualization's subtitle.
subtitleConfigrecordConfiguration object for the subtitle.
subtitlePaddingboolean|functionTells the subtitle whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the subtitle appears centered above the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.
svgDescstringAccessible description applied to the root SVG (
<desc>).svgTitlestringAccessible title applied to the root SVG (
<title>).swarmboolean|"auto"|"x"|"y"DefaultautoPacks a Plot's circles into a beeswarm: each keeps its value along one axis and is placed beside its neighbors along the other, so none overlap.
"x"or"y"names the value axis;truepicks x when its values are numeric, else y;falsedraws a plain scatter. A category axis gets one swarm per category. The default,"auto", swarms only when every mark is a Circle and rows lack the other axis's value. Bars, areas, and boxes beside the circles keep their places, standing across the swarm's value axis.swarmConfigobjectOptions for
swarm:padding, the minimum pixel gap between circles (default1), andoverflow, what happens when a swarm is wider than its band —"shrink"(default) scales every circle down until each swarm fits,"clamp"keeps the sizes and holds outlying circles at the band's edge, and"visible"lets swarms spill past their band.tableViewbooleanDefaulttrueEnables the top-left table-view toggle button, which swaps the chart for a static, scrollable
<table>of its data. On by default for every chart.tableViewClassNamestringAn additional CSS class name (or space-separated list of class names) applied to the
<table>element the table-view toggle renders, alongside the fixedd3plus-table-view-tableclass. Lets a host page style the data table with its own table styling (Tailwind, Bootstrap, a design system) via descendant selectors.tableViewControlClassNamestringAn additional CSS class name (or space-separated list of class names) applied to the table-view toggle button, alongside the fixed
table-view-control/table-view-toggleclasses. Setting this automatically disables d3plus's built-in inlinetableViewControlStyle/tableViewControlStyleActive/tableViewControlStyleHoverdefaults (as long as you haven't already customized them yourself), so a host page's own button styling applies through the cascade with no other configuration needed.tableViewControlStylerecord|falseAn object containing CSS key/value pairs that is used to style the table-view toggle button. Passing
falsewill remove all default styling. Automatically skipped (as iffalse) once.tableViewControlClassName(...)is set, unless you've explicitly customized this yourself.tableViewControlStyleActiverecord|falseAn object containing CSS key/value pairs that is used to style the table-view toggle button while it is active (showing the data table). Passing
falsewill remove all default styling. Automatically skipped (as iffalse) once.tableViewControlClassName(...)is set, unless you've explicitly customized this yourself.tableViewControlStyleHoverrecord|falseDefaultfalseAn object containing CSS key/value pairs that is used to style the table-view toggle button on hover. Passing
falsewill remove all default styling. Automatically skipped (as iffalse) once.tableViewControlClassName(...)is set, unless you've explicitly customized this yourself.tableViewDownloadbooleanDefaulttrueWhether the data table shows a "download CSV" button, exporting its full (sorted, unpaginated) rows. On by default.
tableViewPageSizenumber|falseDefault50The number of data-table rows shown per page while in table view. Set to
false(or any non-positive number) to disable pagination and show every row on one page.tableViewSortbooleanDefaulttrueWhether the data table's column headers are clickable to sort (toggling asc/desc). On by default.
themethemesettingDefaultautoThe chart's colors.
"auto"(the default) paints no background and follows the page, light or dark."light"and"dark"paint the theme's background and take every chrome color from it. An object overrides tokens on top of itsbasepreset, e.g.{base: "dark", background: "#123", accent: "#ffd43b"}. Colors set elsewhere in the config win over the theme.thresholdnumber|functionThe threshold value for bucketing small data points together, as a share of the total. On a stacked Plot, the series whose summed value across every position is under that share of the whole chart's total merge into one series, stacked on top. A bucket needs at least two items, and its tooltips list them. Off (
0) by default on Plot charts.thresholdKeystring|functionAccessor for the value used in the threshold algorithm. A stacked Plot defaults to its stacked value.
thresholdNamestring|functionLabel for the threshold group, or a
(datum, index)accessor.timestring|false|functionAccessor function or string key for the time dimension of each data point.
timeFilterfalse|functionPredicate filtering which time slices are shown, or false to disable. With
timeset and notimeFilter, a chart starts on its latest period, or ontimelineDefault/timelineConfig.selection; setting it starts the chart (and its timeline) on the periods it keeps. A viewer's pick on the timeline replaces it.timelinebooleanDefaulttrueWhether to show the timeline component.
timelineConfigtimelineconfigConfiguration object for the timeline.
timelineDefaultstring|date|array.<string|date>The starting time or range for the timeline, which the chart starts on too. Can be a single Date/String, or an Array of 2 values representing the min and max. A viewer's pick on the timeline replaces it.
timelinePaddingboolean|functionTells the timeline whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the timeline appears centered underneath the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.
titlestring|functionAccessor function or string for the visualization's title.
titleConfigrecordCSS style configuration for the title.
titlePaddingboolean|functionTells the title whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the title appears centered above the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.
tooltipboolean|functionWhether to show tooltips, or a
(datum, index, {depth, maxDepth, legend})accessor deciding per mark and legend entry.depthis thegroupBylevel (from 0) the hovered item stands for andmaxDepththe deepest level, sodepth === maxDepthkeeps tooltips to the deepest level;legendis true for a legend entry. Defaults totrue.tooltipConfigtooltipconfigConfiguration for the tooltip component.
Whether hovering a Plot's plot area shows one tooltip listing every series' value at the nearest discrete-axis position, with a crosshair through it. Applies when a discrete axis is set and at least two series share that position.
totalstring|boolean|functionAccessor function or string key for the total value displayed in the visualization.
totalConfigrecordConfiguration object for the total bar.
totalFormatfunctionFormatter function for the value in the total bar.
totalPaddingboolean|functionTells the total whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the total appears centered above the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.
translatefunctionDefines how informational text strings should be displayed. By default, this function will try to find the string in question (which is the first argument provided to this function) inside of an internally managed translation Object. A string with numbered placeholders (
"{0} hidden") has them filled from the arguments after the locale, so each language can order its words naturally. If you'd like to override to use custom text, simply pass this method your own custom formatting function.trendLinetrendlinetypeDraws an automatic trend line fit to the plotted data:
true(or"linear") for a least-squares line, one of"exponential","logarithmic","power", or"polynomial", or"movingAverage"for a rolling mean through the data with bands either side. By default each series gets its own line in its color; seetrendLineConfigfor grouping, a confidence band, and styling. On a chart with a discrete axis, the line runs along that axis, fitting categories by their order. Set tofalse(the default) to remove.trendLineConfigrecordOptions for the trend lines drawn by
trendLine, merged into the current config: -group:"series"(default) fits one line per series, colored to match it;"all"fits a single line to every point. -order: the polynomial degree whentrendLineis"polynomial"(default2). -window: how many points a moving average spans (default7; the firstwindow − 1points have no average), or on a time axis a span of time such as{days: 30}(seconds,minutes,hours,days,weeks,months,years), which averages the points in the span ending at each point, so gaps and uneven spacing average over the same length of time. A span starts at the first point, averaging the points it holds so far; on any other axis it falls back to 7 points, with a console warning. -center: centers a moving average's window on each point instead of ending it there (defaultfalse). -bands: a moving average's bands (Bollinger bands), as how many standard deviations of each window they sit from the average (default2);falsedrops them.confidenceConfigstyles them. -confidence: draws a confidence band around a linear fit (defaultfalse). -confidenceLevel: the band's confidence level (default0.95). -confidenceConfig: Area shape config for the band (default{fillOpacity: 0.15}; fill defaults to the line color). -projection: extends each regression line (not a moving average) past the end of its data, by a number of steps at the data's own spacing (e.g.5more years), or to an end value with{to: 2030}(default0, off). The axis widens to fit, and a linear fit's band becomes a prediction interval that fans out over the projection. Hovering a projected step lists each series' projected value. Ignored on a category axis. -projectionConfig: Line shape config for the projected stretch, over the line's own styles (default{strokeDasharray: "2 4"}). -tooltip: shows the fitted equation and R² when hovering a line (defaulttrue). - Any other key (stroke,strokeWidth,strokeDasharray, …) styles the Line shape.Stacked charts always fit one line to the stack totals.
widthnumberOverall width of the visualization in pixels.
x2ConfigrecordDefault{}A pass-through to the underlying Axis config used for the secondary x-axis. Includes additional functionality where passing "auto" as the value for the scale method will determine if the scale should be "linear" or "log" based on the provided data.
x2Domainarray.<number|date>The x2 domain as an array. If either value is undefined, it is calculated from the data.
x2SortfunctionDefines a custom sorting comparator function for discrete x2 axes.
xBreak[number, number]|array.<[number, number]>Value range(s) to remove from the x axis —
[start, end]or a list of them — drawn as a break in the axis with a gap cut across the shapes that cross it (see the axisbreakandbreakConfig).xConfigrecordDefaultfunction{gridConfig: {stroke: (d) => { if (vizDiscrete(this)?.charAt(0) === "x" || this._swarm?.cross === "x") return "transparent"; const range = this._xAxis.range(); const position = this._xAxis._getPosition.bind(this._xAxis)(d.id); if (range[0] === position) return "transparent"; return chartGridline(this); }}}A pass-through to the underlying Axis config used for the x-axis. Includes additional functionality where passing "auto" as the value for the scale method will determine if the scale should be "linear" or "log" based on the provided data.
xCutoffnumberDefault150xDomainarray.<string|number|date|array.<string|number|date>>The x domain:
[min, max]on a continuous axis, or the categories to show, in order, on a discrete one (unlessxConfig.scaledraws it continuous, like"linear"). Setting one end ([min]or[undefined, max]) pins only that end; the data fills the other. AnxConfig.domainoverrides this. On a multi-level axis (an Arrayx), each category can be the list of its level values, outermost first:[[2023, "Q1"], [2023, "Q2"]].xSortfunctionCustom sort function for x-axis values.
y2ConfigrecordDefault{}A pass-through to the underlying Axis config used for the secondary y-axis. Includes additional functionality where passing "auto" as the value for the scale method will determine if the scale should be "linear" or "log" based on the provided data.
y2Domainarray.<number|date>The y2 domain as an array. If either value is undefined, it is calculated from the data.
y2SortfunctionDefines a custom sorting comparator function for discrete y2 axes.
yBreak[number, number]|array.<[number, number]>Value range(s) to remove from the y axis —
[start, end]or a list of them, e.g.[100, 900]to fit one outlier bar — drawn as a break in the axis with a gap cut across the shapes that cross it (see the axisbreakandbreakConfig).yConfigrecordDefaultfunction{gridConfig: {stroke: (d) => { if (vizDiscrete(this)?.charAt(0) === "y" || this._swarm?.cross === "y") return "transparent"; const range = this._yAxis.range(); const position = this._yAxis._getPosition.bind(this._yAxis)(d.id); if (range[range.length - 1] === position) return "transparent"; return chartGridline(this); }}}A pass-through to the underlying Axis config used for the y-axis. Includes additional functionality where passing "auto" as the value for the scale method will determine if the scale should be "linear" or "log" based on the provided data.
Note: If a "domain" array is passed to the y-axis config, it will be reversed.
yCutoffnumberDefault150yDomainarray.<string|number|date|array.<string|number|date>>The y domain:
[min, max]on a continuous axis, or the categories to show, in order, on a discrete one (unlessyConfig.scaledraws it continuous, like"linear"). Setting one end ([min]or[undefined, max]) pins only that end; the data fills the other. AyConfig.domainoverrides this. On a multi-level axis (an Arrayy), each category can be the list of its level values, outermost first:[[2023, "Q1"], [2023, "Q2"]].ySortfunctionCustom sort function for y-axis values.
zoombooleanDefaulttrueEnables pan and zoom: the mouse wheel or a pinch (see
zoomScroll), a drag (seezoomDrag), a double-click (seezoomDoubleClick), the zoom-control buttons (seezoomControls), and thezoomIn,zoomOut,zoomReset, andzoomBrushmethods. On by default for every chart;falseturns all of them off.zoomBrushbooleanTurns brush mode on or off, as the brush button does: while it is on, a drag anywhere on the chart draws a box, and releasing zooms into the box and turns brush mode off again. With no argument, returns whether brush mode is on. Does nothing while
zoomis off or before the chart first renders.zoomBrushHandleSizenumberDefault1The pixel stroke-width of the zoom brush area.
zoomBrushHandleStylerecord|falseAn object containing CSS key/value pairs that is used to style the outer handle area of the zoom brush. Passing
falsewill remove all default styling.zoomBrushSelectionStylerecord|falseAn object containing CSS key/value pairs that is used to style the inner selection area of the zoom brush. Passing
falsewill remove all default styling.zoomControlClassNamestringAn additional CSS class name (or space-separated list of class names) applied to each zoom control button, alongside the fixed
zoom-control/zoom-in/zoom-out/zoom-reset/zoom-brush/select-box/select-lasso/zoom-moreclasses. Setting this automatically disables d3plus's built-in inlinezoomControlStyle/zoomControlStyleActive/zoomControlStyleHoverdefaults (as long as you haven't already customized them yourself), so a host page's own button styling — Tailwind, Bootstrap, a design system — applies through the cascade with no other configuration needed.zoomControlIconspartialOverrides the zoom-control icons (
zoomIn,zoomOut,zoomReset,zoomBrush,selectBox,selectLasso). Each value is an HTML string, or a mount function(el) => void | (() => void)called with the button's 12×12px icon slot (for a React tree, an<img>, …); a returned cleanup runs when the buttons redraw.zoomControlStylerecord|falseAn object containing CSS key/value pairs that is used to style each zoom control button (
.zoom-in,.zoom-out,.zoom-reset, and.zoom-brush). Passingfalsewill remove all default styling. Automatically skipped (as iffalse) once.zoomControlClassName(...)is set, unless you've explicitly customized this yourself.zoomControlStyleActiverecord|falseAn object containing CSS key/value pairs that is used to style each zoom control button when active (
.zoom-in,.zoom-out,.zoom-reset, and.zoom-brush). Passingfalsewill remove all default styling. Automatically skipped (as iffalse) once.zoomControlClassName(...)is set, unless you've explicitly customized this yourself.zoomControlStyleHoverrecord|falseDefaultfalseAn object containing CSS key/value pairs that is used to style each zoom control button on hover (
.zoom-in,.zoom-out,.zoom-reset, and.zoom-brush). Passingfalsewill remove all default styling. Automatically skipped (as iffalse) once.zoomControlClassName(...)is set, unless you've explicitly customized this yourself.zoomControlsbooleanDefaulttrueWhether the zoom-control buttons (zoom in, zoom out, reset, brush, and the box and lasso select tools, see
selectMode) show in the chart's top-right corner; on a chart too narrow for all of them beside the top-left controls, the ones that don't fit move into a "More Controls" menu.falsehides them and gives the room they take back to the chart's title, legend, and other top content, while zooming stays on: the wheel, pinch, drag, and double-click gestures still work, and the chart'szoomIn,zoomOut,zoomReset, andzoomBrushmethods let buttons of your own drive it. Defaults totrue.zoomDoubleClick"in"|"reset"|falseDefaultinWhat a double-click on the chart does:
"in"(the default) doubles the zoom around the pointer (Shift + double-click halves it),"reset"returns to the chart's initial view, like the reset button, andfalsedoes nothing.zoomDrag"pan"|"brush"DefaultpanWhat a mouse drag on the chart does.
"pan"(the default) pans it (seezoomPan)."brush"draws a box and zooms into it on release, as the brush button does, without turning brush mode on: a click that doesn't drag still reaches the shape under it, and hovering still shows tooltips. Shift + drag pans in"brush"mode, and touch keeps panning and pinching as in"pan".zoomFactornumberDefault2Multiplier applied to programmatic zoom steps.
zoomMaxnumberMaximum zoom scale factor. Defaults to the scale at which the smallest shape fills the chart area.
zoomPaddingnumberDefault20A pixel value to be used to pad all sides of a zoomed area. A Plot's brushed box fills its plot without it, so its axes show the brushed range.
zoomPanbooleanDefaulttrueWhether panning (drag) is enabled while zoomed.
zoomScrollboolean|"modifier"DefaultmodifierWhether the mouse wheel (and one-finger touch) zooms.
"modifier"(the default) leaves page scrolling alone: only Ctrl/⌘ + wheel or a trackpad/two-finger pinch zooms, and one finger pans only once zoomed in.truezooms on any wheel;falsenever does.