Skip to content

API index

Methods

  • area - Returns a new area mark with the given data and options
  • areaX - Returns a new vertically-oriented area mark for the given data and options, where the baseline and topline share y values, as in a time-series area chart where time goes up↑
  • areaY - Returns a new horizontally-oriented area mark for the given data and options, where the baseline and topline share x values, as in a time-series area chart where time goes right→
  • arrow - Returns a new arrow mark for the given data and options, drawing (possibly swoopy) arrows connecting pairs of points
  • auto - Returns a new mark whose implementation is chosen dynamically to best represent the dimensions of the given data specified in options, according to a few simple heuristics
  • autoSpec - Returns a fully-specified options object for the auto mark, with nothing left undefined
  • axisFx - Returns a new compound axis mark to document the visual encoding of the horizontal facet position fx scale, comprised of (up to) three marks
  • axisFy - Returns a new compound axis mark to document the visual encoding of the vertical facet position fy scale, comprised of (up to) three marks
  • axisX - Returns a new compound axis mark to document the visual encoding of the horizontal position x scale, comprised of (up to) three marks
  • axisY - Returns a new compound axis mark to document the visual encoding of the vertical position y scale, comprised of (up to) three marks
  • barX - Returns a new horizontal bar mark for the given data and options; the required x values should be quantitative or temporal, and the optional y values should be ordinal
  • barY - Returns a new vertical bar mark for the given data and options; the required y values should be quantitative or temporal, and the optional x values should be ordinal
  • bin - Bins on the x and y channels; then subdivides bins on the first channel of z, fill, or stroke, if any; and lastly for each channel in the specified outputs, applies the corresponding reduce method to produce new channel values from the binned input channel values
  • binX - Bins on the x channel; then subdivides bins on the first channel of z, fill, or stroke, if any; then further subdivides bins on the y channel, if any and if none of y, y1, and y2 are in outputs; and lastly for each channel in the specified outputs, applies the corresponding reduce method to produce new channel values from the binned input channel values
  • binY - Bins on the y channel; then subdivides bins on the first channel of z, fill, or stroke, if any; then further subdivides bins on the x channel, if any and if none of x, x1, and x2 are in outputs; and lastly for each channel in the specified outputs, applies the corresponding reduce method to produce new channel values from the binned input channel values
  • bollinger - Given the specified bollinger options, returns a corresponding map implementation for use with the map transform, allowing the bollinger transform to be applied to arbitrary channels instead of only x and y
  • bollingerX - Returns a new vertically-oriented bollinger mark for the given data and options, as in a time-series area chart where time goes up↑ (or down↓)
  • bollingerY - Returns a new horizontally-oriented bollinger mark for the given data and options, as in a time-series area chart where time goes right→ (or ←left)
  • boxX - Returns a box mark that draws horizontal boxplots where x is quantitative or temporal and y, if present, is ordinal
  • boxY - Returns a box mark that draws vertical boxplots where y is quantitative or temporal and x, if present, is ordinal
  • cell - Returns a rectangular cell mark for the given data and options
  • cellX - Like cell, but x defaults to the zero-based index [0, 1, 2, …], and if stroke is not a channel, fill defaults to the identity function, assuming that data = [x₀, x₁, x₂, …]
  • cellY - Like cell, but y defaults to the zero-based index [0, 1, 2, …], and if stroke is not a channel, fill defaults to the identity function, assuming that data = [y₀, y₁, y₂, …]
  • centroid - Given a geometry input channel of GeoJSON geometry, derives x and y output channels representing the planar (projected) centroids of the geometry
  • circle - Like dot, except that the symbol option is set to circle
  • cluster - Shorthand for the tree mark using d3.cluster as the treeLayout option, placing leaf nodes of the tree at the same depth
  • column - Returns a [column, setColumn] helper for deriving columns; column is a channel transform that returns whatever value was most recently passed to setColumn
  • contour - Returns a new contour mark, which creates contour polygons from spatial samples
  • crosshair - Returns a new crosshair mark for the given data and options, drawing horizontal and vertical rules centered at the point closest to the pointer
  • crosshairX - Like crosshair, but uses the pointerX transform
  • crosshairY - Like crosshair, but uses the pointerY transform
  • delaunayLink - Returns a mark that draws links for each edge of the Delaunay triangulation of the points given by the x and y channels
  • delaunayMesh - Returns a mark that draws a mesh of the Delaunay triangulation of the points given by the x and y channels
  • density - Returns a mark that draws contours representing the estimated density of the two-dimensional points given by x and y, and possibly weighted by weight
  • differenceY - Returns a new vertical difference mark for the given the specified data and options, as in a time-series chart where time goes right→ (or ←left)
  • dodgeX - Given a y position channel, derives a new x position channel that places circles of the given radius r to avoid overlap
  • dodgeY - Given an x position channel, derives a new y position channel that places circles of the given radius r to avoid overlap
  • dot - Returns a new dot mark for the given data and options that draws circles, or other symbols, as in a scatterplot
  • dotX - Like dot, except that x defaults to the identity function, assuming that data = [x₀, x₁, x₂, …]
  • dotY - Like dot, except that y defaults to the identity function, assuming that data = [y₀, y₁, y₂, …]
  • filter - Applies a transform to options to filter the mark’s index according to the given test, which can be a function (receiving the datum d and index i) or a channel value definition such as a field name; only truthy values are retained in the index
  • find - Given the specified test function, returns a corresponding reducer implementation for use with the group or bin transform
  • formatIsoDate - Given a date, returns the shortest equivalent ISO 8601 UTC string
  • formatMonth - Returns a function that formats a given month number (from 0 = January to 11 = December) according to the specified locale and format
  • formatWeekday - Returns a function that formats a given week day number (from 0 = Sunday to 6 = Saturday) according to the specified locale and format
  • frame - Draws a rectangle around the plot’s frame, or if an anchor is given, a line on the given side
  • geo - Returns a new geo mark with the given data and options
  • geoCentroid - Given a geometry input channel of spherical GeoJSON geometry, derives x and y output channels representing the spherical centroids of the geometry
  • graticule - Returns a new geo mark whose data is a 10° global graticule
  • gridFx - Returns a new horizontally-positioned ruleX mark (a vertical line, |) that renders a grid for the fx scale
  • gridFy - Returns a new vertically-positioned ruleY mark (a horizontal line, —) that renders a grid for the fy scale
  • gridX - Returns a new horizontally-positioned ruleX mark (a vertical line, |) that renders a grid for the x scale
  • gridY - Returns a new vertically-positioned ruleY mark (a horizontal line, —) that renders a grid for the y scale
  • group - Groups on the x and y channels; then subdivides groups on the first channel of z, fill, or stroke, if any; and then for each channel in the specified outputs, applies the corresponding reduce method to produce new channel values from the grouped input channel values
  • groupX - Groups on the x channel; then subdivides groups on the first channel of z, fill, or stroke, if any; and then for each channel in the specified outputs, applies the corresponding reduce method to produce new channel values from the grouped input channel values
  • groupY - Groups on the y channel; then subdivides groups on the first channel of z, fill, or stroke, if any; and then for each channel in the specified outputs, applies the corresponding reduce method to produce new channel values from the grouped input channel values
  • groupZ - Groups on the first channel of z, fill, or stroke, if any, and then for each channel in the specified outputs, applies the corresponding reduce method to produce new channel values from the grouped input channel values
  • hexagon - Like dot, except that the symbol option is set to hexagon
  • hexbin - Bins hexagonally on the scaled x and y channels; then subdivides bins on the first channel of z, fill, or stroke, if any; and lastly for each channel in the specified outputs, applies the corresponding reduce method to produce new channel values from the binned input channel values
  • hexgrid - The hexgrid decoration mark complements the hexbin transform, showing the outlines of all hexagons spanning the frame with a default stroke of currentColor and a default strokeOpacity of 0.1, similar to the the default axis grids
  • hull - Returns a mark that draws a convex hull around the points given by the x and y channels
  • identity - A channel transform that returns the data as-is, avoiding an extra copy when defining a channel as being equal to the data
  • image - Returns a new image mark for the given data and options that draws images as in a scatterplot
  • indexOf - A channel transform that returns the zero-based index [0, 1, 2, …] of the data; often used as a default for mark shorthand
  • initializer - Given an options object that may specify some basic initializers (filter, sort, or reverse) or a custom initializer, composes those initializers with the given initializer function, returning a new options object
  • interpolateNearest - Assigns each pixel in the raster grid the value of the closest sample; effectively a Voronoi diagram
  • interpolateNone - Applies a simple forward mapping of samples, binning them into pixels in the raster grid without any blending or interpolation
  • interpolatorBarycentric - Constructs a Delaunay triangulation of the samples, and then for each pixel in the raster grid, determines the triangle that covers the pixel’s centroid and interpolates the values associated with the triangle’s vertices using barycentric coordinates
  • interpolatorRandomWalk - For each pixel in the raster grid, initiates a random walk, stopping when either the walk is within a given distance (minDistance) of a sample or the maximum allowable number of steps (maxSteps) have been taken, and then assigning the current pixel the closest sample’s value
  • legend - Generates a standalone legend for the scale defined by the given options, returning either an SVG or HTML element depending on the scale and the desired legend type
  • line - Returns a new line mark for the given data and options by connecting control points
  • lineX - Like line, except that x defaults to the identity function assuming that data = [x₀, x₁, x₂, …] and y defaults to the zero-based index [0, 1, 2, …]
  • lineY - Like line, except y defaults to the identity function and assumes that data = [y₀, y₁, y₂, …] and x defaults to the zero-based index [0, 1, 2, …]
  • linearRegressionX - Like linearRegressionY, but where x is the dependent variable and y is the independent variable
  • linearRegressionY - Returns a mark that draws linear regression lines with confidence bands, representing the estimated relation of a dependent variable (y) on an independent variable (x)
  • link - Returns a new link mark for the given data and options, drawing line segments (curves) connecting pairs of points
  • map - Groups on the first channel of z, fill, or stroke, if any, and then for each channel in the specified outputs, applies the corresponding map method to produce new channel values for each series
  • mapX - Groups on the first channel of z, fill, or stroke, if any, and then applies the specified map method to each of the x, x1, and x2 channels in the specified options to produce new channel values for each series
  • mapY - Groups on the first channel of z, fill, or stroke, if any, and then applies the specified map method to each of the y, y1, and y2 channels in the specified options to produce new channel values for each series
  • marks - Given an array of marks, returns a compound mark; supports mark.plot shorthand
  • normalize - Given a normalize basis, returns a corresponding map implementation for use with the map transform, allowing the normalization of arbitrary channels instead of only x and y
  • normalizeX - Groups data into series using the first channel of z, fill, or stroke (if any), then derives new x, x1, and x2 channels for each corresponding input channel by normalizing to the given basis
  • normalizeY - Groups data into series using the first channel of z, fill, or stroke (if any), then derives new y, y1, and y2 channels for each corresponding input channel by normalizing to the given basis
  • plot - Renders a new plot given the specified options and returns the corresponding SVG element, or an HTML figure element if a caption or legend is requested
  • pointer - Applies a render transform to the specified options to filter the mark index such that only the point closest to the pointer is rendered; the mark will re-render interactively in response to pointer events
  • pointerX - Like the pointer transform, except the determination of the closest point considers mostly the x (horizontal↔︎) position; this should be used for plots where x is the dominant dimension, such as time in a time-series chart, the binned quantitative dimension in a histogram, or the categorical dimension of a bar chart
  • pointerY - Like the pointer transform, except the determination of the closest point considers mostly the y (vertical↕︎) position; this should be used for plots where y is the dominant dimension, such as time in a time-series chart, the binned quantitative dimension in a histogram, or the categorical dimension of a bar chart
  • raster - Returns a raster mark which renders a raster image from spatial samples
  • rect - Returns a rect mark for the given data and options
  • rectX - Like rect, but if neither x1 nor x2 is specified, an implicit stackX transform is applied to x, and if x is not specified, it defaults to the identity function, assuming that data is an array of numbers [x₀, x₁, x₂, …]
  • rectY - Like rect, but if neither y1 nor y2 is specified, apply an implicit stackY transform is applied to y, and if y is not specified, it defaults to the identity function, assuming that data is an array of numbers [y₀, y₁, y₂, …]
  • reverse - Applies a transform to options to reverse the order of the mark’s index, say for reverse input order
  • ruleX - Returns a new horizontally-positioned ruleX mark (a vertical line, |) for the given data and options
  • ruleY - Returns a new vertically-positioned ruleY mark (a horizontal line, —) for the given data and options
  • scale - Returns a standalone scale given the specified scale options, which must define exactly one named scale
  • select - Groups on the first channel of z, fill, or stroke, if any, and then selects points from each series based on the given selector
  • selectFirst - Groups on the first channel of z, fill, or stroke, if any, and then selects the first point from each series in input order
  • selectLast - Groups on the first channel of z, fill, or stroke, if any, and then selects the last point from each series in input order
  • selectMaxX - Groups on the first channel of z, fill, or stroke, if any, and then selects the maximum point from each series based on x channel value
  • selectMaxY - Groups on the first channel of z, fill, or stroke, if any, and then selects the maximum point from each series based on y channel value
  • selectMinX - Groups on the first channel of z, fill, or stroke, if any, and then selects the minimum point from each series based on x channel value
  • selectMinY - Groups on the first channel of z, fill, or stroke, if any, and then selects the minimum point from each series based on y channel value
  • shiftX - Groups data into series using the first channel of z, fill, or stroke (if any), then derives x1 and x2 output channels by shifting the input x channel according to the specified interval
  • shuffle - Applies a transform to options to randomly shuffles the mark’s index
  • sort - Applies a transform to options to sort the mark’s index by the specified order
  • sphere - Returns a new geo mark whose data is the outline of the sphere on the projection’s plane
  • spike - Like vector, but with default options suitable for drawing a spike map
  • stackX - Transforms a length channel x into starting and ending position channels x1 and x2 by “stacking” elements that share a given y position
  • stackX1 - Like stackX, but returns the starting position x1 as the x channel, for example to position a dot on the left-hand side of each element of a stack
  • stackX2 - Like stackX, but returns the starting position x2 as the x channel, for example to position a dot on the right-hand side of each element of a stack
  • stackY - Transforms a length channel y into starting and ending position channels y1 and y2 by “stacking” elements that share a given x position
  • stackY1 - Like stackY, but returns the starting position y1 as the y channel, for example to position a dot at the bottom of each element of a stack
  • stackY2 - Like stackY, but returns the ending position y2 as the y channel, for example to position a dot at the top of each element of a stack
  • text - Returns a new text mark for the given data and options
  • textX - Like text, but x defaults to the identity function, assuming that data = [x₀, x₁, x₂, …]
  • textY - Like text, but y defaults to the identity function, assuming that data = [y₀, y₁, y₂, …]
  • tickX - Returns a new horizontally-positioned tickX mark (a vertical line, |) for the given data and options
  • tickY - Returns a new vertically-positioned tickY mark (a horizontal line, —) for the given data and options
  • tip - Returns a new tip mark for the given data and options
  • transform - Given an options object that may specify some basic transforms (filter, sort, or reverse) or a custom transform, composes those transforms with the given transform function, returning a new options object
  • tree - Returns a compound tree mark, with a link to display edges from parent to child, a dot to display nodes, and a text to display node labels
  • treeLink - Populates the x1, y1, x2, and y2 channels, and applies the following defaults
  • treeNode - Populates the x and y channels with the positions for each node, and applies a default frameAnchor based on the specified treeAnchor
  • valueof - Given some data and a channel value definition (such as a field name or function accessor), returns an array of the specified type containing the corresponding values derived from data
  • vector - Returns a new vector mark for the given data and options
  • vectorX - Like vector, but x instead defaults to the identity function and y defaults to null, assuming that data is an array of numbers [x₀, x₁, x₂, …]
  • vectorY - Like vector, but y instead defaults to the identity function and x defaults to null, assuming that data is an array of numbers [y₀, y₁, y₂, …]
  • voronoi - Returns a mark that draws polygons for each cell of the Voronoi tesselation of the points given by the x and y channels
  • voronoiMesh - Returns a mark that draws a mesh for the cell boundaries of the Voronoi tesselation of the points given by the x and y channels
  • window - Given the specified window options, returns a corresponding map implementation for use with the map transform, allowing the window transform to be applied to arbitrary channels instead of only x and y
  • windowX - Groups data into series using the first channel of z, fill, or stroke (if any), then derives new x, x1, and x2 channels by computing a moving window of channel values and deriving reduced values from the window
  • windowY - Groups data into series using the first channel of z, fill, or stroke (if any), then derives new y, y1, and y2 channels by computing a moving window of channel values and deriving reduced values from the window

Options