Rich Output
Interactive cells can return multiple typed output artifacts. Plain print and println! still work, and richer artifacts render with shared UI components.
Output Types
Section titled “Output Types”Oxiquill renders these output kinds:
- Text from stdout, stderr, or display output.
- JSON values with structured formatting.
- Tables with sortable columns.
- Charts rendered with ECharts.
- Interactive 3D point-and-edge scenes rendered with Canvas 2D.
- Images from SVG, PNG, or JPEG data.
- Sandboxed HTML in an iframe.
- Author-declared computation outcomes.
Every artifact may have optional string id, title, and caption fields. Values received from workers are untrusted: Oxiquill validates discriminators, fields, plain-record structure, array shapes, finite numbers, row widths, MIME/base64 data, and nested values before a renderer receives them. One rejected or failing artifact shows a local diagnostic without removing valid siblings.
Output Layout
Section titled “Output Layout”Outputs stack in emission order by default. Set outputLayout: columns on a cell to let charts and images share a row when the cell is wide enough. At most two figures share a row, each at least --oq-output-column-min-width wide (default 18rem); a lone or final odd figure takes the full width. Tables, text, JSON, HTML, 3D scenes, and outcomes always use the full width, and narrow cells stack every output.
Rust + Wasm
Compare two views side by side
emit_line_chart!(&[[0, 1], [1, 3], [2, 2], [3, 5], [4, 4]], "Step", "Signal");
emit_bar_chart!(&["low", "middle", "high"], &[2, 5, 3],
options = &serde_json::json!({ "xLabel": "Band", "yLabel": "Count" }));
emit_text!("Text outputs keep the full width below the paired charts.");Waiting for the runtime to start.
Artifact Schema
Section titled “Artifact Schema”| Kind | Required fields | Optional behavior |
|---|---|---|
text | stream: "stdout" | "stderr" | "display", content: string | truncated indicates bounded content. |
json | value | Cycle-aware formatting represents BigInt explicitly; truncated indicates bounded serialized data. |
table | columns, rectangular rows | rowCount records the original size; truncated marks a preview. |
chart | Valid spec described below | Oversize/invalid charts become a local artifact error. |
scene3d | points | Optional edges, groups, axes, and camera; see 3D scenes. |
image | mime: image/png | image/jpeg | image/svg+xml, valid data | alt supplies the image alternative. |
html | html: string, sandboxed: true | Rendered with an empty sandbox, no referrer, and the restrictive CSP described below. |
outcome | state, nonblank label | One computational outcome per successful result; optional explanation, status, and diagnostics. |
Table columns contain key, label, and optional type: string, number, integer, boolean, date, datetime, null, or unknown. Every row must have exactly the declared column count.
Chart Schema
Section titled “Chart Schema”All chart specs accept optional title, xLabel, yLabel, xType, yType, legend, tooltip, and dataZoom. Axis types are value, category, time, and log. Unspecified axes default to value, except the category axis of bar charts (x for vertical, y for horizontal) and the category x axis of box plots. A heatmap always has category axes on both dimensions: its xType and yType may be omitted or set to category, while value, time, and log are rejected.
-
valuecoordinates are finite numbers, andlogcoordinates are finite numbers greater than zero. -
timecoordinates are finite epoch milliseconds or ISO-8601 strings inYYYY-MM-DDTHH:mm:ss[.sss]ZorYYYY-MM-DDTHH:mm:ss[.sss]±HH:mmform. Calendar fields and the explicit time zone must be valid. -
categorycoordinates are strings or finite numbers. For a heatmap axis with an explicitxCategoriesoryCategoriesarray, each coordinate must be an exact listed string or a safe, in-range zero-based integer index. An index resolves to the category name at that position; it is never converted into a new numeric-looking category name. -
For a heatmap axis without an explicit categories array, finite numbers and strings are normalized with
String(coordinate). Categories are inferred in first-appearance order, so values with the same normalized label, such as1and"1", share one category. X and Y are normalized independently when only one axis declares categories. -
line,scatter, andarea:series[], each with optionalnameand[x, y]points. -
bar: stringcategories[]plus series of numeric-or-nullvalues[]with matching length. -
histogram:bins[]as finite[lower, upper, count]tuples, wherelower < upperand count is non-negative. -
heatmap: optional stringxCategories/yCategoriesarrays and finite[x, y, value]cells on two category axes. -
errorbar/band: series of[x, center, lower, upper]intervals. -
boxplot: categories and precomputed[min, q1, median, q3, max]summaries. -
bubble:[x, y, size, color?]points with size and color mappings. -
field: value-axisxEdges/yEdgesand avaluesmatrix.
Empty charts and equal point domains are valid. Heatmaps report X- and Y-category counts plus the heat-value range. By default their color scale uses the actual heat values, with a 0–1 fallback only for an empty dataset; colorMin, colorMax, and colorScale override that domain (see Heatmap color scales). Charts expose a textual title/caption and bounded accessible summary or equivalent table. The implementation canvas is hidden from accessibility APIs when that equivalent is present.
Charts update their existing ECharts instance when html[data-theme] changes, preserving zoom, legend selections, and the color-range selections of heatmaps, grid fields, and color-mapped bubbles and expose a retry action after a transient renderer load failure.
Axis ranges
Section titled “Axis ranges”Use finite xMin/xMax/yMin/yMax bounds, with min smaller than max. Time bounds are epoch milliseconds; log bounds must be positive. Category axes do not accept numeric bounds. xIncludeZero/yIncludeZero are available only for value axes. Fixed bounds take precedence, but value-axis bars, histograms, and areas must include zero and cannot disable that baseline.
Data updates preserve zoom. Changing or removing authored bounds or zero inclusion resets zoom to the full domain, while retaining legend selection. Omitted bounds return to automatic scaling.
Rust line, scatter, area, bar, and histogram macros accept options = &serde_json::json!({...}) after their data arguments; heatmaps and the other chart kinds use emit_chart! with a complete spec. Options accept the public chart settings, including labels and nested style; they cannot replace the kind or data. Existing positional style arguments remain supported. See the logistic map for a fixed 0–1 range.
Linked panels and keyboard navigation
Section titled “Linked panels and keyboard navigation”Line, scatter, area, band, errorbar, and xy charts with a zoomable value, time, or log x axis accept link: { group: "residuals", zoom: true, cursor: true }. The group is required and contains 1–64 ASCII letters, digits, underscores, or hyphens. Both booleans default to true; setting one to false disables sending and receiving that interaction. Category axes, dataZoom: false, and other chart kinds reject link. XY charts retain their value/time x-axis restriction.
Groups belong to the current page, including charts emitted by separate cells. Zoom and pan share x-domain values across panels of different widths or data ranges. Each peer intersects the range with its own domain; a disjoint peer keeps its view and announces that it has no data in the selected range. Reset restores each panel’s own authored bounds or data extent. A panel that appears later joins the current group viewport. All members must use the same x-axis type, and explicit style.xFormat.unit values must match. Units are never inferred from axis labels. Invalid charts show an artifact-local diagnostic while neighboring outputs remain usable.
Cursor linking draws a line at the same x value, even between a peer’s data points. Only the panel under the pointer shows a tooltip. Chart interactions do not execute cells, and navigation clears group state. PNG and SVG exports retain each panel’s current viewport.
Focus any zoomable plot and use + or = to zoom in, - to zoom out, ← / → to pan by 10% of the visible range, and 0 to reset. The controls work without pointer hover, with or without linking. Horizontal bars navigate their category y axis; other charts navigate x. Screen readers receive the same short keyboard instructions when the plot receives focus.
These separate cells share their x viewport and cursor:
Rust + Wasm
Observations
emit_line_chart!(&[[0, 2], [20, 4], [40, 3], [60, 6], [80, 5], [100, 7]],
options = &serde_json::json!({
"link": { "group": "residuals" },
"xLabel": "Time", "yLabel": "Voltage",
"style": { "xFormat": { "unit": "s" }, "yFormat": { "unit": "V" } }
}));Run the cell to show its output.
Rust + Wasm
Residuals
emit_line_chart!(&[[10, -1], [30, 1], [50, -2], [70, 2], [90, 0]],
options = &serde_json::json!({
"link": { "group": "residuals" },
"xLabel": "Time", "yLabel": "Residual",
"style": { "xFormat": { "unit": "s" }, "yFormat": { "unit": "V" } }
}));Run the cell to show its output.
Histogram intervals
Section titled “Histogram intervals”Histograms use a numeric x axis: each rectangle spans its exact [lower, upper) interval, including negative boundaries, unequal widths, and gaps. Overlapping bins are rejected; non-overlapping bins need not be sorted.
The default mode: 'count' uses count as height. With mode: 'density', height is count / (upper - lower) so area represents count, not normalized probability. The y label, tooltip, and summary identify the mode. A value y axis starts at zero; a log y axis uses its positive visible lower boundary and requires positive heights, so its rectangle areas are not counts.
Migration: explicit histogram xType: 'category' remains accepted but is normalized to value. Prefer omitting it or specifying value. Bin counts and boundaries are never rounded in the data.
Rust + Wasm
Unequal-width histogram
let bins = [[-1.0, -0.5, 2.0], [0.0, 2.0, 4.0]];
emit_histogram!(&bins, options = &serde_json::json!({
"mode": "density", "xLabel": "Measurement", "yLabel": "Frequency"
}));Run the cell to show its output.
Display Defaults
Section titled “Display Defaults”Bar, histogram, and area charts include zero on their value amount axis (x for horizontal bars, otherwise y); line and scatter charts fit the data. Negative amounts also use zero as their baseline. When data on a value amount axis spans zero, a zero line marks the baseline; it remains when series are hidden and is clipped while zooming. Grid fields omit it because both of their axes are coordinates; add a line annotation at 0 when a field needs one. A logarithmic y axis uses the lower axis boundary, so bar lengths and filled areas cannot be compared as amounts. Migration: bar and histogram yType: 'time' is now rejected; use a value axis for amounts or a line/scatter chart for timestamps.
Numeric notation is selected per axis from the data range and remains stable while zooming. Four-digit years have no grouping separators. Large and tiny ranges use scientific notation; a narrow range around a large offset retains ordinary notation. Ticks retain enough digits to distinguish values. Tooltips, color scales, and summaries use six significant digits; JSON and table CSV retain original values. Negative zero displays as 0.
For a numeric range spanning zero, data values whose absolute magnitude is at most Number.EPSILON times the largest absolute value display as 0. This removes roundoff such as sin(π) in a −1 to 1 range; axis ticks and logarithmic coordinates retain small values. Time ticks adapt to the zoomed interval, retain milliseconds where needed, and show dates even when overlap handling hides a calendar boundary.
Migration: time-axis ticks, tooltips, and summaries now use UTC rather than the reader’s local timezone. Inputs still require epoch milliseconds or ISO-8601 strings with an explicit timezone.
Titles appear once above the plot. When artifact and spec titles differ, the spec title becomes a subtitle. When both titles are omitted, empty, or whitespace-only, the heading is visually hidden and the chart kind remains its accessible name. Captions remain visible. HTML legends use keyboard-operable series buttons, with 25 series per page. Unnamed series receive default names. Long axis and category labels are shortened; summaries retain axis names and tooltips retain category and series names. Category labels rotate before thinning. Split charts with many long category names; use orientation: "horizontal" for long category names.
The fixed eight-color palette is shared across light and dark themes. On default backgrounds, adjacent colors (including the wrap to the first color) meet OKLab distance 15 in normal vision and 8 in protanopia, deuteranopia, and tritanopia simulations; each color meets 3:1 background contrast. This does not guarantee every pair of series is distinguishable. Palette reuse changes line patterns or scatter symbols; split charts with more than eight series when possible. Authors should check custom palettes for background contrast and color-vision differences. Heatmaps, grid fields, and bubble color mappings use a sequential, single-hue gradient with monotone lightness by default; diverging heatmaps use a three-color gradient around their center.
For series with 100,000 points, ordinary lines with strictly increasing value/time x coordinates and a value y axis use LTTB display sampling. Steps, smooth lines, explicit point markers, trajectories, and area charts keep their original rendering. Tooltips on sampled lines describe selected original points; zooming recomputes the display from the original data. Scatter series of at least 10,000 points use large rendering for filled symbols at least 4 pixels wide; tiny, empty, and hidden symbols keep normal rendering, and bubbles retain point-specific sizes and colors. Summaries and data tables use original values, and the existing 10,000-row table/CSV limit still applies. Neither optimization changes worker output, validation, or authored statistics.
Persistent Output and Chart Styles
Section titled “Persistent Output and Chart Styles”The last successful output stays visible while a cell reruns, including the 150ms reactive debounce. A small updating indicator does not move the layout. Failed reruns keep that output alongside an error and a Retry cell action; cancellation and invalid inputs also retain it. Success replaces the result and clears the error. Use explicit artifact IDs when an output sequence changes dynamically: IDs retain identity across insertions, duplicate IDs receive occurrence numbers, and artifacts without IDs are matched by kind and occurrence.
Compatible charts update the existing canvas and ECharts instance, preserving the reader’s zoom window. Initial and data-update transitions use 180ms with cubicOut easing. Structural changes replace chart options on the same instance; Starlight light/dark theme changes merge colors and typography without resetting reader interactions. A chart update failure keeps the last successful visualization and summary with a local retry action. Reduced-motion preferences disable chart and updating-indicator animation, even when an author requests animation.
Chart specs accept an optional nested style object:
interface ChartPalette { light?: readonly string[]; dark?: readonly string[];}interface BaseChartStyle { height?: number; palette?: ChartPalette; showGrid?: boolean; animation?: boolean; animationDurationMs?: number;}interface LineChartStyle extends BaseChartStyle { lineWidth?: number;}interface ScatterChartStyle extends BaseChartStyle { symbolSize?: number;}Line and area charts use LineChartStyle, scatter charts use ScatterChartStyle, and bar, histogram, and heatmap charts use BaseChartStyle.
| Field | Allowed values and default |
|---|---|
palette | At least one of light or dark; each supplied theme has 1–12 unique #RGB or #RRGGBB colors. Heatmaps require at least two. Colors are compared after expanding shorthand and ignoring case. |
showGrid | Boolean; default true. |
height | Integer from 200 to 800 pixels. Default 360; heatmaps automatically use 240–720 pixels based on row count. |
animation | Boolean; default true, subordinate to reduced motion. |
animationDurationMs | Integer from 0 to 2,000; default 180 for both initial and update animation. |
lineWidth | Finite number from 1 to 8; default 2.25. Line and area only. |
symbolSize | Finite number from 2 to 32; default 7. Scatter only. |
Palettes color series, or the visual-map gradient for heatmaps. A missing theme palette uses the Oxiquill default for that theme. Chart chrome and typography follow Starlight. Unknown nested fields, fields for another chart kind, raw ECharts options, callbacks, formatters, and HTML are rejected. Style contributes to the normal artifact byte budget; it does not bypass output limits.
Every existing Rust chart macro signature remains valid. These overloads add a final JSON-serializable style argument, such as &serde_json::json!({ "lineWidth": 3 }):
emit_line_chart!(series, style)emit_line_chart!(series, x_label, y_label, style)emit_scatter_chart!(series, style)emit_scatter_chart!(series, x_label, y_label, style)emit_bar_chart!(categories, values, style)emit_histogram!(bins, style)emit_heatmap!(data, style)emit_line_plot!(points, x_label, y_label, style)The macro serializes the argument into spec.style; normal chart validation enforces the same contract.
Numeric formats
Section titled “Numeric formats”Set style.xFormat or style.yFormat on value/log axes; heatmaps, grid fields, and bubbles use style.valueFormat for their color values. The same settings format ticks, pointers, tooltips, and summaries. Category and time axes retain their own formatting.
Each format accepts significantDigits (integer 1–17), fractionDigits (integer 0–20), unit (text), and notation (auto, standard, scientific, or si). The two precision fields are mutually exclusive. Fixed decimals keep trailing zeros and may round small values to zero; negative zero displays as zero. Without overrides the default formatting remains in effect. Removing a format restores it.
Units follow numbers; axis names remain in xLabel/yLabel. SI chooses one prefix from the data range (10⁻²⁴ through 10²⁴), including rounding at prefix boundaries, and falls back to scientific notation outside that range. Formatting never changes stored values. No callbacks, format strings, HTML, or raw ECharts options are accepted.
Rust + Wasm
Voltage measurements
let points = [[0.0, 1500.0], [1.0, 2400.0]];
emit_line_chart!(&points, "Time", "Voltage", &serde_json::json!({
"xFormat": { "fractionDigits": 1, "unit": "s" },
"yFormat": { "significantDigits": 3, "notation": "si", "unit": "V" }
}));Run the cell to show its output.
Series identity and style
Section titled “Series identity and style”Series in every chart kind with series[] accept an optional non-empty, unique id. Stable IDs preserve identity and legend selection when reordering or renaming series within the same result. A new successful cell result starts with all series visible. Names are display labels; even same-named series can be selected independently. Without IDs, identity follows the series index. Adding or removing series does not reset zoom. Default palette colors still follow authored order; use explicit colors when a series needs a fixed color.
Set series.style.color to a #RGB/#RRGGBB string or { light, dark } with at least one theme. An omitted theme uses the chart palette. Line/area series also accept lineType (solid/dashed/dotted), step (false/start/middle/end), smooth (boolean), symbol, and showSymbol. Scatter and bubble series support color and symbol; bar, error bar, band, and box plot series support color. Symbols are circle/emptyCircle/rect/triangle/diamond/none.
Smooth and step cannot both be enabled. Lines remain unsmoothed by default. Explicit patterns and symbols override palette cycling, and explicit showSymbol overrides isolated-point detection. Removing settings restores defaults. Existing chart-level lineWidth and symbolSize continue to control sizes.
Rust + Wasm
Measured and reference series
let series = serde_json::json!([
{ "id": "measured", "name": "Measurement", "points": [[0, 1], [1, 2]],
"style": { "color": { "light": "#3987e5", "dark": "#9085e9" }, "symbol": "diamond", "showSymbol": true } },
{ "id": "reference", "name": "Reference", "points": [[0, 1.5], [1, 1.5]],
"style": { "lineType": "dashed", "step": "end" } }
]);
emit_line_chart!(&series, "Observation", "Value");Run the cell to show its output.
Resource Limits
Section titled “Resource Limits”Producers enforce limits inside each language worker before postMessage; the main thread independently validates the bounded response again. Limits are UTF-8 byte limits and are cumulative for each run where noted:
| Resource | Limit | Over-limit result |
|---|---|---|
| Artifacts | 100 per run | Additional artifacts are rejected locally. |
| stdout or stderr | 1 MiB per stream | Captured text is retained only to the limit and marked truncated. |
| Text, serialized JSON, HTML | 1 MiB per artifact | Text/JSON may use truncated: true; HTML is rejected. |
| Table | 10,000 rows and 100 columns | A bounded table may use truncated: true and rowCount. |
| Chart | 100,000 total points/bins/cells | Artifact-local error. |
| Chart annotations | 100 per chart; one-line labels up to 256 bytes | Artifact-local error. |
| Image | 10 MiB decoded bytes | Artifact-local error. |
| All validated output | 16 MiB per run | Artifacts exceeding the remaining budget are rejected locally. |
| Complete worker response | 16 MiB | Later artifacts are omitted before worker-to-page transfer. |
| Worker error | 16 KiB | The UTF-8 message is truncated. |
| Artifact diagnostic | 8 KiB each; 64 KiB per run | Diagnostics are truncated within both limits. |
truncated: true is valid only for text, JSON, and table artifacts. Chart, image, and HTML artifacts are never silently truncated. Invalid/cyclic/over-deep JSON, ragged tables, non-finite chart values, invalid base64/MIME pairs, or unsafe structural records cannot crash the cell component. Execution results contain only outputs; stream text and JSON values are artifacts rather than duplicate top-level fields.
Chart images
Section titled “Chart images”Charts narrower than 36rem use one action row: Data, Reset view (when available), and Export ▾. Export offers the same PNG/SVG downloads as wide charts. The chart container determines this layout, even inside a wide page. Press Escape or click outside a disclosure to close it and return focus to its trigger.
Every legend entry offers Only this series, and Show all series restores every series across all legend pages. Toggling every series off is allowed. Narrow charts with more than six legend entries collapse them into Series (selected/total); open it to reach the same actions and 25-per-page pagination. Theme, zoom/reset, and export preserve selection. The summary states how many series are visible; the data table and CSV retain hidden series with a Visible column, subject to the existing row limit.
Rust + Wasm
Twelve series
let series: Vec<_> = (0..12).map(|i| serde_json::json!({
"id": format!("series-{i}"), "name": format!("Series {}", i + 1),
"points": [[0, i], [1, i + 2], [2, i + 1]]
})).collect();
emit_chart!(serde_json::json!({ "kind": "line", "title": "Twelve series", "series": series }));Waiting for the runtime to start.
Show data as a table exposes the original values, including hidden series, histogram boundaries and counts, heatmap coordinates, interval bounds, box plot statistics, bubble sizes and colors, and grid-field cell boundaries. Whole epoch milliseconds on time axes appear as the UTC ISO-8601 instants the chart displays. Conversion occurs only when opened and retains at most 10,000 rows; totals and truncation are shown. The table supports keyboard sorting, paging, and CSV download. Series buttons show their selection with aria-pressed and use color, line pattern, and symbols. Reset zoom restores the authored full range without resetting series selections. These controls are usable with the keyboard; chart summaries remain available to assistive technology.
Use Save PNG or Save SVG to download the current chart with its theme, zoom, series selection, and color range. PNG uses twice the plot’s width and height in pixels; SVG retains the plot’s logical dimensions. Both include the plot background and legend, without animation, title, or caption. Saving uses a temporary renderer and does not replace the displayed chart.
Authors may select style: { renderer: "svg" } in a chart spec, including through Rust chart style arguments and Python display_chart. The default remains "canvas". SVG provides vector output for scaling and printing; it is not always faster for large datasets. Print output retains the chart and caption while hiding action buttons.
CSV Copy Safety
Section titled “CSV Copy Safety”Save all retrieved rows as CSV downloads every retained row in the current sort order, across all pages. Copy visible rows as CSV copies only the current page. When a result is truncated, the download contains only the retrieved portion, not the larger reported row count. Downloads work without clipboard access and preserve original numeric values. Downloaded files are UTF-8 with a byte order mark so spreadsheet applications such as Excel detect the encoding of non-ASCII text; copied CSV text has no byte order mark.
Tables display every digit of integers up to ±9,007,199,254,740,991 (Number.MAX_SAFE_INTEGER), the largest range in which every integer is exact. Larger values and non-integers use six significant digits, with scientific notation at absolute values of at least 1e6 or below 1e-4. Negative zero displays as 0. Grouping separators appear only when a column contains an absolute value of at least 10,000, consistently across pages. Hover a numeric cell to inspect its original value. Sorting and CSV use original values.
The default table action copies visible rows as spreadsheet-safe CSV. String headers or cells whose first meaningful character is =, +, -, @, tab, or carriage return receive a leading apostrophe before RFC-style comma/quote/line-break escaping. This deterministic convention prevents common spreadsheet applications from evaluating string data as a formula. Numeric values remain numeric, so a genuine number such as -42 is copied as -42.
Execution result migration
Section titled “Execution result migration”Breaking change: execution results now require an outputs array. Top-level stdout/stderr/value/plots and the public PlotSpec/LinePlotSpec types have been removed. JsonArtifact.value and input value fields remain supported.
Previously, an explicit outputs field took precedence even when empty; only its absence triggered conversion in stdout, stderr, value, plots order. Legacy-only results and non-array outputs now produce a regeneration diagnostic. Obsolete fields alongside an outputs array are ignored.
const result = { outputs: [ { kind: 'text', stream: 'stdout', content: 'Printed output' }, { kind: 'text', stream: 'stderr', content: 'Diagnostic output' }, { kind: 'json', value: { answer: 42 } }, { kind: 'chart', spec: { kind: 'line', series: [{ points: [[0, 1]] }] } } ]};Rust early returns must also supply explicit artifacts. Normal output still uses println! and emit_*.
return Ok(CellOutput { outputs: vec![OutputArtifact::Text(TextArtifact { stream: "stdout", content: "Early return".to_owned(), truncated: false, })],});The optional doc-rust helper crate also removes PlotSpec/LinePlot/line_plot. Convert SeriesPoint explicitly to [f64::from(point.n), point.x] and pass the coordinates to emit_line_chart!. The compatibility macro emit_line_plot! remains available.
Output order: Rust emits captured stdout followed by artifacts in emit order; Python emits stdout, stderr, display artifacts, automatically collected matplotlib figures, then the final value; Haskell emits stdout text, Oxiquill.Output artifacts, and stderr text in the order they are written. Python omits an implicit final JSON value for None or an empty string. Explicit JSON artifacts retain null, empty strings, false, and zero. Stream capture does not interleave with display calls.
After upgrading, regenerate the runtime with pnpm exec oxiquill docgen --wasm dev or the production pnpm build. Do not edit generated files directly.
Python Display Helpers
Section titled “Python Display Helpers”Python cells include display helpers:
display(value)chooses JSON, table, image, HTML, or text output from the value.display_json(value)emits JSON.display_html(html)emits sandboxed HTML.display_table(rows_or_dataframe)emits a table.display_scene3d(points, ...)emits an interactive 3D point scene.display_image(data, mime)emits SVG, PNG, or JPEG image data.
The runtime also understands common rich representations such as pandas DataFrames and Series, matplotlib figures, _repr_mimebundle_, _repr_json_, _repr_html_, _repr_svg_, _repr_png_, and _repr_jpeg_.
Display migration: matplotlib starts each cell with the chart palette, sans-serif text, light grid lines, fewer frame lines, and a white background. Figures remain white paper in dark mode. Override matplotlib.rcParams inside the cell, or call matplotlib.rcdefaults() before creating figures to restore upstream defaults.
Each cell resets style settings before applying these defaults, so a previous cell’s plt.style.use("dark_background") does not affect it. Grid lines also appear over images from imshow; call ax.grid(False) for photographs and heatmaps when you do not want that overlay.
Figure titles and axis labels supply image alternative text. SVG text uses browser fonts (svg.fonttype: 'none'), including Japanese fallback fonts installed on the reader’s device. SVG larger than 10 MiB falls back to PNG at 150 DPI with a stderr diagnostic. PNG rendering needs fonts in the Python environment to draw Japanese glyphs. Image and cumulative run budgets still apply; oversized PNG output produces an artifact error.
display_chart(spec, *, id=None, title=None, caption=None) emits any of the supported interactive chart kinds using only dict/list data, without pandas. Pass style inside the spec and artifact metadata separately.
display_line(df, *, x, y, id=None, title=None, caption=None, style=None) builds a line chart from DataFrame columns. y is a column name or a nonempty list of distinct column names. Row and column order are preserved, with at most 100,000 points across all series. X values may be numbers, string categories, or timezone-aware datetimes; Y values must be finite numbers. Datetimes become UTC epoch milliseconds. Missing values, NaN, infinity, NaT, and naive datetimes produce a local error identifying the row position and column. Valid neighboring outputs remain visible; missing values are never silently connected.
display_chart({ "kind": "area", "series": [{"points": [[0, 1], [1, 2]]}], "style": {"animation": False},}, id="area", title="Measurements", caption="Two samples")
import pandas as pdvalues = pd.DataFrame({"time": [0, 1], "a": [1, 2], "b": [3, 4]})display_line(values, x="time", y=["a", "b"], title="Two series")Python + Pyodide
Python table, matplotlib, HTML, and JSON outputs
import pandas as pd
import matplotlib.pyplot as plt
scores = pd.DataFrame({"label": ["alpha", "beta", "gamma"], "score": [3, 5, 4]})
display(scores, title="Pandas table")
display_json({"status": "ok", "rows": len(scores)}, title="Summary")
display_html("<p><strong>Sandboxed HTML</strong> emitted from Python.</p>", title="HTML")
plt.bar(scores["label"], scores["score"])
_ = plt.title("Scores")
_ = plt.xlabel("label")
_ = plt.ylabel("score")Run the cell to show its output.
Rust Output Macros
Section titled “Rust Output Macros”Rust cells use explicit emit_* macros. Supported macros include:
emit_scene3d!for 3D point scenes.emit_text!emit_json!emit_html!emit_svg!andemit_image_svg!emit_png_base64!andemit_image_png!emit_table!,emit_table_with_columns!, andemit_records_table!emit_chart!,emit_area_chart!,emit_line_chart!,emit_scatter_chart!,emit_bar_chart!,emit_histogram!, andemit_heatmap!emit_line_plot!for compatibility with the original line-plot helper; new code should convert coordinates explicitly and useemit_line_chart!.
emit_chart!(spec) accepts all supported chart kinds. Optional metadata = ... supplies artifact id/title/caption, separately from spec title/xLabel/yLabel; the artifact title takes display precedence. Null metadata fields are omitted, and other metadata fields produce a local diagnostic. emit_table!, emit_table_with_columns!, and emit_records_table! accept the same trailing metadata = ... with id/title/caption; a table id lets declarative tests select the table with artifact: instead of its output position. emit_area_chart! accepts the same points/series, axis labels, trailing style, and options = ... forms as line charts. Existing macro argument forms remain supported. An invalid spec produces a local diagnostic while valid neighboring outputs remain visible.
emit_chart!(serde_json::json!({ "kind": "area", "title": "Spec title", "xLabel": "Time", "yLabel": "Value", "series": [{ "points": [[0, 1], [1, 2]] }], "style": { "animation": false }}), metadata = serde_json::json!({ "id": "measurements", "title": "Measurement report", "caption": "Two samples"}));emit_area_chart!(&[[0, 1], [1, 2]], "Time", "Value");Rust + Wasm
Rust table, chart, JSON, SVG, and HTML outputs
let rows = vec![
serde_json::json!({"label": "alpha", "score": 3}),
serde_json::json!({"label": "beta", "score": 5}),
serde_json::json!({"label": "gamma", "score": 4}),
];
let columns = vec![
serde_json::json!({"key": "label", "label": "Label", "type": "string"}),
serde_json::json!({"key": "score", "label": "Score", "type": "integer"}),
];
let heatmap = [[0, 0, 1], [1, 0, 3], [0, 1, 2], [1, 1, 4]];
emit_json!(&serde_json::json!({"status": "ok", "rows": rows.len()}));
emit_records_table!(&rows);
emit_table_with_columns!(&columns, &rows);
emit_bar_chart!(&["alpha", "beta", "gamma"], &[3, 5, 4], &serde_json::json!({
"palette": { "light": ["#7c3aed"], "dark": ["#c4b5fd"] },
"animationDurationMs": 180
}));
emit_heatmap!(&heatmap);
emit_svg!(
r##"<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 48"><rect width="160" height="48" fill="#ecfeff"/><circle cx="32" cy="24" r="14" fill="#0f766e"/><rect x="64" y="12" width="72" height="24" rx="4" fill="#2563eb"/></svg>"##,
"Simple generated SVG"
);
emit_html!(r#"<p><strong>Sandboxed HTML</strong> emitted from Rust.</p>"#);Run the cell to show its output.
Haskell Output
Section titled “Haskell Output”Haskell cells import the bundled Oxiquill.Output module to emit JSON values, tables, and chart specs. It depends only on GHC’s base package. Build values with JsonValue constructors, because show is not a JSON encoder. Structured output is interleaved with putStrLn text in write order. See structured output for the frame format and limits. This cell emits a small grid field with one missing cell:
Haskell + WASI
haskell-grid-field
import Oxiquill.Output
let edges values = JsonArray (map JsonNumber values)
displayChart (JsonObject
[("kind", JsonString "field"), ("xEdges", edges [-2, 0, 3]),
("yEdges", edges [-1, 1]),
("values", JsonArray [JsonArray [JsonNumber 2, JsonNull]])])Run the cell to show its output.
Chart Kinds and Annotations
Section titled “Chart Kinds and Annotations”These kinds and options extend the chart schema. Every spec works unchanged through Rust emit_chart!, Python display_chart, and Haskell displayChart; the examples use whichever language keeps them short.
Mixed XY layers
Section titled “Mixed XY layers”Use kind: "xy" with an ordered layers array. Each layer requires a unique, nonempty id and a kind of line, scatter, or band; name and the corresponding series style are optional. Line/scatter use [x, y]; bands use [x, center, lower, upper] and the existing interval/gap rules. Layers draw in array order, so place a background band first.
All layers share value/time X and value/log Y axes (both default to value), bounds, formats, and annotations. Chart style also accepts lineWidth and symbolSize. Per-layer axes and stacking are unsupported. The 100,000-item chart limit counts all layers together, including one item per empty layer. Tables expose layer IDs, kinds, and original coordinates/endpoints; legends and exports retain layer identity through updates.
Move Offset to compare unconnected samples with the dashed reference and its uncertainty band.
Rust + Wasm
mixed-xy-layers
let samples: Vec<[f64; 2]> = (0..=4).map(|i| {
let x = f64::from(i);
[x, x + offset]
}).collect();
emit_chart!(serde_json::json!({
"kind": "xy", "title": "Reference and samples", "xLabel": "X", "yLabel": "Y",
"xMin": 0, "xMax": 4, "yMin": -1, "yMax": 5,
"annotations": [{ "kind": "line", "axis": "y", "value": 2, "label": "Threshold" }],
"layers": [
{ "id": "uncertainty", "kind": "band", "name": "Uncertainty", "style": { "color": "#6688bb" },
"points": [[0, 0, -0.5, 0.5], [2, 2, 1.5, 2.5], [4, 4, 3.5, 4.5]] },
{ "id": "reference", "kind": "line", "name": "Reference", "style": { "lineType": "dashed", "color": { "light": "#225588", "dark": "#88bbff" } },
"points": [[0, 0], [4, 4]] },
{ "id": "samples", "kind": "scatter", "name": "Samples", "style": { "symbol": "diamond", "color": "#cc6633" },
"points": samples }
]
}));Waiting for the runtime to start.
Haskell + WASI
haskell-mixed-xy
let point = JsonArray [JsonInteger 0, JsonInteger 1]
layer = JsonObject [("id", JsonString "samples"), ("kind", JsonString "scatter"),
("points", JsonArray [point])]
displayChart (JsonObject [("kind", JsonString "xy"), ("layers", JsonArray [layer])])Run the cell to show its output.
Stacked charts
Section titled “Stacked charts”Bar and area series accept a nonempty stack group. Positive and negative values accumulate separately from zero on a value axis. Missing bar values do not contribute. Area series in each group must have identical, ordered X coordinates; numeric/time coordinates must increase. Tooltips and data tables retain the individual values. Percent normalization is not performed.
Rust + Wasm
stacked-charts
let series = serde_json::json!([
{ "name": "First", "stack": "total", "points": [[0, 2], [1, -2]] },
{ "name": "Second", "stack": "total", "points": [[0, 3], [1, -3]] }
]);
emit_area_chart!(&series, "Observation", "Amount");
emit_bar_chart!(&["A", "B"], &serde_json::json!([
{ "name": "First", "stack": "total", "values": [2, -2] },
{ "name": "Second", "stack": "total", "values": [3, null] }
]));Run the cell to show its output.
Horizontal bars
Section titled “Horizontal bars”Set bar orientation: "horizontal" to use a numeric x axis and category y axis. Labels, formats, and bounds refer to screen axes. The first category appears at the top. Missing values, multiple series, and stack groups work in either orientation.
Rust + Wasm
horizontal-bars
emit_bar_chart!(&["North America", "South America", "Europe"], &[12, -4, 8],
options = serde_json::json!({ "orientation": "horizontal", "xLabel": "Change", "yLabel": "Region" }));Run the cell to show its output.
Error bars and interval bands
Section titled “Error bars and interval bands”Use errorbar or band with [x, center, lower, upper] points satisfying lower <= center <= upper. Set all three Y values to null for a gap. Bands connect adjacent valid points with straight segments and require increasing value/time/log X coordinates. Y uses value or log; log intervals must be positive. Statistical estimation belongs in the cell. A single isolated band point is shown as an interval glyph. Chart and series colors follow the existing styles; interval charts also accept chart-level lineWidth.
Python + Pyodide
interval-charts
for kind in ("errorbar", "band"):
display_chart({"kind": kind, "xLabel": "Observation", "yLabel": "Estimate",
"series": [{"name": "Estimate and interval", "points": [
[0, -3, -5, -2], [1, 0, -2, 3], [2, 4, 3, 6]]}]})Run the cell to show its output.
Reference lines and ranges
Section titled “Reference lines and ranges”Use annotations for axis-coordinate lines and ranges. Annotations do not expand axis extents and are clipped to the viewport. Empty charts can display annotations with explicit axis bounds. Categories reference an existing name or index; time coordinates use the chart time contract, and log positions must be positive. Limit: 100 annotations, each label a single line of at most 256 UTF-8 bytes. Line styles accept hex color, lineType (solid/dashed/dotted), and width (0.5–4); range styles accept hex color and opacity (0–1).
Python + Pyodide
chart-annotations
display_chart({"kind": "line", "xMin": 0, "xMax": 10, "yMin": 0, "yMax": 1,
"series": [], "annotations": [
{"kind": "line", "axis": "y", "value": 0.5, "label": "Threshold"},
{"kind": "range", "axis": "x", "from": 2, "to": 4, "label": "Window"}]})Run the cell to show its output.
Heatmap color scales
Section titled “Heatmap color scales”Use colorMin/colorMax to fix the color domain across reruns. colorScale: "diverging" places center (default 0) at the middle color, even with asymmetric explicit bounds. Automatic bounds are symmetric about the center; each explicit bound takes precedence. The center must lie strictly inside the resulting domain. Out-of-range values saturate at endpoint colors. Empty scales use 0–1 or center ±1; constant sequential domains use the middle color. style.palette owns the colors; diverging palettes require an odd number of at least three colors. Changing the authored domain resets the color-range selection; theme changes preserve it.
Python + Pyodide
heatmap-color-scales
display_chart({"kind": "heatmap", "colorScale": "diverging",
"colorMin": -2, "colorMax": 8, "center": 0,
"data": [[0, 0, -2], [1, 0, 0], [2, 0, 8]]})Run the cell to show its output.
Box plots
Section titled “Box plots”A boxplot accepts precomputed [min, q1, median, q3, max] values, one per category per series. Values must be finite and ordered; null denotes a missing box. The Y axis accepts value or log (all five statistics must then be positive). Authors compute the statistics and explain the whisker definition. No raw-sample aggregation or separate outlier collection is performed.
Python + Pyodide
boxplot-charts
display_chart({"kind": "boxplot", "categories": ["First", "Second"],
"series": [{"name": "Measurements", "values": [
[-5, -3, -2, 0, 4], [1, 2, 3, 4, 8]]}]},
caption="Whiskers show the observed minimum and maximum.")Run the cell to show its output.
Bubble charts
Section titled “Bubble charts”Bubble points are [x, y, size] or [x, y, size, color]. Sizes are finite and nonnegative; the default maps area proportionally, with diameter 0–40px and the largest supplied size as the upper domain. Zero is invisible. sizeMapping accepts positive maxValue, minPixels, maxPixels (0 <= min < max <= 100), and scale: "area" | "radius". Positive values are clamped to the requested pixel range; a positive constant domain uses the maximum diameter. Color values require explicit colorMapping: { min, max, palette? }; values outside the range saturate. Missing/null color uses the series color. style.palette colors series; colorMapping.palette owns the continuous color gradient. Large mode is disabled to preserve point-level mappings.
Python + Pyodide
bubble-charts
display_chart({"kind": "bubble", "sizeMapping": {"maxValue": 100},
"colorMapping": {"min": 0, "max": 10},
"series": [{"name": "Observations", "points": [
[0, 2, 25, 2], [1, 3, 100, 8], [2, 1, 50, None]]}]})Run the cell to show its output.
Grid fields on value axes
Section titled “Grid fields on value axes”A field uses strictly increasing finite xEdges and yEdges and a row-major values matrix: rows index Y intervals, columns index X intervals. Its shape is (yEdges.length - 1) × (xEdges.length - 1). Null cells remain transparent and count toward the 100,000-cell limit. Empty fields use three empty arrays. Both axes are value axes; the default domain is the outer grid boundary, and zoom clips the exact cell rectangles. Nonuniform spacing is preserved. Colors use a sequential scale; tables retain boundaries and original cell values. There is no interpolation, contouring, or arbitrary mesh support. The categorical heatmap contract is unchanged.
Python + Pyodide
grid-field-charts
from math import sin, cos
x_edges = [-3, -1, 0, 0.5, 2, 4]
y_edges = [-2, -0.5, 0, 1, 3]
values = [[sin((x0 + x1) / 2) * cos((y0 + y1) / 2)
for x0, x1 in zip(x_edges, x_edges[1:])]
for y0, y1 in zip(y_edges, y_edges[1:])]
display_chart({"kind": "field", "xEdges": x_edges, "yEdges": y_edges,
"values": values, "xLabel": "X", "yLabel": "Y"})Run the cell to show its output.
When to Use Rich Output
Section titled “When to Use Rich Output”Use stdout for short explanatory text. Use JSON when readers need the exact structured value. Use tables for comparable records, charts for trends or distributions, images for generated visuals, and sandboxed HTML only when the output needs markup that cannot be represented by the other artifact types.
Copy, sort, pagination, validation, running, completion, and failure states are keyboard-operable and announced with localized English/Japanese labels. Sandboxed HTML intentionally has no script or same-origin permission, sends no referrer, and blocks external subresources by default; see Support and Security for the exact policy and trust boundary.
Table interaction state is scoped to one execution result. A new result resets the page, sort, and copy status. Rerenders of the same result preserve a compatible sort and page, but row shrinkage stores the clamped page and a removed or replaced sorted column clears the sort.
Column formats and computation outcomes
Section titled “Column formats and computation outcomes”Tables and charts share NumberFormat: significantDigits (1–17) or fractionDigits (0–20), never both; notation (auto, standard, scientific, si); and a plain-text unit. ChartNumberFormat remains an alias. Standard notation never uses an exponent; scientific always does except for zero. SI uses prefixes from yocto to yotta and scientific notation outside that scale. Table prefixes are chosen per cell; charts keep a shared scale per axis. With fractionDigits and auto notation, tables and charts both keep ordinary notation, so large values show every integer digit and small values may round to zero. Defaults are unchanged.
A table column is { key, label, type?, format?, nullText? }. Only number and integer columns accept format; any column accepts nullText. Units appear in visible and CSV headers as Label (unit), never in cells, and values are never converted. Nulls display nullText (default null) but export as empty fields. Tables render exact zero and negative zero as 0; existing fixed-precision chart zeros keep their trailing decimals. Precision rounds the stored double without manufacturing additional digits. Sorting, numeric hover details, copy, and CSV retain raw values and spreadsheet safety.
An outcome declares the author’s criterion separately from execution: satisfied means met, partial means incomplete, failed means no valid result, and unavailable means impossible in this environment. All four are successful executions. Oxiquill does not infer convergence. One outcome per result is pinned above the other outputs, with localized state text and an icon. Run completion and the outcome have separate announcements. Worker failures still show an error, and outcomes emitted before a failure are not presented as successful results.
The artifact requires kind: "outcome", state, and a nonblank label (1–256 UTF-8 bytes). Optional fields are explanation (16 KiB), status (256 bytes, shown verbatim), and up to 16 diagnostics of { name, value, unit? }: a nonblank name (1–64 bytes), finite numeric value, and unit (32 bytes). Common id, title, and caption metadata is supported. Text is literal, including markup. Unknown fields, invalid formats, and duplicate outcomes report artifact errors while other outputs remain usable. Column errors also identify the column. Column units and null text use the 16 KiB metadata limit.
The following button cell demonstrates an exact count, a scientific residual, a fixed-precision quantity with units, and custom null text. Change Iterations after running to see the previous-input banner; it stays until a current run succeeds.
Rust + Wasm
column-formats
let residual = 1.0 / f64::from(iterations);
let columns = serde_json::json!([
{ "key": "0", "label": "Count", "type": "integer" },
{ "key": "1", "label": "Residual", "type": "number", "format": { "notation": "scientific", "significantDigits": 3 } },
{ "key": "2", "label": "Time", "type": "number", "format": { "fractionDigits": 2, "unit": "s" } },
{ "key": "3", "label": "Optional", "type": "number", "nullText": "Not measured" }
]);
emit_table_with_columns!(columns, serde_json::json!([
[iterations, residual, 1.2349, null],
[iterations, residual, 1.2341, 0]
]));
let outcome = if iterations >= 1000 {
Outcome::satisfied("Target iteration count reached")
} else {
Outcome::partial("Iteration limit reached")
.explanation("Stopped before the demonstration target of 1000 iterations.")
.status("MaxIterations")
};
emit_outcome!(outcome.diagnostic("residual", residual, None));Run the cell to show its output.
Rust accepts any serde column descriptor through emit_table_with_columns!, as well as existing label strings and key/label tuples. Use Outcome::satisfied, ::partial, ::failed, or ::unavailable, then chain .explanation(...), .status(...), and .diagnostic(name, value, unit) before emit_outcome!.
Python accepts display_table(value, columns=...): a list of labels, or a mapping from column key or label to descriptor fields. Keys take precedence over labels, and a mapping entry that matches no column produces an error output; specify type: "number" for numeric formats on ordinary row lists whose inferred type is unknown. This example also reports an environment limitation explicitly:
Python + Pyodide
unavailable-outcome
Haskell provides TableColumn and displayTableWith alongside unchanged displayTable. Start with tableColumn key label and defaultNumberFormat, then update record fields. Outcome and OutcomeDiagnostic records are emitted with displayOutcome; outcome state label supplies empty optional fields.
Haskell + WASI
satisfied-outcome
import Oxiquill.Output
let quantity = (tableColumn "time" "Time")
{ columnType = Just "number"
, columnFormat = Just (defaultNumberFormat { fractionDigits = Just 2, unit = Just "s" })
, columnNullText = Just "Not measured" }
displayTableWith [quantity] [[JsonNumber 1.234], [JsonNull]]
displayOutcome ((outcome "satisfied" "Criterion met")
{ outcomeDiagnostics = [OutcomeDiagnostic "residual" 0.00001 Nothing] })Run the cell to show its output.
Interactive 3D point scenes
Section titled “Interactive 3D point scenes”scene3d displays bounded point sets and optional undirected edges through a lazy-loaded, dependency-free Canvas 2D viewer with an orthographic camera. It supports neither meshes, model imports, scripts, nor perspective cameras.
The artifact contains kind: "scene3d", required points, and optional edges, groups, axes, camera, id, title, and caption:
| Field | Rules |
|---|---|
points | 0–10,000 records: unique id (1–64 UTF-8 bytes), three finite position coordinates, optional plain-text label (256 bytes) and non-empty group ID. |
edges | 0–20,000 {from, to} records referencing distinct existing points. Repeated and reversed pairs are duplicates. |
groups | Ordered {id, label?} declarations with unique nonempty IDs. Undeclared used groups follow in first-use order with their ID as label. |
axes | Optional x, y, z, each with optional plain-text label and unit (32 bytes). |
camera | Optional finite degree yaw, pitch within −90…90, and finite positive zoom; defaults: 30°, 20°, 1. |
Other text metadata uses the existing 16 KiB per-field limit. Full scene bytes count against the shared 16 MiB run and worker-response limits. Invalid fields, unknown fields, counts, and byte limits produce an artifact-local diagnostic; scenes are never silently truncated. Markup in text is displayed literally.
Drag to orbit, wheel or pinch to zoom, or focus the view and use arrow keys (15°), + / −, and 0 to reset the latest authored camera. Controls reveals instructions. Group colors and circle/square/triangle/diamond symbols follow the shared chart palette; legend controls toggle, isolate, or show all groups. There are no animated transitions.
Click or tap within 12 CSS pixels of a point to select it. The selection shows its original coordinates and units. Select two points to measure Euclidean distance. A third selection replaces the oldest; selecting an already selected point removes it. Distance is available only when all three axes declare exactly the same nonblank unit. Otherwise the viewer says “distance unavailable: axes use different or undeclared units”; it never infers units.
Show data as tables exposes all points and edges, with sorting, pagination, and raw-value CSV. Point-row selection buttons support the same distance measurement without the canvas, including hidden groups. PNG saves the current view. Printing shows all groups at the authored initial projection. Resizing and theme changes preserve the reader’s view. Reruns in the same cell preserve camera and selection when the artifact identity and point-ID set remain unchanged; replacing either resets the scene. Explicit artifact IDs distinguish multiple or reordered outputs.
The tetrahedron has origin-to-axis distances of scale nm and other edges of sqrt(2) × scale nm. Changing Scale preserves the camera and selected point IDs:
Rust + Wasm
Tetrahedron
let points = [
("a", [0.0, 0.0, 0.0], "core"),
("b", [scale, 0.0, 0.0], "shell"),
("c", [0.0, scale, 0.0], "shell"),
("d", [0.0, 0.0, scale], "shell"),
].into_iter().map(|(id, position, group)| serde_json::json!({
"id": id, "position": position, "group": group
})).collect::<Vec<_>>();
emit_scene3d!(serde_json::json!({
"points": points,
"edges": [
{"from": "a", "to": "b"}, {"from": "a", "to": "c"},
{"from": "a", "to": "d"}, {"from": "b", "to": "c"},
{"from": "b", "to": "d"}, {"from": "c", "to": "d"}
],
"groups": [{"id": "core", "label": "Core"}, {"id": "shell", "label": "Shell"}],
"axes": {"x": {"unit": "nm"}, "y": {"unit": "nm"}, "z": {"unit": "nm"}},
"camera": {"yaw": 30, "pitch": 20, "zoom": 1}
}), metadata = serde_json::json!({"id": "tetrahedron", "title": "Tetrahedron"}));Waiting for the runtime to start.
Rust emit_scene3d!(scene, metadata = ...) and Haskell displayScene3d scene accept scene fields without kind. Python provides display_scene3d(points, *, edges=None, groups=None, axes=None, camera=None, id=None, title=None, caption=None). All three add kind and share the same validation.
Python + Pyodide
Python 3D points
display_scene3d([
{"id": "a", "position": [0, 0, 0], "label": "Origin"},
{"id": "b", "position": [1, 0, 0]},
], edges=[{"from": "a", "to": "b"}],
axes={axis: {"unit": "nm"} for axis in ("x", "y", "z")}, title="Python scene")Run the cell to show its output.
Haskell + WASI
Haskell 3D points
import Oxiquill.Output
let point name x = JsonObject [("id", JsonString name),
("position", JsonArray [JsonNumber x, JsonNumber 0, JsonNumber 0])]
displayScene3d (JsonObject [
("title", JsonString "Haskell scene"),
("points", JsonArray [point "a" 0, point "b" 1]),
("edges", JsonArray [JsonObject [("from", JsonString "a"), ("to", JsonString "b")]])])Run the cell to show its output.