Skip to content

Documentation / @ripl/charts

@ripl/charts ​

npmlicensesize

25 animated, interactive chart types for Ripl, rendering to Canvas, SVG, the terminal or a server from one chart definition.

Features ​

  • 25 chart types, each behind a createXChart factory taking a CSS selector, an HTMLElement or a Ripl Context.
  • Animated data joins — chart.update(options) diffs the new data against the drawn elements and animates entries, updates and exits separately, at every level of a multi-series chart. Axes and legends transition rather than redraw.
  • Interaction — tooltips, crosshairs, hover highlighting, legend toggling, a windowing navigator strip for pan and zoom, and typed pointer events per chart (barenter, barleave, barclick, and their equivalents).
  • Shared components — axes, grids, legends, tooltips, crosshairs, titles and a navigator strip are configured through the same options on every chart that has them, so a dashboard stays consistent without per-chart wiring.
  • Same chart, several targets — Canvas or SVG in the browser, and braille text or raw ImageData from a headless Node script via @ripl/node.
  • Three built-in themes — lightTheme, darkTheme and colorBlindTheme, with registerTheme for your own and per-chart or per-series overrides.
  • Tree-shakable — importing one factory ships one chart type.
  • No third-party runtime dependencies — the only dependencies are four sibling packages in this repository (@ripl/core, @ripl/canvas, @ripl/dom, @ripl/utilities).

Chart types ​

CategoryCharts
CartesianBar, Line, Area, Scatter, Histogram, Box Plot, Trend, Stock
Radial & polarPie/Donut, Polar Area, Polar Scatter, Radial Bar, Radar, Gauge
HierarchicalSunburst, Treemap, Packed Circle
Network & flowSankey, Chord, Arc Diagram, Force-Directed, Funnel
SpecializedHeatmap, Gantt, Realtime

Installation ​

bash
# npm
npm install @ripl/charts

# yarn
yarn add @ripl/charts

# pnpm
pnpm add @ripl/charts

Pair it with @ripl/web when the same page also draws its own graphics; charts alone need nothing else.

Quick start ​

typescript
import {
    createBarChart,
} from '@ripl/charts';

const chart = createBarChart('#chart-container', {
    data: [
        {
            month: 'Jan',
            sales: 120,
            costs: 80,
        },
        {
            month: 'Feb',
            sales: 200,
            costs: 110,
        },
        {
            month: 'Mar',
            sales: 150,
            costs: 90,
        },
    ],
    key: 'month',
    series: [
        {
            id: 'sales',
            value: 'sales',
            label: 'Sales',
        },
        {
            id: 'costs',
            value: 'costs',
            label: 'Costs',
        },
    ],
});

chart.update({
    stacked: true,
});

chart.update() takes any partial option, not only data — the change animates from whatever is currently drawn.

Key API ​

ExportWhat it does
createBarChart … createGanttChartThe 25 chart factories
ChartBase class to extend for a custom chart type
createChartAnnotationsReference lines, bands and point callouts
createColorLegendLegend for a continuous colour scale
createSymbolThe scatter/legend symbol set
registerTheme / setDefaultThemeLight, dark and colour-blind themes, and your own
  • @ripl/web — the browser entry point, for drawing alongside a chart
  • @ripl/svg — render any chart as SVG instead of Canvas
  • @ripl/node — the same charts from a headless script, drawn through @ripl/terminal
  • @ripl/core — the elements, scales and animation the charts are built from

Documentation ​

Guides, an options reference and a live demo per chart type are at ripl.run/charts.

License ​

MIT

Classes ​

