RFC 0059 — All of WireCharts' charts in @elyra/charts
Status: implemented (2026-11-27) · Target: 0.59.0 · builds on RFC 0058 · see Decisions
Summary
@elyra/charts shipped in 0.58.0 with WireCharts' six basic charts. WireCharts
has 72. A desktop app with a Laravel half that draws a funnel, a heatmap or
a sankey on the web has to fall back to <Chart option={…}> on the
desktop, and write by hand what WireCharts already builds from a few props.
This RFC brings every one of them, as a component of its own with WireCharts' props:
<script>
import { FunnelChart, HeatmapChart, SankeyChart, GaugeChart } from "@elyra/charts";
</script>
<FunnelChart series={[60, 40, 20]} labels={["Visits", "Sign-ups", "Orders"]} />
<GaugeChart value={72} max={100} name="Load" progress />
<SankeyChart {nodes} {links} live={live.flows()} />
- One component per chart:
area-fanisAreaFanChart,combo-dual-axisisComboDualAxisChart, and so on. Each imports only its own part of ECharts, so an app still ships only what it draws. - WireCharts' props, as they are, so a Blade view and a Svelte page say
the same thing. The six from 0.58 keep the props they have, and take
WireCharts' names too (
labelsfor a pie's slices). - The options are built in JavaScript, ported from
Option.phpbuilder by builder. Formatters are real functions, so nothing isevaled: the app's content security policy stays as it is. - What 0.58 gave the six, all 72 get: the design tokens,
liveand its states, the summary and the hidden table, the keys and the app's language. - The charts that move (
ClockChart,LineRaceChart,AreaRaceChart,AudioChart) bring their behaviour too, and stop under reduced motion. - 3D (
Bar3dChart,Scatter3dChart,SurfaceChart) comes from a separate entry,@elyra/charts/gl, because it needsecharts-gland WebGL.
Motivation
- One chart vocabulary for both halves. The web and the desktop of the same app should draw the same report the same way, from the same data and the same props.
Chartwithoptionis a way out, not a way in. A funnel is ten props in WireCharts and sixty lines of ECharts option by hand, and the theme, the summary and the table are the app's to get right.- The tests are already written, in PHP. WireCharts' builders are the reference: the port can be held to them option by option.
Current state (0.58)
@elyra/charts:LineChart,AreaChart,ColumnChart,BarChart,PieChart,ScatterChartandChart.ChartBasedoes the instance, the theme, the states, the summary, the table and the keys;internal/options.jsbuilds the options as plain data.- WireCharts: 72 Blade components over
Option.php's 66 builders, and Alpine glue for the four that move. Its PHP builders mark formatters as"@@function …@@"strings and revive them withnew Function.
Design
The components
Every WireCharts component becomes <Name>Chart, PascalCase:
| Family | Components |
|---|---|
| Line | Line, LineLabels, LineLog, LineTime, LineAnnotated, LineForecast, LineBoost, LineAnimated, LineRace, Spline, SplineInverted, SplineTime, SplineBands, Streamgraph |
| Area | Area, Areaspline, AreaStacked, AreaPercent, AreaInverted, AreaStackedInverted, AreaNegative, AreaMissing, AreaGradient, AreaRange, AreaRangeLine, AreaFan, AreaRace |
| Column and bar | Column, ColumnStacked, ColumnPercent, ColumnNegative, ColumnRotated, ColumnRange, Bar, BarStacked, BarPercent, BarRange, Lollipop, Histogram, Pareto |
| Pie | Pie, Donut, PieRose, PieSemi, PieVariable, PieGradient, PieLabels, PieMonochrome |
| Scatter | Scatter, Bubble, ScatterSymbols, ScatterRegression, PackedBubble |
| Combinations | ComboLineColumn, ComboDualAxis, ComboMultiAxis |
| More | Gauge, Clock, Radar, Funnel, Heatmap, Candlestick, Boxplot, Tree, Treemap, Sunburst, Sankey, Graph, Audio |
3D (@elyra/charts/gl) |
Bar3d, Scatter3d, Surface |
The 0.58 names stay. AreaChart and ColumnChart keep stack and
percent, the same charts as AreaStacked and ColumnPercent with a prop.
The options
internal/options/ holds one module per family, each exporting the builders
of Option.php under the same names (areaFan, comboDualAxis, …). They
take the same arguments and return the same option, with these changes:
- the theme's colours and text in place of WireCharts' theme JSON;
- functions in place of
"@@…@@"strings; - the app's locale in the formatters.
A builder that needs data shaped differently (a tree's nested nodes, a
sankey's nodes and links, a candlestick's OHLC) takes it as WireCharts does.
ChartData grows the shapes it doesn't have yet: nodes, links, and a
tree.
Held to WireCharts
scripts/wirecharts-fixtures.php runs each Option.php builder on a fixture
of props and writes the options as JSON, with every function as
"@@function@@". It's checked in with the WireCharts commit it came from.
The JS tests build the same fixtures and compare. Colours and functions are
left out of the comparison, because the theme and the locale are Elyra's.
When WireCharts changes, the script runs again and the diff shows what to
port.
What moves
ClockChartticks every second, and stops when it's off screen or the window is hidden.LineRaceChartandAreaRaceChartreveal their points one by one, once.AudioChartplays the series as pitch on a button press: Web Audio, with the tooltip following the sound.- Under reduced motion, the clock shows the time without its sweep, and the race charts show the whole line at once.
3D
@elyra/charts/gl exports the three 3D charts and imports echarts-gl, which
is an optional peer dependency the app installs only if it imports that
entry. Without WebGL the 3D charts show Callout ("3D isn't available
here") and still have their summary and table.
Accessibility, the theme and the words
As RFC 0058. Each family's summary says what its chart says:
- a funnel: its stages, with how many are left at each;
- a gauge: its value out of its range;
- a sankey: its largest flows;
- a tree: its depth and breadth;
- a candlestick: open, high, low and close over the period.
The hidden table has the rows each family's data is made of. The words for
these are new elyra.charts.* keys, in English and Norwegian.
Testing
- Each builder against WireCharts' fixture (above).
- Each component: draws with its own ECharts part, and a bundle with only it has no other chart's code (the 0.58 test, run per family).
- The four that move, with fake timers; reduced motion.
@elyra/charts/gl: imported only when asked; the WebGL fallback.- A browser check of every chart, in dark and light, in the docs.
Implementation plan
- The fixture script and the fixtures;
options/split by family. - The families one by one, with their components, summaries and tables: line and area, column and bar, pie, scatter and combinations, the rest.
- The four that move.
@elyra/charts/gl.- The docs: a page per family with every chart's example, like
@elyra/ui's reference; CHANGELOG.
Open questions
Answered in Decisions.
- WireCharts Pro's charts become free here. In WireCharts, 66 of the 72
need a Pro licence.
@elyra/chartsis MIT, like the rest of Elyra, so in an Elyra app they'd be free. Recommendation: that's your call as WireCharts' owner. If they should stay paid, the alternative is that@elyra/chartsships the free six and a Pro package is installed beside it with a licence key. That's more work, and it doesn't fit "the repository is the only source". - 3D in a separate entry, with
echarts-glas an optional peer? Recommendation: yes.echarts-glis large and needs WebGL, and only an app that draws in 3D should carry it. - One component per chart, or one
<Chart kind="area-fan">? Recommendation: one per chart. It's how WireCharts reads, and it keeps the tree-shaking. Akindprop would pull every builder in. - Do the 0.58 six take WireCharts' prop names too (
labelsbesidecategoriesfor a pie)? Recommendation: yes, as aliases, so a Blade view's props work on the desktop as they are. - Held to WireCharts by fixtures from PHP, checked in? Recommendation: yes. CI then needs no PHP for the charts, and a change in WireCharts shows up when the fixtures are made again.
Not in this RFC
- WireCharts' licence check (
wirecharts:activate). - Maps (ECharts' geo), which WireCharts doesn't have either.
- Exporting a chart as PNG or SVG (RFC 0058 left it out too).
Alternatives considered
- Running WireCharts' PHP builders from Laravel and sending the option:
the desktop would draw what the server builds, but only with the server,
never offline, and with functions as strings revived by
new Function. <Chart option>and a cookbook: no new code, but every app writes the same sixty lines and gets the theme and the table wrong in its own way.
As built
- The fixtures are made by rendering each example in WireCharts' docs
catalog (the site's
App\Docs\Catalog) with WireCharts itself, in a Testbench app with every chart unlocked, and reading the option out of the HTML. So both the props and the option are WireCharts' own. Each fixture also records the component's@propsdefaults, its builder, and the ECharts parts its builder's source and its option name. - The builders are in
charts/src/internal/wirecharts/(line.js,area.js,mixed.js,columns.js,more.js), with PHP's semantics where they matter:round(), float-to-string at precision 14,array_replace_recursive,isset.calls.jsmaps each component to its builder as its Blade view does. All 72 match WireCharts' option exactly. - The components are generated (
npm run components, checked in CI):WireChart.svelteruns the call, puts the app's look over the option (wirecharts/theme.js) and hands it toChartBase, which now describes a chart from its option (describe.js: slices, flows, cells, a hierarchy, OHLC and boxplot rows, a radar's indicators, a streamgraph's points, or categories by series, skipping a range's invisible base). - ECharts 6 isn't WireCharts' ECharts 5. Two of its charts needed the
look layer to make up the difference, the builders staying WireCharts':
a piecewise
visualMapopen at both ends (area-negative) throws, so the open ends are closed far away; and a streamgraph's numeric-looking categories ("2019") are read as numbers, so they're sent as their index. - WireCharts' own surface example draws nothing: its view passes
series ?? datawithseriesdefaulting to[]. The port keeps that; the docs' example passesseries. labelson a WireCharts chart is a list (its points' names) or an object (the chart's words), as@elyra/ui'slabelsis.- Only its own builder is in the bundle: each call is a named export
(
callFunnel, …) a component imports by itself, andCALLS, the map of them all, is the tests'. With ECharts' parts only the chart's own, andecharts-glonly with@elyra/charts/gl; the bundle test checks a funnel-only app has no other chart's series, builder or call. - Found on the way: a chart's hidden data table stretched the page (0.58.0's charts too), because a table ignores the height that hid it.
Decisions
- WireCharts Pro's charts are free in
@elyra/charts, MIT like the rest of Elyra: WireCharts' owner decided so. - 3D comes from
@elyra/charts/gl, withecharts-glan optional peer. - One component per chart,
<Name>Chart. - The 0.58 six take WireCharts' prop names too, as aliases.
- Held to WireCharts by fixtures from PHP, checked in with the commit they came from.