JavaScript API
The wrapper js/kestrel-loom.js groups the flat WASM façade by area. There is no docs.rs or npm page — the source is the reference.
createChart returns one object with the groups below. The flat façade stays reachable as
chart.raw; the wrapper hides nothing, it only orders. Item-level detail lives in
js/kestrel-loom.js and
crates/wasm/src/chart.rs.
createChartcreateChart(canvas, {
timeframe = '5m',
dark = true,
autoResize = true, // ResizeObserver
autoInput = true, // mouse, touch, keyboard
autoRender = true, // draw loop, only when dirty
}) → Promise<Chart>Loads the WebAssembly module, sizes the canvas with devicePixelRatio, wires input and starts
the render loop.
Groups
dataset(candles) append(candles) add(candle) updateLast(candle)
all() at(x, y) ohlcText()Candles are { time, o, h, l, c, v } with time in Unix seconds.
viewfit() resize() theme(isDark) info() crosshair()
logScale(on?) priceLocked(on?) scaleMode(mode?) barSpacing(px?) barWidthRatio(r)
timezone(minutes?) sessions(list) showSessions(on) rightOffset(bars?) scrollbar(on?)
resetPriceScale() resetTimeScale() timeToX(time) xToTime(x)Getter when called without an argument, setter with one. scaleMode takes price, log,
percent or indexed.
styleset(style) renkoBrick(size)candlestick, ohlc, hollow, line, area, heikinashi, footprint or
renko[:brick_size].
indicatorsavailable() add(name, params?) → paneId remove(paneId)
height(paneId, fraction) layout() artifacts(on)Names and default parameters come from kestrel-chartkit’s catalogue.
toolstrendLine(id, a, b) horizontalLine(id, price) verticalLine(id, time)
rectangle(id, a, b) ellipse(id, a, b) fibonacci(id, a, b) textLabel(id, at, text)
remove(id) clear() all() selectAt(x, y, additive?) selectInRect(x1, y1, x2, y2, additive?)
selected() deleteSelected() magnet(mode?) snap(time, price) undo() redo()Anchors are { time, price }.
scene · compare · statescene.set(scene) scene.clear()
compare.add(symbol, candles, color) compare.remove(symbol) compare.all()
state.export() state.import(json)A scene is kestrel-chartkit’s viz::scene::Scene. Compare symbols are drawn as normalised
percent performance.
destroydestroy()Detaches events, stops the loop and frees the WASM object.