ClassDescription
ArcDiagramChartArc diagram: a cartesian axis whose points are nodes, connected by semicircular arcs whose thickness encodes the link value. Nodes are laid out in order along the axis (horizontal by default, or vertical), optionally sized by their connection count. On entry the arcs draw out of each node and cascade along the axis (a ripple that fades each node in as its arcs reach it) and updates animate arcs reshaping and nodes resizing. Supports labels, tooltips, and typed node/link interaction events.
AreaChartArea chart rendering filled regions beneath series lines.
BarChartBar chart supporting vertical/horizontal orientation and grouped/stacked modes.
BoxPlotChartBox-plot chart: summarizes a numeric field per category with the shared boxplotStats transform and draws a box (Q1–Q3) with a median line, whiskers to the 1.5×IQR fences, and outlier points. Boxes fade/grow in on entry and animate out on exit.
CartesianChartBase class providing shared cartesian component lifecycle and layout.
ChartAbstract base class for all chart types, providing the scene, renderer, animation, color management, title/legend layout, and the render/update lifecycle that every concrete chart builds on. Consumers never instantiate this directly; each chart exposes a createXChart factory (e.g. createBarChart) and this class supplies the shared behavior behind it.
ChartAnnotationsRenders chart ChartAnnotations (reference lines, shaded bands, and point markers) into the plot area, resolving their values through the supplied axis scales. Annotations whose value cannot be mapped (e.g. an x annotation against a categorical x axis) are skipped. The overlay is redrawn each call, which is inexpensive for the handful of annotations a chart typically carries.
ChartLayoutTracks the remaining free space within a chart and allows components to reserve bands from any edge. The order of reservation determines stacking: bands reserved first sit furthest from the plot area.
ChordChartChord diagram visualizing inter-relationships in a square matrix.
ColorLegendA continuous-color legend: a gradient bar (approximated by solid segments so it works identically on Canvas and SVG) annotated with formatted value labels drawn from a ColorScale. Renders into a reserved region like the other chart components; formatting is supplied explicitly, keeping the scale and the formatter decoupled.
ForceDirectedChartForce-directed network chart laying out nodes and links with a settling physics simulation.
FunnelChartFunnel chart rendering horizontally centered bars of decreasing width.
GanttChartGantt chart rendering time-based task bars on a categorical y-axis and time x-axis.
GaugeChartGauge chart displaying a single value on a 270-degree arc.
HeatmapChartHeatmap chart rendering a grid of colored cells on two categorical axes.
HistogramChartHistogram chart: bins a numeric field with the shared bin transform and draws each bin as a bar on a continuous value axis against a frequency axis. Supports animated entry/update/exit, tooltips, grid, and a chart title.
LineChartLine chart rendering one or more series as polylines with optional markers.
PackedCircleChartPacked circle chart rendering each datum as a circle whose area encodes its value, arranged in a tight, non-overlapping cluster. Great for showing many parts of a whole without the rigid grid of a treemap. Supports labels on sufficiently large circles, tooltips, and animated transitions.
PieChartPie chart rendering proportional arc segments with optional inner radius (donut).
PolarAreaChartPolar area chart rendering equal-angle segments whose radius encodes value.
PolarScatterChartPolar scatter chart plotting points by angle and radius on a circular grid.
RadarChartRadar (spider) chart plotting multi-axis data as filled polygonal areas.
RadialBarChartRadial bar chart rendering each category as a concentric ring whose arc length encodes its value.
RealtimeChartRealtime streaming chart rendering continuously updating line/area series.
RibbonA chord diagram ribbon connecting two arc segments with quadratic Bézier curves through the center.
SankeyChartSankey diagram visualizing directional flow between nodes.
SankeyLinkPathA curved Sankey link shape rendered as a cubic Bézier curve between source and target points.
ScatterChartScatter chart (bubble chart) plotting data points as circles on two continuous axes.
StockChartCandlestick (stock) chart rendering OHLC data with optional volume bars.
SunburstChartSunburst chart rendering hierarchical data as concentric arc rings.
TreemapChartTreemap chart rendering hierarchical data as nested, space-filling rectangles.
TrendChartTrend chart combining line, bar, and area series on shared categorical/value axes.

Interfaces ​

