Ribbon Chart
Composition
Who's gaining and who's slipping? When market share, budget splits, or vote tallies reshuffle from one period to the next, the ribbons connecting each column let you follow a single category as it swells, shrinks, and trades places with its rivals.
The chart above is the same engine in every framework - only the integration code below differs.
When to reach for it
- Market share, budget splits, league tables. When categories trade places period to period, the ribbons make "who overtook whom, and when" the first thing readers see.
- Presenting reshuffles to a business audience. Each category keeps its colour as it swells, shrinks and swaps ranks, so the eye follows one competitor through the whole story.
- If nothing ever swaps ranks, the ribbons run parallel and an Area chart tells the same share story with less ink.
Heavy data on WebGPU Experimental
RibbonChart has an opt-in renderer="webgpu" that paints its ribbons on the GPU while axes, labels and tooltips stay on the SVG layer. It is capability-gated: on a browser without WebGPU it downgrades to canvas automatically, and getContext().renderer reports whichever actually painted.
Reveal animation
The chart wipes in from left to right on mount, revealing its marks in sequence before settling into place. Off by default - a chart opts in with the progressiveDraw prop.
The marks wipe in from left to right; axes and titles stay put. With reduced motion enabled, the chart renders fully drawn instantly.
progressiveDraw: true enables the defaults (1200 ms, easeInOutCubic). A config object tunes it:
const ref = useRef<RibbonChartHandle>(null);
<RibbonChart
ref={ref}
{...props}
progressiveDraw={{ durationMs: 2000 }}
/>;
// ref.current?.replay() re-runs the reveal on demand<RibbonChart :options="{ ...props, progressiveDraw: { durationMs: 2000 } }" /><div use:ribbonChart={{ ...props, progressiveDraw: { durationMs: 2000 } }}></div>applyRibbonChartProps(this.c.nativeElement, {
...props,
progressiveDraw: { durationMs: 2000 },
});<michi-vz-ribbon-chart id="c"></michi-vz-ribbon-chart>
<script>
const el = document.getElementById("c");
el.progressiveDraw = { durationMs: 2000 };
// el.replay() re-runs the reveal
</script>durationMsandeasing("linear", "easeOutQuad", "easeInOutCubic", or a custom(t) => tfunction) shape the sweep.autoplay: falserenders the chart fully drawn; callreplay()(React ref handle, web-component method, or the core instance) to run the reveal on demand.replayOnUpdate: truere-runs it on every data change.- Respects
prefers-reduced-motion: the chart renders fully drawn instantly.
Play through the years
The data already spans years, so there is nothing to tag. Flip on timeline and the chart's own play button and scrubber step through those years: at each step the ribbons draw only up to the active year, and playing forward smoothly extends them further as the sweep advances. Scrub backward and the ribbons retract to match. Hover only ever inspects what has actually been drawn. Off by default - nothing changes until a chart opts in.
Press the play button under the chart: it steps through the years, one snapshot at a time. Drag the scrubber to jump to any year.
const ref = useRef<RibbonChartHandle>(null);
<RibbonChart ref={ref} {...props} timeline={{ speedMs: 1000, loop: true }} />;
// ref.current?.timeline() -> play() / pause() / seek(year) / stepForward()<RibbonChart :options="{ ...props, timeline: { speedMs: 1000, loop: true } }" /><div use:ribbonChart={{ ...props, timeline: { speedMs: 1000, loop: true } }}></div>applyRibbonChartProps(this.c.nativeElement, { ...props, timeline: { speedMs: 1000, loop: true } });<michi-vz-ribbon-chart id="c"></michi-vz-ribbon-chart>
<script>
const el = document.getElementById("c");
el.timeline = { speedMs: 1000, loop: true };
// el.getTimeline() -> play() / pause() / seek(year)
</script>speedMssets the pace,loopwraps around,autoplay: truestarts on mount,showControl: falsehides the built-in bar.- The headless controller is always available:
chart.timeline()exposesplay() / pause() / toggle() / seek(period) / stepForward() / stepBack(), plusonStepandformatPeriodin the config for custom UI. - Values glide between years by default (
interpolate); setinterpolate: falsefor hard jump-cuts. Reduced motion always jump-cuts. timelinewins overprogressiveDrawwhen both are set on the same chart.
Usage
import { RibbonChart } from "@michi-vz/react";
export default () => <RibbonChart {...props} />; // props = the chart options<script setup>
import { RibbonChart } from "@michi-vz/vue";
</script>
<template>
<RibbonChart :options="props" />
</template><script>
import { ribbonChart } from "@michi-vz/svelte";
</script>
<div use:ribbonChart={props}></div>// main.ts - register the elements once
import "@michi-vz/angular";
import { applyRibbonChartProps } from "@michi-vz/angular";
// component (uses CUSTOM_ELEMENTS_SCHEMA)
// template: <michi-vz-ribbon-chart #c></michi-vz-ribbon-chart>
applyRibbonChartProps(this.c.nativeElement, props);<script type="module" src="https://cdn.jsdelivr.net/npm/@michi-vz/wc/dist/michi-vz-wc.bundle.js"></script>
<michi-vz-ribbon-chart id="c"></michi-vz-ribbon-chart>
<script>
Object.assign(document.getElementById("c"), props); // dataSet/series, title, …
</script>import { mountRibbonChart } from "@michi-vz/core";
const chart = mountRibbonChart(el, props);
chart.update(next);
chart.getContext(); // renderer-agnostic, LLM-ready
chart.destroy();API
Props are typed as RibbonChartProps in @michi-vz/core. Shared across all charts: width, height, margin, colors / colorsMapping, renderer ("svg", "canvas", or experimental "webgpu"), highlightItems, disabledItems, and the on* callbacks. onChartDataProcessed / getContext() return the renderer-agnostic ChartContext.
