Skip to content

Documentation / @ripl/charts

@ripl/charts ​

Pre-built, animated chart components for Ripl — a unified API for 2D graphics rendering in the browser.

Installation ​

bash
npm install @ripl/charts

Chart Types ​

CategoryCharts
CartesianBar, Line, Area, Scatter, Trend (multi-series bar/line), Stock, Realtime
RadialPie/Donut, Radar, Polar Area, Gauge, Sunburst
RelationalSankey, Chord
DistributionHeatmap, Treemap, Funnel
SchedulingGantt

Usage ​

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

const chart = new BarChart('#chart', {
    data: [
        { label: 'A',
            value: 10 },
        { label: 'B',
            value: 25 },
        { label: 'C',
            value: 15 },
    ],
    keyBy: 'label',
    series: [
        { valueBy: item => item.value },
    ],
});

Features ​

  • Animated transitions — Smooth entry, update, and exit animations out of the box
  • Interactive — Tooltips, crosshairs, hover effects, and click events
  • Configurable — Axes, legends, grids, colors, padding, and more
  • Canvas & SVG — Renders to either context via Ripl's unified API
  • Tree-shakable — Import only the chart types you need

Documentation ​

Full documentation, options reference, and interactive demos are available at ripl.rocks.

License ​

MIT

Classes ​

ClassDescription
AreaChartArea chart rendering filled regions beneath series lines.
BarChartBar chart supporting vertical/horizontal orientation and grouped/stacked modes.
ChartAbstract base class for all chart types, providing scene, renderer, animation, color management, and lifecycle.
ChordChartChord diagram visualizing inter-relationships in a square matrix.
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.
LineChartLine chart rendering one or more series as polylines with optional markers.
PieChartPie chart rendering proportional arc segments with optional inner radius (donut).
PolarAreaChartPolar area chart rendering equal-angle segments whose radius encodes value.
RadarChartRadar (spider) chart plotting multi-axis data as filled polygonal areas.
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 bar and line series on shared categorical/value axes.

Interfaces ​

InterfaceDescription
AreaChartOptionsOptions for configuring an AreaChart.
AreaChartSeriesOptionsConfiguration for an individual area chart series.
BarChartOptionsOptions for configuring a BarChart.
BarChartSeriesOptionsConfiguration for an individual bar chart series.
BaseChartOptionsBase options shared by all chart types.
BaseTrendChartSeriesOptionsBase configuration shared by all trend chart series types.
ChartAnimationOptionsFully resolved chart animation options.
ChartAreaThe computed drawing area of a chart after padding is applied.
ChartAxisItemOptionsOptions for a single axis (x or y).
ChartAxisOptionsCombined x and y axis configuration.
ChartCrosshairOptionsFully resolved chart crosshair options.
ChartGridOptionsFully resolved chart grid options.
ChartLegendOptionsFully resolved chart legend options.
ChartPaddingChart padding with explicit top, right, bottom, and left values.
ChartTitleOptionsFully resolved chart title options.
ChartTooltipOptionsFully resolved chart tooltip options.
ChartYAxisItemOptionsY-axis specific options extending the base axis item with a left/right position.
ChordChartOptionsOptions for configuring a ChordChart.
FunnelChartOptionsOptions for configuring a FunnelChart.
GanttChartOptionsOptions for configuring a GanttChart.
GaugeChartOptionsOptions for configuring a GaugeChart.
HeatmapChartOptionsOptions for configuring a HeatmapChart.
LineChartOptionsOptions for configuring a LineChart.
LineChartSeriesOptionsConfiguration for an individual line chart series.
PaddingResolved padding with explicit top, right, bottom, and left values.
PieChartOptionsOptions for configuring a PieChart.
PolarAreaChartOptionsOptions for configuring a PolarAreaChart.
RadarChartOptionsOptions for configuring a RadarChart.
RadarChartSeriesOptionsConfiguration for an individual radar chart series.
RealtimeChartOptionsOptions for configuring a RealtimeChart.
RealtimeChartSeriesOptionsConfiguration for an individual realtime chart series.
RibbonStateState interface for a ribbon shape connecting two arc segments via quadratic curves.
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.
ScatterChartOptionsOptions for configuring a ScatterChart.
ScatterChartSeriesOptionsConfiguration for an individual scatter chart series.
StockChartOptionsOptions for configuring a StockChart.
SunburstChartOptionsOptions for configuring a SunburstChart.
SunburstNodeA node in a sunburst hierarchy with optional nested children.
TreemapChartOptionsOptions for configuring a TreemapChart.
TrendChartAreaSeriesOptionsSeries options for area-type series within a trend chart.
TrendChartBarSeriesOptionsSeries options for bar-type series within a trend chart.
TrendChartLineSeriesOptionsSeries options for line-type series within a trend chart.
TrendChartOptionsOptions for configuring a TrendChart.

Type Aliases ​

Type AliasDescription
AxisFormatTypeBuilt-in axis label format types.
BarChartMode-
BarChartOrientation-
BorderRadiusInputBorder radius expressed as a uniform number or a per-corner tuple.
ChartAnimationInputAnimation input accepting a boolean toggle or partial options object.
ChartAxisInputAxis input accepting a boolean toggle or a full axis options object.
ChartCrosshairInputCrosshair input accepting a boolean toggle or partial options object.
ChartGridInputGrid input accepting a boolean toggle or partial options object.
ChartLegendInputLegend input accepting a boolean, position string, or partial options object.
ChartOptions-
ChartTitleInputTitle input accepting a plain string or partial options object.
ChartTooltipInputTooltip input accepting a boolean toggle or partial options object.
CrosshairAxisWhich axis the crosshair tracks.
EaseNameNamed easing function identifiers.
LegendPositionPosition of the chart legend relative to the chart area.
PaddingInputPadding expressed as a uniform number or a [top, right, bottom, left] tuple.
SeriesTypeSupported series visualization types within a trend chart.
TitlePositionPosition of the chart title relative to the chart area.
TrendChartSeriesOptionsDiscriminated union of all trend chart series option types.

Functions ​

FunctionDescription
createAreaChartFactory function that creates a new AreaChart instance.
createBarChartFactory function that creates a new BarChart instance.
createChordChartFactory function that creates a new ChordChart 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.
createLineChartFactory function that creates a new LineChart instance.
createPieChartFactory function that creates a new PieChart instance.
createPolarAreaChartFactory function that creates a new PolarAreaChart instance.
createRadarChartFactory function that creates a new RadarChart 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.
createStockChartFactory function that creates a new StockChart instance.
createSunburstChartFactory function that creates a new SunburstChart instance.
createTreemapChartFactory function that creates a new TreemapChart instance.
createTrendChartFactory function that creates a new TrendChart instance.
elementIsRibbonType guard that checks whether a value is a Ribbon instance.
elementIsSankeyLinkType guard that checks whether a value is a SankeyLinkPath instance.
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.
normalizeGridNormalizes grid input into fully resolved ChartGridOptions.
normalizeLegendNormalizes legend input into fully resolved ChartLegendOptions.
normalizePaddingNormalizes a padding input into a Padding object, or returns undefined if no input.
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.
resolveEaseResolves an ease name or function to an Ease function, defaulting to easeOutCubic.
resolveFormatLabelResolves an axis format type or custom formatter into a label formatting function.