Docs·Charting Library·Guides

Native & Desktop (GPUI / Rust)

Embed the same chart engine natively in a Rust desktop app. One engine emits a renderer-agnostic draw stream that dispatches to Canvas 2D on the web and to GPUI / wgpu / skia natively — candlesticks, orderbook heatmap, footprint, GEX, and 18+ indicators, identical on both targets.

kline-orderbook-chart started as a web chart engine and grew a native path. The same engine core that renders in the browser also ships as a licensed native SDK — no browser, no <canvas>, no JavaScript runtime — so you can embed a full trading chart inside a native desktop app (for example a GPUI window) and get lower latency, no tab throttling, and direct GPU-backed painting.

You build once and ship to both. Same candles, same orderbook heatmap, same footprint, same GEX gamma heatmap, same numbers.

Why native

The web is a great distribution channel and a hostile runtime for a chart a trader stares at for eight hours: background tabs throttle to ~1 fps, garbage-collection pauses land mid-pan, and Canvas is a single-threaded raster target with no direct GPU control. A native build removes those: predictable frame pacing, real threads, GPU-backed painting through GPUI / wgpu / skia, and no browser sandbox between you and the metal.

Historically, going native meant rewriting your chart. Here it does not.

One engine, one draw stream

The idea that makes web-and-native work with no rewrite: the engine never touches a canvas or a GPU directly. Each frame it computes a compact, renderer-agnostic draw stream — fills, strokes, text, and heatmap rasters in logical coordinates.

On the web, a thin layer reads that stream and paints to <canvas>. Natively, you read the same stream and call your painter. The engine does not know or care which one it is — the stream is identical, so a bar drawn on the web is the same bar drawn on the desktop.

How it's distributed

The native SDK is sold under the same commercial licence as the web package — you licence it, you do not get the engine source. It ships as a precompiled engine (a native library) plus a thin, source-visible decoder + adapter (the draw-stream reader and the reference GPUI mapping). Your app links the binary and reads its draw stream; the engine internals stay closed, exactly like the web build.

Delivered through your licence (a private registry or a vendored path), not a public package index. Contact [email protected] for a native key + SDK access. The concrete crate surface, method names, and wire layout ship inside that package — not on this public docs page.

Integration shape (high level)

Once you have the licensed SDK:

  1. Link the precompiled native engine and activate the licence key you were issued.
  2. Feed columnar OHLCV (and optional depth / GEX matrices) into the engine.
  3. Each frame, drain the draw stream and map it onto your painter (GPUI / wgpu / skia).
  4. Forward window resize, pan, zoom, and crosshair from your UI toolkit into the engine's viewport, then request a repaint.

A buildable reference GPUI adapter ships in the SDK — start there instead of inventing the paint mapping. The engine is dirty-tracked, so asking for a frame every animation tick stays cheap when nothing changed.

Wiring it into GPUI

GPUI is the Rust UI framework behind the Zed editor: retained-mode elements, a GPU-backed painter, and a tight frame loop. The chart becomes a single custom element:

  1. On resize / layout, tell the engine the logical size of the pane.
  2. In the element's paint pass, ask the engine for the current frame's draw stream.
  3. Map each draw op onto GPUI primitives (quads, paths, text, heatmap raster).
  4. Forward pan / zoom / crosshair from GPUI input events into the engine, then request a repaint.

GPUI's paint API tracks its own version; if a paint call doesn't resolve against your pinned gpui rev, the fix is local to that one adapter file in the SDK.

Licensing native builds

Web licences are locked to a domain and mobile licences to a bundle ID. A native build has neither, so it uses a native-platform token that skips the domain / bundle check while keeping plan and expiry checks intact. Pass the token string through the SDK's licence entry point; when it expires the engine stops drawing the chart body, exactly like the web build.

The engine ships as a precompiled library — you licence the binary, the same commercial model as the web package; the engine source is not sold. Contact [email protected] for a native licence key + SDK access.

What you get in the native SDK

The native SDK is the full engine, not a candle-only stub:

  • Candlesticks with O(1) amortised appends for live bars.
  • Orderbook depth heatmap — resting liquidity behind the candles.
  • GEX gamma heatmap — dealer gamma by strike over time.
  • Footprint cells — bid×ask executed volume, POC, delta, stacked imbalances.
  • Liquidation heatmap — force-close clusters as an overlay.
  • 18+ indicators — VRVP, CVD, TPO, RSI, MACD, Open Interest, Funding, more.
  • Custom indicators — a sandboxed scripting language, no fork required.

Every one of those feeds the same draw stream, so every one renders identically on the web and in your native window.

Where to go next