A local data pipeline
Opening a CSV, TSV, or Excel file gives the browser access to the file you selected. Chart data is parsed and plotted locally; it is not uploaded to a figgy plotting service.
- 01 →Read & parse
Delimited text is read incrementally in a Worker, keeping parsing work off the interface thread.
- 02 →Store & map
Columns hold the table. You choose X, Y, and optional error or style columns.
- 03Render & inspect
Numeric arrays reach the renderer as registered columns or replayable stream sources.
The sheet uses a virtual viewport, so a large table does not create an HTML cell for every stored value. Large XY charts convert only the ranges requested by the renderer into typed arrays; smaller charts retain direct column registration. These choices reduce interface overhead, but the source data still occupies browser memory: streaming the GPU work does not make tab memory unlimited.
Incremental text import and bounded GPU submission are separate mechanisms. An Excel workbook follows its workbook parser's path and does not inherit every CSV streaming property.
Validity is cached and updated with edits
CSV import caches column validity while parsing; edits update the affected numeric information. The plotted columns retain their original row alignment. Missing or invalid numeric samples are supplied as NaN: they leave gaps in lines, and a point’s index continues to refer to its original position within the selected row range. Editing one companion column must not compact it independently and silently pair different observations.
Timestamp parsers need a validity pass for their chosen interpretation; categorical grouping needs a stable category list. These are host data-preparation concerns. Renderer clipping and logarithmic-domain rules operate on the aligned numeric columns without changing the source table.
Import, chart extraction and rendering are separate stages
Parsing converts the selected file into the studio’s table representation. Chart extraction maps the chosen X, Y, uncertainty and style columns into numeric sources. Large XY sources supply requested ranges asynchronously through a Worker instead of preparing complete numeric arrays before rendering. Registration then determines whether values are resident in the GPU column pool or retained as replayable source data. Keeping these stages separate lets one local table feed multiple chart declarations without making CSV syntax or workbook parsing part of the renderer.
Invalid numeric values, missing values and shorter companion columns still need explicit handling at the appropriate boundary. Rendering applies clipping, NaN handling and logarithmic-domain rules without rewriting the stored source. Exact source geometry does not promise identical antialiasing pixels on every backend or across different render passes.
Rust, WebAssembly, and WebGPU
The chart engine is written in Rust and compiled to WebAssembly. JavaScript manages the studio interface and supplies data; the engine owns chart configuration, range fitting, ticks, layout, hit testing, and drawing.
The renderer combines GPU work for data geometry with CPU raster work for text and chart decoration. WebGPU is accessed through wgpu. Keeping chart decisions in one engine helps the displayed figure and its exported rendering follow the same configuration.
- MODELDeclare the chart
Config, series, rich text, layout and interaction policy. This layer owns no GPU resources.
- RENDERERPrepare & draw
The chart registry, columns, GPU pipelines and CPU raster work. It owns the authoritative rendering state.
- WEBConnect the browser
Canvas, input, resize and scheduling. Studio owns its WebAssembly bindings and calls the renderer’s public Rust API.
Five layers, in a deliberate order
For Cartesian charts, tiny-skia and swash rasterize the grid, axes and rich text. The GPU draws data geometry between the background grid and foreground decoration, keeping the data readable.
- 01Grid
CPU-rasterized background reference lines.
- 02Underlay
Reference spans and annotations placed behind the data.
- 03Data
GPU fills, lines, points, uncertainty, fields and vectors.
- 04Decoration
Axes, ticks, titles and legends above the data.
- 05Overlay
Foreground annotations; selections remain independently drawable.


These are native renderer outputs with synthetic data, reproduced from the README gallery guide.
Bars, box plots, pies, and donuts
Pies, donuts, bars, boxes and radar charts use chart-specific models and renderers. They prepare immutable frames with their own decoration hit maps and memory budgets; they do not use the Cartesian column pool or its streaming jobs. Box plots display supplied five-number summaries; radar compares a few series on shared category spokes.
Click chart elements to select them and open the relevant Inspector controls. In Plot area → Edit plot area, drag one of eight handles to resize the internal drawing region, then drag inside it to move it. Auto size restores automatic layout. Normal clicks prioritize labels, axes, and data over the region; explicit area editing lets you move the region from a point occupied by data.
The renderer stores the region in logical pixels and checks that it fits the space available after labels and other decoration. Its minimum size is 80 × 60 pixels, and labels can require more. An invalid drag keeps the last accepted chart. Undo, project files, and PNG export use the same accepted region; display density and export scale do not rewrite its coordinates. See the interaction contract.
Configuration is the source of truth
Axes, series, labels, styles, and selected-data references belong to the renderer's configuration. After an asynchronous operation changes that configuration, the studio reads the committed result. A method returning successfully does not always mean that the GPU has finished drawing.
Redraw only what changed
The renderer issues revisions for chart state and raster changes. The browser compares them with the last successfully presented frame: an idle frame can skip drawing, a label change can refresh decoration, and a view change can request new data work. Queued resource cleanup still needs to progress while the picture is unchanged.
Explore the full architecture diagram