InterfaceDescription
AnnotationPlotThe plot rectangle annotations are drawn within and clipped to.
AnnotationScalesThe x/y value scales an annotation resolves its values through.
ArcDiagramChartEventMapEvents emitted by an ArcDiagramChart that consumers can subscribe to via chart.on(...).
ArcDiagramChartOptionsOptions for configuring an ArcDiagramChart.
ArcDiagramLinkA link between two nodes.
ArcDiagramLinkEventPayload emitted for arc diagram link interaction events.
ArcDiagramNodeA node in an arc diagram.
ArcDiagramNodeEventPayload emitted for arc diagram node interaction events.
AreaCenterThe center point and inscribed size of a rectangular ChartArea.
AreaChartEventMapEvents emitted by an AreaChart that consumers can subscribe to via chart.on(...).
AreaChartMarkerEventPayload emitted for area marker interaction events.
AreaChartOptionsOptions for configuring an AreaChart.
AreaChartSeriesOptionsConfiguration for an individual area chart series.
AxisTooltipRowOne row of a shared axis tooltip: a series' display label and its formatted value at the hovered category.
AxisTooltipSnapshotThe shared axis-tooltip content at a hovered plot position.
BarChartBarEventPayload emitted for bar interaction events.
BarChartEventMapEvents emitted by a BarChart that consumers can subscribe to via chart.on(...).
BarChartOptionsOptions for configuring a BarChart.
BarChartSeriesOptionsConfiguration for an individual bar chart series.
BaseChartOptionsBase options shared by all chart types.
BinA histogram bin covering the half-open interval [x0, x1) (the last bin includes x1).
BinOptionsOptions for bin.
BoxPlotBoxEventPayload emitted for box interaction events.
BoxPlotChartEventMapEvents emitted by a BoxPlotChart that consumers can subscribe to via chart.on(...).
BoxPlotChartOptionsOptions for configuring a BoxPlotChart.
BoxplotStatsFive-number summary plus IQR and outliers, as used by a box plot.
CartesianChartOptionsOptions shared by all cartesian charts.
CartesianSetupDeclares which optional cartesian components a chart wants constructed.
ChartAnimationOptionsFully resolved chart animation options.
ChartAreaA rectangular region expressed as a top-left origin plus dimensions.
ChartAxisItemOptionsOptions for a single axis (x or y).
ChartAxisOptionsCombined x and y axis configuration.
ChartBandAnnotationA shaded band spanning a value range on one axis (a threshold/target region).
ChartCrosshairOptionsFully resolved chart crosshair options.
ChartDataLabelsOptionsFully resolved data label options.
ChartGridOptionsFully resolved chart grid options.
ChartLegendOptionsFully resolved chart legend options.
ChartLineAnnotationA reference line drawn across the plot at a fixed value on one axis.
ChartOverviewOptionsConfiguration for the overview navigator strip.
ChartPaddingPadding with explicit top, right, bottom, and left values.
ChartPointAnnotationA marker (dot + optional label) placed at a specific x/y data coordinate.
ChartSegmentLabelsOptionsFully resolved segment-label options for radial charts.
ChartTitleOptionsFully resolved chart title options.
ChartTooltipOptionsFully resolved chart tooltip options.
ChartYAxisItemOptionsY-axis specific options extending the base axis item with a left/right position.
ChordChartEventMapEvents emitted by a ChordChart that consumers can subscribe to via chart.on(...).
ChordChartLinkEventPayload emitted for chord ribbon interaction events.
ChordChartOptionsOptions for configuring a ChordChart.
ChordChartSegmentEventPayload emitted for chord outer-arc interaction events.
ColorLegendComponentOptionsOptions for constructing a ColorLegend.
ColorLegendOptionsVisual options for a ColorLegend.
DataLabelLayoutResolved placement for a data label: the offset position and the text alignment that anchors it.
DataLabelSpecDescribes a single data label to render.
ForceDirectedChartEventMapEvents emitted by a ForceDirectedChart that consumers can subscribe to via chart.on(...).
ForceDirectedChartOptionsOptions for configuring a ForceDirectedChart.
ForceDirectedLinkEventPayload emitted for force-directed link interaction events.
ForceDirectedNodeEventPayload emitted for force-directed node interaction events.
ForceNetworkLinkA link between two nodes.
ForceNetworkNodeA node in a force-directed network.
FunnelChartEventMapEvents emitted by a FunnelChart that consumers can subscribe to via chart.on(...).
FunnelChartOptionsOptions for configuring a FunnelChart.
FunnelChartSegmentEventPayload emitted for funnel segment interaction events.
GanttChartEventMapEvents emitted by a GanttChart that consumers can subscribe to via chart.on(...).
GanttChartOptionsOptions for configuring a GanttChart.
GanttChartTaskEventPayload emitted for gantt task interaction events.
GaugeChartEventMapEvents emitted by a GaugeChart that consumers can subscribe to via chart.on(...).
GaugeChartOptionsOptions for configuring a GaugeChart.
GaugeChartValueEventPayload emitted for gauge value interaction events.
HeatmapChartCellEventPayload emitted for heatmap cell interaction events.
HeatmapChartEventMapEvents emitted by a HeatmapChart that consumers can subscribe to via chart.on(...).
HeatmapChartOptionsOptions for configuring a HeatmapChart.
HistogramBinEventPayload emitted for histogram bin interaction events.
HistogramChartEventMapEvents emitted by a HistogramChart that consumers can subscribe to via chart.on(...).
HistogramChartOptionsOptions for configuring a HistogramChart.
HoverHighlightOptionsOptions describing how an element should respond to hover, beyond its HoverHighlightStates.
HoverTooltipMinimal tooltip surface required by the hover helper (decouples it from the Tooltip class).
InteractionPointThe pointer position passed to interaction callbacks.
KdeOptionsOptions for kde.
LinearRegressionA fitted simple linear regression.
LineChartEventMapEvents emitted by a LineChart that consumers can subscribe to via chart.on(...).
LineChartMarkerEventPayload emitted for line marker interaction events.
LineChartOptionsOptions for configuring a LineChart.
LineChartSeriesOptionsConfiguration for an individual line chart series.
LineStyleSegmentA span of a series line, anchored to data keys, stroked with its own style.
LineStyleSegmentsA segmented line style: the style of each span, plus the style used everywhere else.
PackedCircleChartEventMapEvents emitted by a PackedCircleChart that consumers can subscribe to via chart.on(...).
PackedCircleChartNodeEventPayload emitted for packed circle interaction events.
PackedCircleChartOptionsOptions for configuring a PackedCircleChart.
PieChartEventMapEvents emitted by a PieChart that consumers can subscribe to via chart.on(...).
PieChartOptionsOptions for configuring a PieChart.
PieChartSegmentEventPayload emitted for pie segment interaction events.
PolarAreaChartEventMapEvents emitted by a PolarAreaChart that consumers can subscribe to via chart.on(...).
PolarAreaChartOptionsOptions for configuring a PolarAreaChart.
PolarAreaChartSegmentEventPayload emitted for polar-area segment interaction events.
PolarScatterChartEventMapEvents emitted by a PolarScatterChart that consumers can subscribe to via chart.on(...).
PolarScatterChartOptionsOptions for configuring a PolarScatterChart.
PolarScatterMarkerEventPayload emitted for polar scatter marker interaction events.
PolarScatterSeriesOptionsConfiguration for an individual polar scatter series.
RadarChartEventMapEvents emitted by a RadarChart that consumers can subscribe to via chart.on(...).
RadarChartMarkerEventPayload emitted for radar point interaction events.
RadarChartOptionsOptions for configuring a RadarChart.
RadarChartSeriesOptionsConfiguration for an individual radar chart series.
RadialBarChartBarEventPayload emitted for radial bar interaction events.
RadialBarChartEventMapEvents emitted by a RadialBarChart that consumers can subscribe to via chart.on(...).
RadialBarChartOptionsOptions for configuring a RadialBarChart.
RadialLabelAnchorA resolved anchor for a radial label, plus alignment.
RadialLabelInputInput geometry for placing a label around a radial (arc-based) segment.
RadialLabelPlacementResolved inside and outside placements for a radial segment label.
RealtimeChartOptionsOptions for configuring a RealtimeChart.
RealtimeChartSeriesOptionsConfiguration for an individual realtime chart series.
ResolvedAnimationA fully resolved animation ready to be applied to a transition.
ResolvedLineStyleA LineStyleInput resolved into the polyline state that draws it.
RibbonStateState interface for a ribbon shape connecting two arc segments via quadratic curves.
SankeyChartEventMapEvents emitted by a SankeyChart that consumers can subscribe to via chart.on(...).
SankeyChartLinkEventPayload emitted for Sankey link interaction events.
SankeyChartNodeEventPayload emitted for Sankey node interaction events.
SankeyChartOptionsOptions for configuring a SankeyChart.
SankeyLinkA directional flow between two nodes in a Sankey diagram.
SankeyLinkStateState interface for a Sankey link, defining source and target endpoint coordinates.
SankeyNodeA node in a Sankey diagram, with an optional typed datum carried through to node events.
ScatterChartEventMapEvents emitted by a ScatterChart that consumers can subscribe to via chart.on(...).
ScatterChartMarkerEventPayload emitted for scatter marker interaction events.
ScatterChartOptionsOptions for configuring a ScatterChart.
ScatterChartSeriesOptionsConfiguration for an individual scatter chart series.
SegmentInteractionOptionsHow a segment reports its hover to the chart around it: the typed event it emits and the chart-wide highlight it drives.
SegmentLabelLayoutFully resolved layout for a segment label: placement, content, styling, and leader-line points.
SegmentLabelSpecDescribes a single segment label to render.
StockChartCandleEventPayload emitted for stock candlestick interaction events.
StockChartEventMapEvents emitted by a StockChart that consumers can subscribe to via chart.on(...).
StockChartOptionsOptions for configuring a StockChart.
SunburstChartEventMapEvents emitted by a SunburstChart that consumers can subscribe to via chart.on(...).
SunburstChartNodeEventPayload emitted for sunburst segment interaction events.
SunburstChartOptionsOptions for configuring a SunburstChart.
SunburstNodeA node in a sunburst hierarchy with optional nested children and an optional typed datum.
ThemeThe palette and furniture colors a chart renders with.
TreemapChartEventMapEvents emitted by a TreemapChart that consumers can subscribe to via chart.on(...).
TreemapChartNodeEventPayload emitted for treemap cell interaction events.
TreemapChartOptionsOptions for configuring a TreemapChart.
TrendChartAreaSeriesOptionsSeries options for an area-type series within a trend chart.
TrendChartBarEventPayload emitted for trend bar interaction events.
TrendChartBarSeriesOptionsSeries options for a bar-type series within a trend chart.
TrendChartBaseSeriesOptionsConfiguration shared by every trend chart series type.
TrendChartEventMapEvents emitted by a TrendChart that consumers can subscribe to via chart.on(...).
TrendChartLineSeriesOptionsSeries options for a line-type series within a trend chart.
TrendChartMarkerEventPayload emitted for trend line/area marker interaction events.
TrendChartOptionsOptions for configuring a TrendChart.

