Tools / viz_render
viz_render
Render one data-bound chart from rows or a structured data operand.
Generated from @oods/foundry 0.19.0
One of the 26 tools your assistant sees by default.
Use it when creating chart output; use artifact_certify instead to grade a normalized chart or dashboard_render for multiple panels and KPIs. Returns Vega-Lite or ECharts specs, chart identities and requested SVG/accessibility output. pattern uses bundled data and forbids explicit data/encoding/presentation overrides. Otherwise use chartType plus encodings, omit chartType for recommendations, or supply structured intent. ECharts-primary families require their matching hierarchy/network/geo operand. brand/theme controls pixels; output.includeNormalizedSpec returns the IR required by artifact_certify. Temporal rendering uses UTC. For native ECharts after JSON transport, restore currency and precision with @oods/foundry/echarts.js. Charts take inline data only; URLs, images and links in the input are refused. Full schema: oods://schemas/viz_render.input.json.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
theme | "light" | "dark" | "hc" | no | Chart token theme. HC preserves system colors and needs a forced-colors browser to resolve them. |
brand | string | no | CSS token brand for chart pixels. Omission resolves light/A. |
opacity | number | no | Constant mark opacity for Cartesian charts only; omission keeps renderer defaults. |
rows | object[] | no | Inline flat data rows. Use either rows or datasetRef. |
datasetRef | string | no | Previously cached dataset id; alternative to rows. |
hierarchy | object | no | Treemap/sunburst: {type:"nested",data:{name,value,children}} or {type:"adjacency_list",data:[{id,parentId,value}]}. See full schema. |
sankey | object | no | Sankey input: {nodes:[{name}],links:[{source,target,value}]}; links refer to node names. Use chartType:"sankey". |
chord | object | no | Chord input: {nodes:[{name}],links:[{source,target,value}]}; links refer to node names; each directed pair must be unique. |
network | object | no | Force graph input: {nodes:[{id,group}],links:[{source,target,value}]}; max 250 nodes. Use chartType:"force_graph". Full contract: oods://schemas/viz_render.input.json. |
geo | object | no | Inline geojson or topojson plus topoObjectName, rows, join, valueField; optional point/flow coordinate fields. No network fetch. Re-register echartsSpec.__registration before rendering. Read full schema. |
chartType | "bar" | "line" | "area" | "scatter" | "heatmap" | "treemap" | "sunburst" | "sankey" | "force_graph" | "choropleth" | "bubble_map" | "flow_map" | "chord" | no | Chart family for explicit mode. Cartesian charts need rows/datasetRef and encodings; other families need their named data input. Omit to suggest from rows. |
encodings | object | no | Cartesian bindings: each needs field; optional type, aggregate, title, format (d3-format), currency (ISO 4217). |
id | string | no | Optional stable identifier for the produced spec. |
name | string | no | Optional human-friendly chart title. |
description | string | no | Optional override for the synthesized accessibility description. When omitted, a non-empty description is generated from the encodings. |
strictFields | boolean | no | Warn about unresolved fields and unmatched map joins (OODS-V131/V134). Default false preserves existing behavior. |
a11yEquivalence | boolean | no | Check Vega-Lite accessible equivalents (default true). Errors stop rendering; warnings are returned. ECharts-primary scaffolds are not checked here. |
output | object | no | Options: svg, width, height, compact, echarts, includeNormalizedSpec, includeA11y, includeVegaSpec, titlePlacement (chart or figure). SVG is opt-in; compact defaults true. |
intent | object | no | Structured request: goal, measures:[{name}], dimensions:[{name}], optional chartFamily and measureRef. Uses rows or datasetRef; alternative to explicit chartType/encodings. |
pattern | "pattern:viz:bubble-distribution" | "pattern:viz:correlation-matrix" | "pattern:viz:correlation-scatter" | "pattern:viz:detail-overview-bar" | "pattern:viz:diverging-bar" | "pattern:viz:drilldown-stacked-bar" | "pattern:viz:facet-small-multiples-line" | "pattern:viz:facet-target-band" | "pattern:viz:focus-context-line" | "pattern:viz:grouped-bar" | "pattern:viz:histogram" | "pattern:viz:layered-line-area" | "pattern:viz:multi-series-line" | "pattern:viz:running-total-area" | "pattern:viz:simple-bar" | "pattern:viz:sparkline-grid" | "pattern:viz:stacked-100-bar" | "pattern:viz:stacked-area-projection" | "pattern:viz:stacked-bar" | "pattern:viz:target-band-line" | "pattern:viz:time-grid-heatmap" | "pattern:viz:waterfall" | no | Exact registered pattern identity; preserves source data and presentation. Cannot combine with chartType, data, intent or identity/presentation overrides. |
Outputs
| Name | Type | Required | Description |
|---|---|---|---|
status | "ok" | "error" | yes | Whether rendering succeeded. |
chartType | string | no | Resolved registered chart type; omitted on error. |
mode | "explicit" | "suggest" | no | Whether the chart type was supplied explicitly or chosen by the recommender. |
spec | object | no | Vega-Lite source with scoped OODS tokens, before the renderer's high-contrast quantized legend and output.width/height sizing adjustments. Use output.includeVegaSpec for the exact compiled Vega spec that reproduces the rendered chart. Scope changes alter chart content and pixel hashes. |
echartsSpec | object | no | Compiled ECharts option. Primary ECharts chart types include scoped OODS canvas, borders, labels and title chrome. Series palettes use the same scope; where no themed palette exists they retain the light palette. Formatted axes/tooltips carry JSON-safe __oodsFormat descriptors. Pass the option through restoreEChartsFormats from @oods/foundry/echarts.js before echarts.setOption; no code evaluation is required. |
normalizedSpec | object | no | The intermediate NormalizedVizSpec IR. Present only when output.includeNormalizedSpec is true. |
a11yDescription | string | no | The non-empty accessibility description carried by the spec (always synthesized when not provided). |
a11y | object | no | Structured two-part text alternative (accessible data table + narrative summary) derived from the same data source the chart renders from. Present only when output.includeA11y is true (additive; default-off keeps the wire byte-identical). An agent reads this to verify/iterate its own chart without re-deriving the data. |
suggestion | object | no | Present in suggest mode: the recommender pick that drove the chart type, with the data-aware rationale and runner-up alternatives. |
lowConfidence | boolean | no | Suggest mode only: true when no pattern matched confidently — the chartType is a low-confidence fallback rather than a positive recommendation (the previously-silent bar default, now surfaced). |
svg | string | no | Server-rendered SVG bytes, present only for output.svg:true. ECharts allocator tokens are normalized before return; Vega-Lite retains its accessible graphics roles. |
svgHash | string | no | SHA-256 of the exact returned SVG bytes. At default intrinsic dimensions and light/A scope, cartesian svgHash equals artifact_certify determinism.renderHash for the same normalized spec. Scope and dimension changes alter the hash. |
svgBytes | integer | no | UTF-8 byte length of svg. |
svgRef | string | no | Temporary pipeline reference caching exactly the svg string, with the same lifetime as specRef. |
render | object | no | Actual SVG dimensions, primary engine and rendered scope. |
specRef | string | no | Temporary reference to the produced spec for pipeline reuse (mirrors the retired chart scaffold schemaRef). |
specRefCreatedAt | string | no | ISO timestamp when the specRef was created. |
specRefExpiresAt | string | no | ISO timestamp when the specRef expires. |
contentHash | string | no | Deterministic SHA-256 (hex) over the canonicalized primary payload (the Vega-Lite spec, or the JSON-projected ECharts option for ECharts-primary types) — the content identity of exactly what specRef caches. Unlike specRef (a random, expiring cache handle), contentHash is stable across calls: the same input yields the same hash. Default-on; omitted only on error outputs. |
tokenCssRef | string | no | Content-addressed identity of the active token CSS when compact mode is enabled: tokens_build#sha256:<hex>. Use tokens_build to obtain the full CSS. |
output | object | no | Echoes the normalized output controls used by the renderer. |
errors | issue[] | no | Fatal errors (present and non-empty when status is 'error'). |
warnings | issue[] | yes | Non-fatal issues encountered during rendering. |
meta | object | no | |
vegaSpec | object | no | The exact Vega spec parsed by the renderer after legend and sizing adjustments. Present for Vega charts only when output.includeVegaSpec is true. Rendering with the bundled Vega version reproduces the SVG apart from its accessibility and stable-ID post-processing. |
A real call
Recorded by this site's harbor run, step chart, with the published OODS Foundry
0.19.0.
Its input:
{
"chartType": "bar",
"brand": "Harbor",
"theme": "light",
"rows": [
{
"warehouse": "Lakeside Distribution",
"pallets": 640
},
{
"warehouse": "North Yard",
"pallets": 760
},
{
"warehouse": "Harbor Cold Store",
"pallets": 2400
}
],
"encodings": {
"x": {
"field": "warehouse",
"type": "nominal"
},
"y": {
"field": "pallets",
"type": "quantitative"
}
},
"output": {
"includeNormalizedSpec": true,
"includeA11y": true
}
} Its result, first lines:
{
"status": "ok",
"chartType": "bar",
"mode": "explicit",
"spec": {
"$schema": "https://vega.github.io/schema/vega-lite/v6.json",
"title": "Bar chart",
"description": "Bar chart of pallets by warehouse.",
"data": {
"values": [
{
"warehouse": "Lakeside Distribution",
"pallets": 640
},
{
"warehouse": "North Yard",
"pallets": 760
},
{
"warehouse": "Harbor Cold Store",
"pallets": 2400
}
]
},
"autosize": {
"type": "fit-y",
"contains": "padding"
},
"config": {
"background": "#FFFFFF",
"font": "'DM Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
"title": {
"color": "#070B0B",
"font": "'DM Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
"fontSize": 24,
"fontWeight": 600,
"anchor": "start"
},
"axis": {
"titleColor": "#070B0B",
"titleFont": "'DM Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
"labelColor": "#4C5455",
"labelFont": "'DM Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
"gridColor": "#E1E6E7",
"domainColor": "#CFD6D7",
"tickColor": "#CFD6D7"
},
"axisX": {
"grid": false
},
"axisY": {
"grid": true,
"tickCount": {
"expr": "min(5, ceil(height / 40))"
}
},
"legend": {
"titleColor": "#070B0B",
"titleFont": "'DM Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
"labelColor": "#4C5455",