WebGPU support depends on the browser, device, driver, and adapter limits. Data editing can remain available when GPU rendering is unavailable. A successful file import alone does not prove a chart can be rendered.
From a column to GPU storage
A series refers to registered column IDs. Changing which columns a series uses and uploading new values are separate operations. This lets several series share the same X column without storing another complete copy for each line.
Two source contracts
In native code, ColumnSource supplies a length, source-level minimum and maximum, and a writer for scalar values. HiLoColumnSource supplies the higher-precision pair representation. A host can implement these traits for a vector, DataFrame, memory-mapped input or an FFI-backed source.
The native uploader borrows the source for the upload, writes directly into mapped staging, then copies staging into the resident GPU pool. It does not keep the source reference or build a persistent CPU array of point geometry. “No intermediate conversion buffer” describes this native upload boundary: it does not remove the staging-to-GPU copy or promise that browser JavaScript/WASM crossings have no copies.
Why a logical value occupies eight bytes
Resident columns use two f32 lanes per logical value. The scalar path stores (value as f32, 0). The hi/lo path splits a higher-precision value into a high component and a residual low component. GPU calculations can use the pair to preserve small differences around a large absolute offset, such as closely spaced Unix timestamps.
scalar upload: (float32(value), 0)
hi/lo upload: (high, low), representing high + low
resident payload: 2 × 4 bytes per logical value
This is not a claim that every shader operation becomes native IEEE float64 arithmetic. Use the explicit high-precision upload path when the distinction matters: add_hilo_column in Rust or register_column_f64 with a Float64Array in the browser. Choosing an ordinary scalar upload for a container of f64 values still converts those values to the scalar f32 representation.
Statistics are collected during upload
The fused writer records the uploaded pair and its smallest finite positive value in the same pass. Scalar positivity is evaluated after f32 conversion; hi/lo positivity uses the reconstructed pair. This matters on logarithmic axes, where the smallest positive uploaded value can differ from an unrounded CPU input. The renderer keeps these scalar summaries for range operations, without keeping a CPU mirror of every point.
| Element | Contract and practical effect |
|---|---|
| New column | Native add_column/add_hilo_column and browser register_column_f32/f64 register a new ID. Browser registration rejects an ID that already exists. |
| Replace values | Native upsert or browser update_register_column_f32/f64 explicitly replaces values. Browser update requires an existing ID and uploads valid calls even when the values happen to be equal. |
| Change a series | set_series declares column references and styles. It does not upload the referenced arrays. |
| Remove a column | Referencing series are removed as well. A renderer transaction can combine that removal with an updated chart Config; the web layer uses this boundary for its legend policy. |
| Move storage | Defragmentation changes the pool layout generation. Replacing column contents changes allocation identity. Prepared work can distinguish relocation from new data. |
Failures do not publish half an update
Upsert, removal and defragmentation prepare the affected pool, chart revisions, picker transition and maintenance state before publication. A returned synchronous preparation error preserves the previous authoritative state. The final commit is allocation-free. A native host with extra derived state can prepare it against an upsert guard’s provisional pool before committing. This transaction guarantee does not turn device loss into a recoverable GPU operation.
A chart is a declaration, not a set of UI variables
Config describes chart-wide layout and display policy. Ordered SeriesConfig declarations connect data IDs to geometry and styles. Neither declaration contains GPU handles. With the model’s optional serde feature they can be serialized; the web API exposes them through get_config, set_config, get_series and set_series.
| Element | Contract and practical effect |
|---|---|
chart_area | The document’s panel rectangle in pixels. Width and height must be nonzero for live rasterization. The browser preview can scale the document to its surface without rewriting the document size. |
| Four axes | bottom_x, top_x, left_y and right_y each hold range, scale, tick, label, title and line options. Studio normally binds data to the bottom/left axes and mirrors their geometry to the opposing sides. |
| Range and direction | min/max remain data-space bounds. inverted reverses screen direction consistently for ticks, data and picking; it does not swap the meaning of the stored bounds. |
| Tick intervals | major_spacing is in data units for a linear axis and decades for a logarithmic axis. Scale changes must also keep the spacing meaningful. minor_count controls subdivisions. |
| Margins and movement | out_margin reserves the label/title band. A detached axis uses line_offset to move its chrome perpendicular to the axis without moving the data area. |
| Text and grid | Titles use rich-text documents. Grid options independently control major/minor X/Y lines, colours, widths and line presets. |
| Legend | legend.content is one editable rich-text document. It is not reconstructed from series labels on every ordinary edit. |
| Selection | picked_points and picked_data store source identities and overlay policy, not duplicated point coordinates. |
| Colour scale | colorbar.axis is the chart’s Z-scale authority for fields, mapped points and color-mapped vectors, with the same axis formatting and logarithmic rules. |
| Chart style | draw_style selects Precise, Sketch, Milkyway or Constellation. Series geometry remains a separate declaration. |
Read, edit, then publish
The following example assumes an initialized, idle raw FiggyChart. It changes display options on an existing chart; it does not upload data or request a fit. The host’s frame loop presents the accepted change.
const config = JSON.parse(chart.get_config());
config.left_y.scale = "Logarithmic";
config.left_y.major_spacing = 1; // one decade
config.left_y.label_style.format = "Power";
config.bottom_x.tick = "Both";
chart.set_config(JSON.stringify(config));
set_config validates the declaration and updates renderer revisions. After an asynchronous operation such as fitting changes the authoritative configuration, the host reads the committed Config again. Publishing an old UI snapshot while a fit is active can overwrite newer state; the studio serializes its WASM operations and reconciles queued edits.
Series keep stable identities
A series declares series_id, optional source_id, x_column, y_column, a label and a render_type. The source ID records provenance for picking; the column IDs address renderer data. If X and Y lengths differ, the common extent is drawn. series_draw_info reports drawn_count, field dimensions and truncated, so the host can report what actually appeared.
Source: Configuration · Config and SeriesConfig.
One document, several coordinate systems
overlays assign selected series to independent right Y axes while sharing the panel’s X coordinates. subplots add panels with their own Config and optional axis links. Stable series declarations remain global; the layer references determine ownership. active_layer names the interaction target, including a subplot’s overlay, rather than becoming a second copy of its appearance.
Document display and export use the union of panel areas. Changing the active panel edits that panel’s configuration; it does not reset the ranges of its neighbors. A host derives display Config from document coordinates for the current surface/DPR, and does not store that scaled preview back as the document.
Annotations are declared, too
annotations holds stable item IDs, visibility, anchors, text and style for reference lines, spans, text boxes and arrows. Cartesian data anchors follow axes; ratio anchors follow their annotation space. Chart families without a suitable value axis report a skip reason instead of inventing coordinates. The renderer owns mapping, measurement, hit testing and drag handles. A host supplies editing tools, Undo and persistence.
Layers and active targets · Annotation placement and warnings.
Geometry follows the data declaration
The Cartesian engine exposes fourteen render-type variants: Line, Scatter, ScatterLine, six point/line uncertainty combinations, Histogram, Heatmap, Contour, HeatmapContour and Vector. Pies, donuts, bars, boxes and radar charts use separate models rather than additional variants in this enum.
Points, lines and uncertainty
Line appearance contains width, colour and a line-style preset; scatter appearance contains shape, size and colour. Precise scatter may use a style table, a style-index column and sparse per-point overrides. Precise error bars have their own independent mapping. Styled rendering modes use their visual shaders rather than these Precise mappings.
Error references are either symmetric, using one error column for both directions, or asymmetric, with separate lower and upper columns. Direction flags distinguish an absent X/Y error bar from a real error of zero. Inactive attributes reuse the anchor binding and are skipped before being read; the renderer does not need a hidden filler column for an absent direction.
Histograms: explicit bins, including subpixel bins
The host supplies bin edges and counts. bar.orientation determines which axis carries each: a vertical histogram uses X edges and Y counts; a horizontal one reverses that mapping. The engine does not infer orientation from column lengths. An 11-edge, 9-count input draws the common 9-bin extent and reports truncation.
For ordinary bins, width_ratio keeps a centred fraction of the bin, then gap_px removes a fixed screen-space gap. Positive-width wider bars retain at least one pixel after the gap clamp. Sparse bin overrides can change fill, border, gap or width; baseline and orientation stay series-wide.
When the original projected bin width is below one pixel, the GPU builds an envelope per pixel column (or row for a horizontal histogram). The largest overlapping bin value wins and fills toward zero, clipped to the visible range; equal maxima choose the first bin. An enabled, nontransparent stroke supplies the envelope colour, otherwise the winning fill does. A width ratio of zero still hides a bin. This is an explicit raster rule: the original edge/count columns remain unchanged.
Matrix fields: edges and centres mean different things
MatrixRef names registered columns, an orientation and a grid_layout. There is no extra matrix store inside the renderer. The layout explicitly says whether coordinates are cell Edges (n + 1) or Centers (n); lengths are not used to guess. A mismatch draws the smallest common lattice and is reported through series_draw_info.
Flat fields fit their actual cell boundaries. Contours and interpolated fields use the actual sample endpoints; for edge-coordinate inputs those sample positions are the edge midpoints. The GPU fit engine reads the same coordinate pairs and lattice rules as the drawing shader. A generic index-paired X/Y reduction would be incorrect for independent matrix axes or for histogram edges that have one more element than counts.
Contours: one field for fill and isolines
Contour levels are an explicit list in data units. The accepted length is 0 through 1,024; an additional level is rejected rather than silently dropped. The renderer retains declaration order and prepares a lookup in sorted blocks of at most 32 levels. It limits work to reachable candidates, but when all declared levels cross a cell they are all composited in declaration order.
Lines are level sets of the field’s bilinear interpolation. Their coverage uses the analytic gradient and the quadratic crossing along the local gradient-normal line. That makes the fill boundary and line derive from the same field; it is not a global shortest-distance calculation over a separately generated contour polyline. Without a per-level colour list, all levels use the declared line colour.
Non-finite levels have defined uploaded-f32 behaviour. Lines skip NaN and infinities. Band colouring counts negative-infinity levels plus finite levels at or below Z in its numerator, while the denominator keeps the entire declared level count. NaN and positive infinity therefore still affect band normalization through that denominator.
Labels leave a real gap in the contour
With no explicit anchors, GPU placement starts from a pixel-spaced lattice and projects candidates onto the isoline. Automatic and explicit placement share a 1,024-label capacity. Explicit anchors contain a data-space point and tangent; invalid level indices are removed, and the first 1,024 valid anchors are retained. If none remain, automatic placement runs.
spacing_px must be finite and positive even for hidden labels or explicit anchors. The renderer validates scaled automatic spacing and atlas dimensions before publishing new state. Text colour and number formatting are independent of line colour. The contour shader omits stroke coverage inside the chosen label rectangle, including its padding; a transparent label background still leaves a genuine line gap.
One colourbar, one Z scale
Field series require Config.colorbar; without it there is no declared Z range or colormap. Several fields in a chart share that scale. The colourbar’s axis supports linear/logarithmic ranges, ticks, labels, titles and inversion just like a chart axis. Hiding the colourbar removes its layout band but does not disable field rendering.
The side determines orientation; thickness, length fraction, alignment and free offsets determine placement. Drag offsets do not reflow the data area. Invalid or unplaceable Z values use nan_color, transparent by default. Axis inversion changes where values appear on the bar, not which colour represents each value.
Source: Configuration · series geometry, vector and color maps.
Values can control marker appearance
Precise scatter supports point_color_map and point_size_map. Color reads a numeric column through the shared Z scale; size uses an explicit domain, minimum/maximum pixel radius and Area or Radius mapping. Each appearance channel resolves sparse point override → value mapping → categorical style → base style. A non-finite size value hides the point. Finite out-of-range values clamp to mapping endpoints; non-finite color values and non-positive values on a logarithmic color scale use nan_color. These columns retain the same row identities as X/Y.
Area fills and step interpolation
A line may fill to a baseline or to another eligible series. The fill uses the declared interpolation: Linear, StepPre, StepPost or StepMid. Missing samples break the corresponding geometry. Fill and line are separate appearances, so translucent uncertainty bands need not make their outlines equally transparent.
Vector anchors, components and scalar fields
VectorComponents::Points connects per-row X, Y, U and V columns. VectorComponents::Grid uses an explicit coordinate lattice plus U/V component matrices. Tail/Middle/Tip pivot and pixel-based or data-based scale determine the arrow’s geometry. An optional scalar column maps arrow color through Config.colorbar; a Heatmap series using that same scalar lattice can sit behind it. This is a composition of native series, not an HTML arrow overlay.
Data-scaled point-vector fitting includes its endpoints and pivot; pixel-scaled vectors and grid vectors fit their anchors. The fit-scale helper sets the component multiplier from supplied U/V statistics. Point picking identifies the anchor and grid picking identifies the original cell. A separately supplied magnitude field is data, not an implicit formula engine: updating U/V alone does not regenerate another registered scalar column.
Polar is a coordinate model; radar is a chart family
Config.polar projects bottom X as angle and left Y as radius. Angle unit, zero direction, clockwise order, sector clipping, inner radius and Chord/Arc interpolation are explicit. Labels do not convert source units. A radius below the lower bound breaks the line; the upper bound clips at the outer ring. Polar fill goes to its declared baseline ring.
RadarChart instead owns 3–64 categories and 1–16 series, one value per spoke on a shared value axis. It supports polygon/circle grids, fills, markers, value labels and measured decorations. Per-spoke normalization is a source-preparation decision, never an implicit renderer transformation.
Further reading: Polar input and projection · Radar model, frames and picking.
One dataset. Four visual treatments.
The README uses growth-response curves to show the engine’s Precise, Sketch, Milkyway and Constellation styles. Each mode changes how the chart is drawn; the original data coordinates remain the source.