Type Aliases ​

Type AliasDescription
AccessorA value accessor expressed as a property key, a constant, or a function.
AnnotationAxisWhich axis an annotation's value(s) are measured against.
ArcDiagramOrientationHow the node axis is oriented.
AxisFormatTypeBuilt-in axis label format types.
AxisScaleTypeThe scale family an axis maps its domain through. Value axes accept 'linear'/'log'/'pow'/'sqrt'/'symlog'; category and time axes are selected by the chart.
BarChartOrientationWhether bars are laid out vertically (default) or horizontally.
BorderRadiusInputBorder radius expressed as a uniform number or a per-corner tuple.
CartesianTargetRe-exported for convenience to subclasses that accept a render target.
ChartAnimationInputAnimation input accepting a boolean toggle or partial options object.
ChartAnnotationAny chart annotation: a reference line, a shaded band, or a point marker.
ChartAxisInputAxis input accepting a boolean toggle or a full axis options object.
ChartCrosshairInputCrosshair input accepting a boolean toggle or partial options object.
ChartDataLabelsInputData label input: a boolean toggle, a LabelAnchor string selecting where labels sit, or a partial options object.
ChartGridInputGrid input accepting a boolean toggle or partial options object.
ChartLegendInputLegend input accepting a boolean, position string, or partial options object.
ChartOptionsAlias for a chart's options type, used by factory helpers for readability and future augmentation.
ChartSegmentLabelsInputSegment-label input: a boolean toggle, a SegmentLabelPosition string (which also enables labels), or a partial options object.
ChartSideAn edge of the layout from which a band can be reserved.
ChartTitleInputTitle input accepting a plain string or partial options object.
ChartTooltipInputTooltip input accepting a boolean toggle or partial options object.
ChartTooltipTriggerWhat causes a tooltip to show.
ChartYAxisEntryOne y-axis in a multi-axis configuration.
ColorLegendOrientationOrientation of the color legend bar.
CrosshairAxisWhich axis the crosshair tracks.
EaseNameNamed easing function identifiers.
HoverHighlightStatesThe pair of states a hover transitions between, given together or not at all: an element handed a highlight without the restore that undoes it would be stranded highlighted once the pointer left.
LabelAnchorWhere a data label is anchored relative to its marker/bar.
LegendPositionPosition of the chart legend relative to the chart area.
LineStyleHow a series line is stroked: a preset, or a custom canvas dash array.
LineStyleBoundA segment boundary: the key of a data point, or a function picking one out of the chart data.
LineStyleInputHow a series line is stroked: one style for the whole line, or key-anchored spans each with their own style. A bare array of segments defaults everything they do not cover to 'solid'; the object form names that fallback explicitly.
NumericAccessorA strongly-typed numeric accessor: a numeric-valued property key of TData, or a function returning a number. Using this (instead of a bare keyof TData) makes the compiler reject a key that points at a non-numeric field. Fields that also accept a fixed constant (e.g. a scatter sizeBy) widen this with `
NumericKeyThe keys of TData whose values are number. Resolves to never for unknown/loose data.
PaddingResolved padding with explicit top, right, bottom, and left values.
PaddingInputPadding, in pixels: a uniform number, a [top, right, bottom, left] tuple, or a partial per-edge object. Every option named padding accepts this same shape, on the chart and on every component.
SegmentLabelPositionWhere a radial segment label sits: inside the segment, or outside with a leader line.
SymbolElementAn element usable as a point marker: circle or regular polygon, both animated via radius.
SymbolTypeThe available marker symbol shapes.
TitlePositionPosition of the chart title relative to the chart area.
TrendChartSeriesOptionsDiscriminated union of all trend chart series option types.
TrendSeriesTypeSupported series visualization types within a trend chart.
ValueFormatInputA value formatter accepted anywhere a chart renders a raw value as text (tooltips, data labels, pie segment labels, axis ticks). Either a built-in AxisFormatType, an Intl number-format options object (e.g. { style: 'currency', currency: 'USD' }), or a custom callback.

Variables ​

VariableDescription
ANIMATION_REFERENCEReference durations (in ms, at the default animation speed) for each transition kind.
colorBlindThemeA colorblind-safe theme using the Okabe–Ito qualitative palette and a CVD-friendly sequential scale, for accessible categorical encoding. Pair with data labels for the strongest accessibility.
darkThemeThe built-in dark theme, tuned for a dark canvas background.
DEFAULT_CHART_PADDINGDefault space, in pixels, reserved around every chart when its padding option is unset.
DEFAULT_SEGMENT_PAD_WIDTHThe default gap, in logical pixels, between adjacent segments of a radial chart.
ELEMENT_GAPGap, in pixels, inserted between two adjacent reserved bands (title, legend, navigator, plot).
lightThemeThe built-in light theme. Its colors match Ripl's historical defaults.
SEGMENT_LABEL_FONTShared segment-label style constants. Every chart routes its segment labels through these so the appearance is identical across chart types and across the Canvas and SVG contexts. The cross-context inconsistency this fixes came from labels that omitted font, leaving each backend to fall back to its own default, so always set an explicit font.
SEGMENT_LABEL_INSIDE_FILLFill for labels drawn inside a segment (on top of the filled shape).
SEGMENT_LABEL_OUTSIDE_FILLFill for labels drawn outside a segment (on the chart background).
SPACINGThe chart spacing scale.

Functions ​

FunctionDescription
applyHoverHighlightWires consistent hover behavior (highlight transition + optional tooltip) onto an element. Safe to call repeatedly on the same persistent element across renders; prior listeners are disposed first so handlers never accumulate.
applySegmentInteractionWires a chart segment's full hover treatment: the tooltip and highlight transition of applyHoverHighlight, plus the typed enter/leave/click events and the chart-wide highlight every segmented chart emits alongside them.
arcCentroidAnchorAnchors a tooltip at an arc's centroid, measured against the geometry the arc is animating toward rather than its current frame, so a tooltip opened mid-transition lands where the segment settles rather than where it happens to be.
areaCenterComputes the center point and inscribed size (the smaller of width and height) of a rectangular area: the shared basis for laying out radial and polar charts.
axisTickCountThe target number of ticks (and grid lines) an axis draws, from its ticks option (default 10).
binBins numeric values into a histogram. Without explicit thresholds, a "nice" uniform bin width is derived from the target bin count (Sturges' rule by default). Values outside the domain are dropped.
boxplotStatsComputes the box-plot five-number summary, splitting values beyond 1.5×IQR out as outliers.
computeStackOffsetComputes the stacked baseline offset for a series at a given data item. Positive and negative values stack independently so diverging stacks render correctly. Series earlier in the array sit closer to the baseline.
createArcDiagramChartFactory function that creates a new ArcDiagramChart instance.
createAreaChartFactory function that creates a new AreaChart instance.
createBarChartFactory function that creates a new BarChart instance.
createBoxPlotChartFactory function that creates a new BoxPlotChart.
createChartAnnotationsFactory function that creates a new ChartAnnotations component.
createChordChartFactory function that creates a new ChordChart instance.
createColorLegendFactory function that creates a new ColorLegend.
createDataLabelCreates a data label Text element (at opacity 0) positioned by its anchor.
createForceDirectedChartFactory function that creates a new ForceDirectedChart instance.
createFunnelChartFactory function that creates a new FunnelChart instance.
createGanttChartFactory function that creates a new GanttChart instance.
createGaugeChartFactory function that creates a new GaugeChart instance.
createHeatmapChartFactory function that creates a new HeatmapChart instance.
createHistogramChartFactory function that creates a new HistogramChart.
createIndexLookupBuilds a value → index lookup with Array.prototype.indexOf semantics: the earliest occurrence wins for a duplicated value, an absent value resolves to -1, and NaN matches nothing.
createKeyedLookupBuilds a key → value lookup with Array.prototype.find semantics over a key comparison: the earliest match wins for a duplicated key, and an unknown key resolves to undefined.
createLineChartFactory function that creates a new LineChart instance.
createPackedCircleChartFactory function that creates a new PackedCircleChart instance.
createPieChartFactory function that creates a new PieChart instance.
createPolarAreaChartFactory function that creates a new PolarAreaChart instance.
createPolarScatterChartFactory function that creates a new PolarScatterChart instance.
createRadarChartFactory function that creates a new RadarChart instance.
createRadialBarChartFactory function that creates a new RadialBarChart instance.
createRealtimeChartFactory function that creates a new RealtimeChart instance.
createRibbonFactory function that creates a new Ribbon instance.
createSankeyChartFactory function that creates a new SankeyChart instance.
createSankeyLinkFactory function that creates a new SankeyLinkPath instance.
createScatterChartFactory function that creates a new ScatterChart instance.
createSegmentLabelCreates a segment label Text with all style properties set explicitly (never inheriting the context default), guaranteeing identical rendering across chart types and Canvas/SVG contexts.
createStockChartFactory function that creates a new StockChart instance.
createSunburstChartFactory function that creates a new SunburstChart instance.
createSymbolCreates a marker element for the given symbol type. The returned element exposes cx/cy/radius, so hosts treat every symbol identically for positioning and animation. Pass the equal-area circle radius through symbolRadius when sizing non-circle symbols.
createTimeAxisScaleBuilds a time-axis Scale from resolved axis options over a millisecond extent and pixel range. An explicit numeric min/max (epoch milliseconds) overrides the corresponding end of the data extent. Ticks are calendar-aligned Date values from the core time scale.
createTreemapChartFactory function that creates a new TreemapChart instance.
createTrendChartFactory function that creates a new TrendChart instance.
createValueScaleBuilds a value-axis Scale from resolved axis options over a data extent and pixel range.
cumulativeExtentComputes the value extent [min, max] of the running cumulative total across series: the span a stacked area chart covers as each series accumulates on top of the previous ones. Both bounds seed at 0, so a single-sign dataset keeps a zero baseline.
deviationThe population standard deviation of the values.
elementIsRibbonType guard that checks whether a value is a Ribbon instance.
elementIsSankeyLinkType guard that checks whether a value is a SankeyLinkPath instance.
exitElementTransitions an element to a terminal state (defaulting to fully transparent) and then destroys it, giving every chart a consistent exit animation. When animation is disabled the element is destroyed immediately.
formatTimeLabelFormats a time-axis tick for display, adapting the format to the domain span; multi-year spans show the year, month-scale spans show abbreviated month and year, day-scale spans show dates, and anything shorter shows times. An explicit axis format always wins over this default.
getDefaultThemeThe current module-level default theme (initially lightTheme).
isTimeAxisWhether the resolved axis options select the time scale family (a continuous axis over Date values with calendar-aligned ticks).
kdeReturns a Gaussian kernel density estimator f(x) for the values. The bandwidth defaults to Silverman's rule; pass one explicitly for tighter or smoother density curves.
linearRegressionFits a simple least-squares linear regression to [x, y] points and reports its R².
meanThe arithmetic mean of the values (NaN when empty).
normalizeAnimationNormalizes animation input into fully resolved ChartAnimationOptions.
normalizeAxisNormalizes axis input into a full ChartAxisOptions object with both x and y.
normalizeAxisItemNormalizes a single axis item input into fully resolved options.
normalizeCrosshairNormalizes crosshair input into fully resolved ChartCrosshairOptions.
normalizeDataLabelsNormalizes a data label input into fully resolved ChartDataLabelsOptions.
normalizeGridNormalizes grid input into fully resolved ChartGridOptions.
normalizeLegendNormalizes legend input into fully resolved ChartLegendOptions.
normalizePaddingNormalizes a padding input into a full ChartPadding, or returns undefined when there is no input. Unspecified edges of a partial object fall back to 0.
normalizeSegmentLabelsNormalizes a segment-label input into fully resolved ChartSegmentLabelsOptions.
normalizeTitleNormalizes a title input into fully resolved ChartTitleOptions.
normalizeTooltipNormalizes tooltip input into fully resolved ChartTooltipOptions.
normalizeYAxisItemNormalizes a Y-axis item input into fully resolved options with position.
positionSymbolRepositions a symbol element, keeping a rotated symbol's transform origin locked to its center (a square is a 45°-rotated regular quad, so its origin must follow cx/cy).
positiveNegativeExtentComputes the value extent [min, max] of independently stacked positive and negative totals: the span a stacked bar chart covers when, per item, positive and negative values accumulate from the baseline in opposite directions. Both bounds seed at 0, so an all-positive (or all-negative) dataset keeps a zero baseline.
quantileThe p-quantile (0–1) of the values via linear interpolation between order statistics.
registerThemeRegisters a named theme so it can be selected by name via the theme option or resolveTheme.
resolveAccessorNormalizes an Accessor into a function. Property keys read the field, functions are passed through, and any other value is treated as a constant.
resolveAnimationResolves chart animation options for a given reference duration, scaling by the configured speed and collapsing to 0/disabled when animation is turned off.
resolveChartPaddingResolves a chart padding input into a full ChartPadding. A single number applies to all four edges; a partial object sets individual edges and leaves the rest at fallback; undefined falls back on every edge. Explicit 0 values are preserved.
resolveColorByResolves a per-item color accessor (colorBy) into a function returning each item's color.
resolveDataLabelLayoutResolves the anchored position and text alignment for a data label.
resolveEaseResolves an ease name or function to an Ease function, defaulting to easeOutCubic.
resolveFormatLabelResolves a ValueFormatInput into a label formatting function. A built-in AxisFormatType maps to a preset formatter, an Intl number-format options object binds numberFormat to those options, and a function is returned as-is.
resolveLineDashResolves a LineStyle into a lineDash array ([] for a solid line).
resolveLineStyleResolves a LineStyleInput against the chart data into the dash state that draws it: the dash pattern for the line as a whole, plus the point-index spans that override it.
resolveRadialLabelComputes both the inside (centroid) and outside (leader-line) label placements for a radial segment. Shared by the pie and polar-area charts so their inside/outside label behavior and the elbow leader line, stay identical. The outside textAlign flips by hemisphere so text reads away from the center.
resolveSegmentLabelLayoutResolves a segment's label into a ready-to-render layout (inside centroid or outside leader line), honoring visibility, an optional minimum-angle clutter guard, and position/font/color options. Shared by the pie and polar-area charts so their label behavior is identical.
resolveSegmentPadWidthResolves the constant-width gap a radial chart separates its segments with, honoring a chart's deprecated angular padAngle option where one is still passed.
resolveThemeResolves a theme input into a concrete Theme.
resolveValueFormatResolves a value formatter into a function, always returning a usable formatter (falling back to String when no custom format is supplied). Convenience wrapper over resolveFormatLabel for the value-as-text sites that always need to print something.
rollupGroups values by a key and reduces each group, returning a Map of key → reduced value.
setDefaultThemeSets the module-level default theme applied to charts that do not specify their own theme.
staggerComputes a per-element stagger delay so that a collection of entering elements animate in sequence rather than all at once. Returns 0 when there is nothing to stagger.
symbolRadiusThe circumradius a symbol element needs to match the visual area of a circle of the given radius. Hosts animating a marker's radius should animate towards this value.
transitionIfAnyRuns a transition over the given elements, resolving immediately when there are none. An empty renderer.transition still starts the animation loop and only settles a frame later, so the guard keeps a render with nothing to animate free.