Skill
dreambase-echarts
Author Apache ECharts option (EChartsOption) JSON configs for the Dreambase renderer. Use whenever the user wants a chart, graph, plot, dashboard, or any data visualization — line, bar, pie, scatter, heatmap, sankey, treemap, sunburst, gauge, candlestick, boxplot, funnel, radar, graph/network, map, or calendar — or asks to visualize, plot, or chart data, even if they never say "ECharts". Also use when editing, debugging, or validating an existing ECharts config.
assetsevalsreferencesscripts
npx skills add DreambaseAI/skills --skill dreambase-echartsDreambase ECharts Config Authoring
Produce a single JSON object conforming to the ECharts EChartsOption shape. The Dreambase renderer consumes that object directly — the quality bar is a config that renders correctly on first try, which is why every config gets validated before it's returned.
Output contract (Dreambase renderer)
- Emit pure JSON — one option object, no surrounding JS, no comments.
- Callbacks (
formatter,symbolSizefunctions, …) are emitted as JS source strings (e.g."formatter": "(params) => ..."). The renderer's safety policy decides whether to eval them, so prefer declarative equivalents when they exist: template strings ("{b}: {d}%") andvalueFormatteroverformatterfunctions. - The host owns the chart lifecycle: it calls
chart.resize()and applies partial updates viasetOption. Never rely on attaching listeners — for breakpoint behavior usebaseOption+media(seereferences/patterns/responsive-resize.md). - Inline at most ~200 data points via
series[].data; past that, usedataset.sourceso data stays tabular and series stay declarative.
Critical rules
- Time series use
xAxis: { "type": "time" }with ISO strings or epoch ms — never a category axis of pre-formatted date strings, which breaks zooming and tooltip formatting. - Dual axes:
yAxisis an array of two configs; each series binds withyAxisIndex. An index pointing past the array renders a blank chart. - Stacking works by name: every series in one stack shares the same
stackstring. A typo silently un-stacks that series. heatmaprequires avisualMap;radarseries requireradar.indicator; without them ECharts renders nothing, with no error.- Set
tooltipandlegendon every multi-series chart unless the user opts out —trigger: "axis"for cartesian multi-series,trigger: "item"for pie/scatter. - Validate before returning: Fix every error and re-run until clean. Treat warnings as advice worth taking unless the user's request contradicts them.
Picking the chart type
Workflow
- Pick the type from the table above.
- Read the matching reference:
- Common types (line, bar, pie, scatter, heatmap, candlestick, radar):
references/core-chart-types.mdhas a working snippet to start from. - Intricate types (sankey, treemap, sunburst, tree, graph, gauge, funnel, boxplot, map, calendar): read
references/charts/<type>.md— their data schemas are easy to get subtly wrong from memory. - Bespoke or illustration-style visuals (a form no built-in series expresses, or an editorial/data-story piece): read
references/charts/custom.mdfor therenderItemcontract and the custom + pictorialBar + graphic toolkit. - Composite requirements (zoom, dual axis, stacking, small multiples, streaming, theming): the matching recipe in
references/patterns/.
- Common types (line, bar, pie, scatter, heatmap, candlestick, radar):
- When unsure of an exact option name, type, or default, look it up instead of guessing:
The index is vendored (offline, versioned to the ECharts release in
assets/option-index.json). - Author the config against
references/core-components.mdfor axes/tooltip/legend/grid/dataZoom/visualMap/dataset details. - Validate (rule above), then return the JSON.
References
references/core-chart-types.md— minimal working snippets per common type.references/core-components.md— the component cheatsheet: global options, axes, tooltip, legend, grid, dataZoom, visualMap, dataset, title, toolbox.references/charts/— one file per intricate chart type with data schema, working example, and gotchas.references/patterns/— composite recipes:time-series-with-zoom,multi-axis-combo,stacked-and-grouped,normalized-percent,small-multiples,responsive-resize,tooltip-customization,color-themes-and-visualmap,live-streaming-data.