Original synthetic native renders from the README. Styles are declared rendering treatments; each has its own compatible series geometry.
Style changes are declared and reproducible
Precise is the default; serialized default Config may omit draw_style. Sketch declares amplitude, wavelength and a seed. The seed makes its wobble reproducible, its line treatment uses GPU arc-length information, and CPU decoration receives the corresponding hand-drawn treatment. It selects bundled Comic Neue with per-character fallback for missing glyphs.
Milkyway uses star chains and nebula ribbons for lines, planets for scatter markers, and bipolar jets for error bars. The gallery above intentionally shows line-only data. Constellation supports ScatterLine: stars lie at scatter data positions and translucent lines connect them. Parameter names, ranges and defaults are discoverable through draw_style_modes and draw_style_param_specs, allowing the interface to follow the engine’s declared parameters.
Style/series compatibility is explicit: draw_style_supports reports supported combinations. Sketch and Milkyway draw line, scatter and uncertainty series; unsupported histogram, field, contour and vector series are skipped in those modes. Constellation draws ScatterLine. Nonresident streaming has its own capability checks and rejects incompatible declarations rather than silently replacing geometry.
Prepare a frame, validate it, then paint
Chart declarations and prepared GPU work have different lifetimes. The renderer owns the persistent chart registry, column pool, pipelines, device/queue, picker state and pending pool maintenance. A native host retains the returned ChartView and ChartStyle values for its panels. A PreparedFrame in turn owns references to the exact GPU resources needed by its recorded plan.
The prepare/paint boundary
- Resolve inputs.
prepare(&mut self)resolves the chart, styles, geometry and transform, and arranges required GPU computations. - Capture an owned token. The prepared frame retains pipelines, bind groups, buffers and panel geometry, together with validation stamps and shared allocation charges.
- Validate before recording.
paint_prepared(&self)checks captured column epochs, pool layout generation, output pipeline generation, view content revision and relevant registered state. A mismatch returnsStalePreparedFramebefore recording. - Submit and present. The host submits valid commands and presents the surface. Only success advances the last-presented chart stamp.
- Service completion. Submitted work may outlive the frame or panel object. Completion callbacks release retired accounting once the GPU is finished.
The shared-reference paint method fits integrations whose paint callback offers only shared renderer access. The renderer is Send + Sync and does not add an internal shared mutex around this path; mutations still require Rust’s exclusive access. A native host remains responsible for submitting already-recorded commands before replacing captured columns, rewriting views or relocating pool storage. A validation token cannot inspect the later submission order of an external command buffer.
| Element | Contract and practical effect |
|---|---|
| Renderer desired revision | An accepted visible edit, referenced column replacement or synchronized font registration requires a new draw. |
| Renderer raster revision | Axis/decorative Config changes, series edits and new fonts require raster refresh. Selection, active-layer and annotation-only edits do not ordinarily advance this revision. |
| Renderer annotation revision | Item edits refresh only annotation textures and their hit map. Visibility toggles skip composition without rerasterizing those textures. |
| Host view_dirty | Surface size or DPR changes alter preview geometry and require raster refresh and drawing. |
| Host redraw_pending | A host-only surface change, such as clear colour, may require drawing without changing the chart declaration. |
| No visible changes | A clean animation frame skips surface acquisition, drawing, submission and presentation. Maintenance and completion handling can still run. |
Immutable derived resources
Arc-length buffers, star placement and automatic contour label placement use exact compute keys. Equal inputs may share an immutable result; a changed key creates a new result rather than overwriting buffers that an earlier prepared frame still uses. Evicting a cache entry does not necessarily release the allocation if another token still owns it.
A resident Precise panel retains its series bodies in a panel-sized texture. Its exact input key covers the transform, data area, style, polar/colorbar settings, series declarations, font generation, relevant column epochs and pool/pipeline generations. Unchanged bodies are reused while decorations and selection highlights update independently. Layers cache their own panels, so replacing a column used elsewhere does not redraw this one. Clipped panels and background-dependent styles draw their bodies directly. Premultiplied UNORM composition can differ from direct rasterization by rounding at partially covered pixels.
Derived geometry stays on the GPU
Continuous dash phase across a line
A dashed line needs the distance from the start of the path at each vertex. Counting input rows would make dash spacing depend on sampling density. Figgy instead computes cumulative pixel-space arc length from the resident coordinate pairs and the current data-to-pixel transform.
seg_initcomputes the pixel distance between each point and its predecessor.scan_blockperforms 256-element inclusive scans in shared GPU memory using the Hillis–Steele scheme.- Block-sum levels and add passes propagate those local totals.
- A one-element carry buffer carries each chunk’s accumulated length into the next chunk.
- The line pipeline consumes the resulting prefix buffer as its dash phase input.
Chunk size is bounded by the dispatch limit and 256³, rather than imposing a fixed whole-series ceiling at that chunk size. The compute encoder is submitted before drawing, so queue ordering makes the prefix available without CPU readback. The current scan remains u32-addressable: a series length or pool offset beyond that representation skips the dashed prefix path.
The cache key includes pool layout generation, column offsets and allocation epochs, length, every transform bit read by the computation and optional star pitch. Each series retains its eight most recent results; adding a new series when 256 series IDs are already cached clears the cache as a churn backstop. Zoom changes can therefore require a fresh scan even when source values are identical.
Fitting drawable geometry
Automatic fitting belongs to the renderer because visible extents depend on the primitive. Error bars extend beyond anchor points; a histogram has edges and a baseline; flat fields and interpolated fields use different lattice boundaries. Resident point/errorbar and field paths use the corresponding GPU range computations; histograms use their edge/value metadata. The host must not replace these rules with an independent JavaScript min/max loop.
auto_fit_all(padding) computes the union of the connected drawable series and adds proportional margin. Zero requests the fitted bounds without extra margin; 0.05 requests 5% padding. The range ends are not rounded to attractive tick values: tick planning is a separate decision inside the range.
Logarithmic and timestamp axes
Logarithmic auto-fit uses valid positive values. Manual non-positive or non-finite range bounds are guarded to 1e-12; valid positive bounds below that value remain valid. The transform prepares the log10 range, and the shader handles the data transformation. Non-positive samples are skipped or treated as invalid in the data path instead of causing the entire chart configuration to fail.
Timestamp labels preserve numeric coordinates. The default is Unix seconds in UTC; JavaScript epoch values need the millisecond unit, and a fixed offset of 540 minutes represents KST. AutoCalendar measures label text and coarsens the calendar step to avoid overlap. Formatting the label does not restore precision lost during a scalar upload, so high-resolution absolute timestamps should use the hi/lo path.
Bounded work, renderer-owned fitting
For a large chart, the renderer requests and processes bounded chunks while the browser keeps replayable source arrays. It controls draw order, temporary GPU allocations, and backpressure. The host supplies the requested data and gives the browser opportunities to process input between steps.
This path draws the source primitives without a JavaScript downsampling pass. It is a way to bound GPU work and memory, not a promise that every dataset will render instantly.
Resident drawing reads GPU columns directly. Nonresident streaming builds an accumulation surface from original chunks. An unchanged completed revision can reuse that result; changing the view or output resolution may require replaying the source. Neither path introduces LOD or decimation.
New charts and manual views have different intent
| Action | Range behavior |
|---|---|
| Create a chart | Request automatic fitting before the first chunk, then let the engine progressively fit the accumulated source range and finish the final view. |
| Open a saved chart | Restore its saved ranges. Rendering does not implicitly turn fitting on. |
| Zoom or pan | Keep the range you chose and render that view. |
| Fit to all data | Explicitly request a new fit using the currently connected series and padding. |
The renderer gathers source statistics during forward streaming, progressively fits when explicitly requested, and performs a final precise replay. The host does not run a separate complete statistics pass before starting the stream. “All submitted” means the chunks have been submitted; it does not by itself mean the final image or range is ready.
Streaming accepts eligible declarations and checks the operation before starting. Contours, Milkyway line/star connections, polar projection, line fills/steps, vectors, point value maps and overlay/subplot documents reject streamed sources in this release. The rejection preserves a clear contract: a host must change the input/storage plan rather than silently reduce or substitute the requested geometry.
The original source is a continuing dependency
A nonresident source is registered by stable ID, logical length, encoding and revision. Browser hosts can retain a TypedArray or provide readRange({id, revision, offset, length, encoding}). A response must match the requested range and representation exactly. The renderer owns the draw cursor, source revisions and accumulated statistics; the host supplies ranges rather than deciding which geometry to omit.
Completion of the first picture does not end that dependency. Resize, DPR changes, an uncached view or engine-level scaled export can request the same source again. Do not mutate or detach the buffer while using the same revision. Register a new revision when values change. Cancellation or component disposal releases the job’s retained source references once its lifecycle permits.
Backpressure is part of execution
Chunking limits outstanding work. A renderer can return backpressure while previously submitted chunks or resource retirement are still in flight. The host yields and services completion rather than submitting arbitrary extra work. “All submitted” means CPU submission has reached the end; it is not proof that the final image has been published.
| Element | Contract and practical effect |
|---|---|
| Submission | A step supplies a renderer-selected bounded chunk and may update the partial accumulation image. |
| Backpressure | The execution waits for capacity or GPU progress. It does not imply that the host should reset the source or request fit again. |
| All submitted | Source submission is finished; queued GPU work and final publication may still be pending. |
| Complete / resident | The managed job reports its successful terminal state. The raw loop waits for complete before adopting final Config. |
| Cancelled / superseded | These managed job results must not be published as the current chart’s successful result. A late range response from an old job cannot replace the newer job. |
| Failure | The managed Promise rejects. A host reports the error rather than treating an incomplete image as final. |
The managed facade’s maxFrameTimeMs is a target used to adjust synchronous chunk submission, not a hard deadline on the GPU, browser scheduler or external range provider. Its scheduler uses MessageChannel and GPU readiness; rAF controls presentation. A raw host owns its step/frame loop rather than running a second facade scheduler.
Submission size is a host policy
The renderer bounds requested work and accounts for in-flight resources. Hosts choose their chunk and scheduling settings within device limits. A small chunk does not bound the entire application: original sources, accumulation targets, caches, styles and final export buffers have distinct lifetimes.
Rendering and fitting remain separate requests
A raw host registers source metadata and series, requests auto_fit_all before the first chunk when fitting is intended, and services range requests and submissions until complete. Only then is the final Config adopted. Redraws, restored charts and resized views preserve their chosen ranges; a resize updates target dimensions and requests the new view without implicitly fitting.
Decoration-only changes can retain the data cursor and accumulated result. View, source or physical-resolution changes can require replay. Cancelling stops new work, but already submitted GPU commands must settle before their owned resources can retire. The host should retain both an operation generation and chart identity so an older completion cannot overwrite a newly selected chart.
In precise style, the accumulated stream texture stores data only. The current grid is composited underneath it, so changing grid visibility, colour, width or line style preserves the data cursor and job ID even without a resident cache. Other styles whose blending depends on the background may replay data after a grid change. Changing a streamed heatmap’s colour map, Z range, Z scale or missing-value colour invalidates its accumulated data pixels. Editing only the top or right axis does not replay unchanged data; an explicit auto-fit still restores all axes.
A large source can have a resident view
Where the complete source is stored and where the visible view is stored are different questions. The source can stay streamed while the renderer packs the rows needed for the current view into a GPU cache.
Zooming into a smaller region can make that view fit. The renderer includes dependencies such as a line crossing the viewport even when its endpoints lie outside it. Original source indices are preserved.
| State | What it means |
|---|---|
| Preparing | The renderer is building the current view's packed GPU data. |
| GPU resident | The current view is packed on the GPU and can support picking. This does not mean every source column is uploaded. |
| Streamed | The view remains streamed when packing is unsupported or exceeds a resource limit. Rendering can still complete. |
An overall memory budget, a resident column pool and a chart-local view-cache cap govern different allocations. They are admission policies over tracked resources, not measurements of free VRAM. Device limits and actual allocation failures can impose tighter bounds. A host can report the refusal reason and retain exact streaming when that path is supported.
Precision and lifetime have a cost
Resident logical values use two f32 lanes. Uploading f64 values splits them into high and low components, preserving large offsets such as timestamps. The shared column pool can relocate allocations during defragmentation without changing the source identity.
Releasing a chart reference does not make in-flight GPU work disappear. Live and retired allocations both remain in the renderer’s tracked total until the relevant owners and submitted work are finished. The report measures tracked requested bytes, not physical VRAM; driver allocations and some lazy Milkyway/Constellation textures are outside that total.
Whole-column admission counts unique logical values using the renderer's eight-byte resident representation. CSV file size and typed-array byte length are therefore not direct measures of the GPU allocation. Narrowing the view reduces its working set without discarding the original table.
Pool capacity and view packing are different budgets
The resident ColumnPool uses first-fit allocation, coalesces free regions and can copy through another GPU buffer to compact fragmented storage. The example browser pool starts at 16 MiB. Optional auto-growth is bounded by the device’s storage-binding limit and the configured overall GPU budget; growing the pool cannot override adapter limits.
inspect_column_admission estimates encoding size and checks whole-column admission. It does not reserve space or guarantee that every later derived resource can be allocated. A column fits in a logical budget only if its current layout, device limits and real allocation request also succeed.
| Element | Contract and practical effect |
|---|---|
pool_space | The pool cannot currently provide the required region. Total free bytes and the largest contiguous free region answer different questions. |
budget_exceeded | A request would exceed the tracked GPU budget, which includes live and retired resources. |
device_limit | The request exceeds an adapter limit. Retrying the same allocation without changing the plan does not raise that limit. |
allocation_failed | The allocation itself failed. A nominal application budget does not guarantee physical GPU memory availability. |
Errors can include requestedBytes, limitBytes, largestFreeBytes and totalFreeBytes. Integers within JavaScript’s exact range are numbers; larger values may be decimal strings. gpu_memory_status reports live/retired/total bytes, pool capacity and occupancy, backups, resource categories and column residency.
A packed view retains exact source rows
Supported Precise point, solid-line and error-bar views can pack the original rows needed by the current view. A line whose endpoints are outside the viewport can still cross it, and an error bar can reach into it; those dependencies must be included. Original row identities survive packing. Automatic streaming does not promote the entire connected column set into the global pool.
A narrower view, a window resize, an aspect-ratio change or a DPR change can reuse packed GPU rows when the cache covers the new data-space footprint. Coverage includes strokes, markers, error-bar caps, antialiasing and an additional eight-pixel edge guard; these rows count against the same cache limit. If the new footprint extends beyond that coverage, the renderer requests source ranges again. view_residency.needed_bytes is a lower bound during promotion and the actual packed size after completion. refusal_reason records why packing was not admitted, while picking_available describes picking for that view. Unsupported geometry or a capacity refusal leaves the exact streaming path available when its own resources can be allocated.
Why memory may remain after a chart disappears
Cache entries, views, styles and prepared frames can share GPU handles. Only the last Figgy owner dropping a resource moves its charge into retirement. After the host submits or discards previous commands, end_gpu_frame establishes the completion boundary; the retired charge stays until the queue callback runs. That call does not synchronously return VRAM to the device.
release_unused_gpu_memory compacts remaining columns into a smaller GPU pool only when no stream is active and keeps a minimum 16 MiB. The smaller destination buffer temporarily coexists with the old one, so cleanup itself needs budget and can fail. On failure the existing columns and bindings are preserved. Native CPU allocations, final RGBA/PNG buffers and driver internals lie outside the tracked GPU-byte ledger.
Source: API · GPU accounting and budget scope.
Two exact caches for nonresident data
A packed-view cache retains the original rows needed for eligible point/line picking, including adjacency and edge guards. A separate original-source GPU cache can retain uploaded pairs for dashed lines, histograms, heatmaps and supported styled streams when all referenced columns fit. It preserves ordering and lets resize, axis and color edits regenerate geometry without refetching those ranges. It does not add immediate picking or change packed-view residency status. Source revisions invalidate both dependencies; export still needs the original provider.
Picking and displaying a selection
With a completed packed view, the GPU picker identifies a visible primitive and returns its original series and row reference. A view that is still preparing, or could not be packed, may not support picking yet.
Finding a hit and drawing its highlight are separate operations. Selection has its own renderer-controlled requests for the selected source rows. The studio supplies those small ranges even after the data stream has completed.
Changing or clearing a selection updates that display without restarting the entire data scan. Keeping a selection does not block zooming; view changes still pass through the renderer's normal cache and resource checks.
Layout hit testing and data picking answer different questions
hit_test identifies a chart element such as a legend, axis, colourbar or data area. The model owns selection, dragging and resize policy, including the shared Config::nudge movement path. GPU data picking asks which data primitive lies under a position using the same transform, clipping, geometry and style state as drawing.
| Element | Contract and practical effect |
|---|---|
| Point | series_id, optional source_id, and point_index. The point-only compatibility API also supports line picking. |
| Histogram bin | A tagged bin_index; its highlight resolves the same final rectangle as rendering, including the declared bin style. |
| Matrix cell | Canonical x_index/y_index identifies the cell independently of how the field is oriented on screen. |
| Contour level | A level_index together with cell indices identifies the contour result, rather than storing a detached CPU polyline. |
pick_data returns these tagged results for supported geometry; picked_data stores them with highlight colour and outline/radius policy. picked_points retains the point compatibility overlay. Neither stores copied coordinates. Null clears an overlay, while an empty object requests its default empty configuration. Stale or out-of-range references draw nothing.
Pick results survive asynchronous ownership changes
An in-flight GPU pick ticket owns its result-readback resources and the source/series identity mapping captured at submission. Later chart changes or pool relocation cannot reinterpret that ticket’s result as another series. The host still checks that the response belongs to the currently selected chart before using it to update its UI.
Completed packed views support immediate point/line picking with original row indices and no source replay. A nonresident view without that completed cache returns no immediate pick; the old raw stream-pick replay entry points reject rather than beginning a full hidden source scan. Known stable references can still request bounded selection highlighting without interactive picking.
The selection cursor is independent of the main data cursor. It requests just the rows needed to draw the overlay; changing selection does not restart a whole data scan. The managed facade keeps the prior display while preparing replacement selection resources and handles stale responses. The studio’s raw integration must explicitly continue servicing selection requests after the main data session is done.
Text and legends are structured documents
Titles, axis labels and legends share the renderer’s rich-text machinery. Segments carry bold, italic, underline, subscript, superscript, Greek characters, color and size overrides; line breaks form rows and tabs form columns. In bounded charts, chart_title is an independent rich document with its own visibility. normalize_title() preserves a legacy title’s appearance before label styling is edited. Hidden titles have no hit target; decoration offsets remain the sole position authority. Layout, hit bounds and PNG output all measure the same text.
A legend entry is more than a label string
legend.content stores the whole document. Symbols use fixed-width fields of 2 em: a line is a rule spanning its field, a scatter symbol is centred in the same width, and a combined line/marker entry shares the width between rule and glyph segments. Dashed rules carry the line preset, so colour, dash and shape remain visible in the key. Automatically generated entries use a symbol, space, tab and label to align text.
Ordinary series edits update recognized automatic symbol segments while preserving user-edited text. set_series_label updates the relevant row; reset_legend_from_series_labels is the explicit operation that rebuilds the document from series labels. Treating every series refresh as a full legend rebuild would discard free editing.
Font registration is part of rendering state
Liberation Sans is bundled for the standard path and Comic Neue for Sketch, with their OFL notices. The browser kernel has no system-font database: a CSS font loaded for the surrounding website does not automatically become a font for the chart’s WASM text renderer.
Register TTF/OTF font bytes with register_font and select a returned family name in the chart configuration. Built-in Liberation Sans lacks CJK glyphs, so Korean labels need a registered font. WOFF2 is not accepted by this font-loading path. Missing families fall back to the bundled face; Sketch uses per-character fallback for glyphs missing from Comic Neue.
Byte-identical registration is idempotent: the engine reuses the registered data and does not advance the global font generation again. A genuinely new registration invalidates relevant derived text state so newly available glyphs and families can be resolved. Native hosts may additionally use their system-font lookup path.
Source: Interaction · independent rich titles; Config · text and legends.
Browser readiness and asynchronous work
The original repository’s browser integration is a reference host: <figgy-chart> owns a shadow canvas, a ready lifecycle, animation frames, resize/DPR observation and Promise adaptation around a low-level WASM kernel. Applications can build their own host over the public Rust renderer API. The same ownership, scheduling and GPU-completion rules apply to that integration.
Ready means a completed first frame
The reference browser constructor temporarily compiles render entry points on the same GPU device, submits an empty first frame and waits for GPUQueue.onSubmittedWorkDone(). Temporary warmup pipelines and retained renderer caches are distinct. Queue rejection or device loss fails readiness; obtaining an adapter alone does not prove a frame completed.
Optional style resources and compute caches for arc length, fitting, picking and contours remain lazy until needed or explicitly prewarmed. prewarm_all_with_progress can publish renderer-owned cache progress. The facade publishes its first successful frame and ready event before background picker prewarm; a picker-prewarm failure is reported separately without pretending the initial frame failed.
One mutable WASM operation at a time
Resident fitting, export and other asynchronous mutable methods can hold a borrow of the kernel across an await. Calling a second mutating method or frame() during that interval can fail with recursive object use. The facade tracks an operation token tied to the kernel and connection generation; the studio implements its own busy/generation gate for raw calls.
While such an operation is busy, input and frame paths do not enter the borrowed kernel. The latest resize and pending pointer release can be applied when it settles. A streamed fit is different: the raw call registers a request and the host must keep pumping data and frames; the facade’s streamed fit awaits its job without blocking its own stream scheduler.
Disconnect does not authorize a stale callback
Disconnect invalidates the connection generation, cancels scheduling and disconnects observers. A kernel still borrowed by an active operation is freed after that operation settles. An older completion must not clear a newer busy token, resize the new canvas, free the new kernel or overwrite its chart configuration. The raw studio similarly checks chart object, selected chart and operation generation.
Canvas CSS size and physical pixel size can differ. Pointer mapping uses their current ratio, and chart dragging converts movement into document coordinates. Preview resize preserves the stored chart aspect and may add surrounding space; it does not silently rewrite the output document’s font sizes. A DPR change may still require new raster and data work at the new physical resolution.
Source: API · construction and detached preparation.
Detached preparation keeps the renderer available
for_window_minimal_async_observed limits initial browser warmup to Basic entries. A host then compiles and installs Basic and the required feature groups. begin_preparation creates an owned job; its asynchronous compile holds GPU handles rather than a mutable renderer borrow, so ordinary frames and Config edits can continue. Installation is synchronous, validates renderer/device/target identity and does not publish chart state.
PreparationFeature::for_chart identifies the needed groups; Picking is prepared separately before picking. Full prewarm still does not allocate future chart data, label atlases or all chart-specific renderer resources, nor guarantee a stall-free first draw. A host deduplicates jobs, serializes installation and ignores results from a disposed generation.
Editable projects and rendered figures
A .figgy project stores tables and chart configuration in a local file. Large tables use bounded binary grid blocks so the file codec can handle them in pieces. The project format belongs to the studio and is separate from the rendering engine. Optional numeric-validity chunks are bound to their original string blocks by a source hash. Older files remain readable; missing or inconsistent caches are rebuilt from the preserved cells.
Export is a new rendering target
The engine scales chart dimensions and styles, draws to an offscreen texture in the same grid → annotation underlay → data → decoration → annotation overlay order, and reads back aligned row chunks. It then converts premultiplied colour to straight-alpha RGBA and encodes the PNG. Chunked readback bounds the temporary buffer; the final image still needs memory.
PNG export uses an explicit scale factor. A project file preserves editable data and settings; a PNG preserves a rendered image. Save a project when you need to continue editing later.
The image export pipeline
- Scale the document. The requested export scale is clamped to supported bounds. Pixel dimensions, line widths and text sizes scale; data-space bounds, tick spacing, scale type and colours do not.
- Prepare export resources. A temporary view/style and an offscreen
Rgba8Unormtarget are prepared for the requested output. The target starts transparent. - Draw the same layers. Grid, annotation underlay, data, decoration and annotation overlay retain their ordering. Resident export reads GPU columns; the engine’s streamed export replays original ranges into a separate target rather than enlarging the on-screen texture.
- Read back rows. Texture rows are copied through buffers with 256-byte alignment. Chunk height adapts to the device buffer limit. Browser mapping yields asynchronously while the GPU completes.
- Produce portable pixels. Padding is removed and premultiplied colour becomes straight-alpha RGBA. The PNG encoder produces bytes; the host decides whether to save, copy or send them.
Row chunking limits the readback buffer, not the complete offscreen target or final CPU image. A large output can still exhaust memory. Engine-level streamed export also needs the replayable original source even after the preview completed. A complete preview therefore does not make the original source disposable.
What a project file preserves
The studio owns the .figgy container and its independent file-codec crate; the renderer does not know that format. Project files preserve tables, matrices, chart declarations and host metadata needed to continue editing. Style files use the same extension with a different container kind and store presets rather than a full dataset.
The version-1 container begins with the FIGY magic, a little-endian version and the length of an uncompressed UTF-8 JSON header. Chunk starts are aligned to eight bytes. Chunk records contain offsets relative to the chunk section, stored lengths, encoding and CRC32 of the stored bytes. Raw and raw-DEFLATE encodings are supported; the reader checks file bounds, overlap and integrity before accepting content.
Large tables use bounded binary grid blocks instead of one enormous JSON row array. That reduces whole-file conversion pressure but does not eliminate source data memory or final output memory. Save a project for editability and provenance; export an image for the rendered result.
Source: Architecture · image export.
Panel and document export
export_panel_* renders the base panel. export_document_* composites its overlays and all subplots in document coordinates; without extra layers their bytes match. Separate bounded renderers export their immutable chart frames with the annotation layer. Pixel dimensions and style lengths scale together, while data-space bounds, values and tick units keep their meanings.
Embedding the engine outside the studio
The Rust renderer is published as figgy-renderer (Rust library renderer); the declaration-only crate is figgy-model (library model). Renderer 0.18.1 uses model 0.12.1, declares Rust 1.99 as its support floor and shares wgpu 30 types with hosts. Default features do not require a GUI framework; serde enables model serialization. Reproducible applications retain their resolved Cargo.lock.
| Element | Contract and practical effect |
|---|---|
| winit | Renderer::for_window can create the instance, adapter, device, queue and surface for a window. Hosts still own event-loop and window lifecycle decisions. |
| egui | The active integration uses egui/eframe 0.36 with wgpu 30. Preparation runs before paint, and the paint callback records from a validated prepared token. |
| Other wgpu hosts | A host can integrate with compatible device/queue/render-pass types and retain its own panel views. GPU ownership and command ordering still follow the prepare/paint contract. |
| iced | The retained iced 0.14 integration is not an active build target because it exposes wgpu 27 types. Direct sharing requires compatible wgpu versions. |
| Reference browser facade | <figgy-chart> wraps the WASM kernel with canvas lifecycle, scheduling and Promise-based jobs. |
| Reference raw WASM | FiggyChart allows a browser host to control the canvas, busy gate, frame loop and data supply itself, when an application needs its own integration. |
Install the crate
[dependencies]
renderer = { package = "figgy-renderer", version = "=0.18.1", features = ["serde"] }
# Only needed when using the model without the renderer:
# model = { package = "figgy-model", version = "=0.12.1" }
Separate registration from presentation
An embedding normally creates the renderer, registers columns, declares Config and series, requests fitting when intended, and drives its appropriate frame loop. Updates explicitly replace data or declarations; a drawing request does not import a new table or infer that the user wants their view reset.
For a source checkout, the README documents cargo check --locked --workspace --all-targets --all-features. Browser package generation uses the pinned wasm-pack version and the web crate:
npx wasm-pack@0.15.0 build crates/web \
--release --target web --locked
The source repository’s browser package is an example consumer, not a published Rust dependency that applications must adopt. A web application can depend on figgy-renderer and own its Rust/WASM bindings, lifecycle and browser I/O. The runnable winit, egui and browser examples demonstrate complete integrations. Building one does not deploy the online Studio.
Local plotting does not mean an offline website
Chart files are processed in the browser. Hosting delivers the application, fonts, and engine assets; it does not perform the chart computation.
The site can load external resources, advertising, and analytics. Sending feedback is an explicit network submission. Theme and style preferences use browser storage, while saving a project writes a file to your device. See the privacy policy for the site's data and third-party resource details.
What local rendering establishes
The computation described in this guide runs in the browser’s JavaScript/WASM and GPU processes. It does not require sending a chart’s raw columns to a plotting server. This architecture is separate from the website’s ordinary requests for HTML, code, fonts, advertising or analytics. An explicit feedback submission has its own network behaviour.
Saving a file, downloading an image and storing UI preferences are also different operations. A saved .figgy project contains editable source data and should be shared accordingly. A PNG contains the rendered image. The privacy policy governs the website’s external services; a local chart engine alone is not a guarantee that the whole website is offline.
Explore the implementation
This guide follows the original figgy repository at f3f569c4, the source recorded in the crates.io renderer 0.18.1 release. Its README, architecture, API, configuration and interaction documents were also checked against 4b5bdde8 (21 October 2026); those documents are unchanged. Source links below are pinned so the explanations remain reproducible.
- README and gallery — overview, examples and documentation entry points.
- Rendering architecture — data flow, resource ownership, caches, streaming and export.
- Rust API contracts — crates.io dependencies, preparation, errors, memory and host integration.
- Configuration reference and JSON schema — authoritative chart declarations.
- Interaction guide — layers, titles, subplots, annotations and direct editing.
- Polar plots, radar charts and pies and donuts — coordinate and chart-specific renderers.
- WebAssembly integration example — async ownership and browser lifecycle.
- Runnable example index — source functions, inputs and commands for gallery figures.
Native gallery figures use synthetic data. The two architecture illustrations were refreshed from the release source; the seven retained gallery/style images have their original provenance. All origins and file hashes are in the asset source list. © figgy contributors, used under the MIT license. Explanatory prose is adapted for this guide. For using the web application, read the Studio manual.
Try it in the studio →