Charts API Reference
@quatick/quatick-charts · Version 2.0.0 · WebGL-accelerated
Complete reference for the Quatick Charts SDK. Professional-grade GPU-accelerated charting engine designed for institutional trading platforms. Render 10M+ data points at 60fps with sub-10ms WebSocket-to-pixel latency. TypeScript-native, plugin-first architecture built on WebGL 2.0 and Web Workers.
Getting Started
Installation
Install via npm, yarn, or pnpm. The package ships as an ES module with full TypeScript declarations.
Chart Constructor
Import Chart or use the convenience factory createChart(). Both accept the same configuration object.
| Prop | Type | Default | Description |
|---|---|---|---|
| container* | string | HTMLElement | — | CSS selector or DOM element to mount the chart canvas into. |
| chartType | RendererType | "candlestick" | Initial chart type. Can be changed at runtime via chart.setChartType(). |
| theme | "dark" | "light" | "dark" | Built-in theme preset. Custom themes via ThemeAPI. |
| renderer | "webgl" | "canvas" | "webgl" | Rendering backend. WebGL 2.0 for maximum performance, Canvas 2D as fallback. |
| showVolume | boolean | true | Render volume histogram bars in the lower section of the main pane. |
| debug | boolean | false | Enable debug overlay showing FPS, render times, and WebGL diagnostics. |
| xAxis | IXAxisConfig | {} | Time-axis: visible, height, fontSize, timezone, candleInterval (seconds). |
| yAxis | IYAxisConfig | {} | Price-axis: visible, position ('right'|'left'), fontSize, precision, logScale. |
| grid | IGridConfig | {} | Grid lines: visible, horizontalVisible, verticalVisible, horizontalColor, verticalColor. |
| crosshair | ICrosshairConfig | {} | Crosshair: visible, mode ('free'|'magnetic'), lineColor, label styles. |
| interactions | IInteractionConfig | {} | enableZoom, enablePan, enableCrosshair, minBarsVisible, maxBarsVisible. |
| showResetButton | boolean | true | Show built-in 'Reset View' button on the canvas. |
| performanceHint | "default"|"performance"|"low" | "default" | Rendering optimization level. Use 'performance' on low-end devices. |
setData() — Loading Candle Data
Pass an array of Candle objects to the chart. The data must be sorted chronologically by time (Unix timestamp in seconds).
| Prop | Type | Default | Description |
|---|---|---|---|
| time* | number | — | Unix timestamp in seconds (number of seconds since epoch). |
| open* | number | — | Opening price of the bar. |
| high* | number | — | Highest price of the bar. |
| low* | number | — | Lowest price of the bar. |
| close* | number | — | Closing price. |
| volume* | number | — | Volume traded during the bar period. |
setChartType() — Switching Chart Types
Change chart type at runtime without losing data or indicators:
Plugin Architecture
The chart engine is built entirely around composable plugins: renderers, indicators, overlays, interactions. The PluginRegistry manages the plugin lifecycle.
Renderers
- • Candlestick
- • Hollow Candle
- • Renko
- • Kagi
- • Line Break
- • P&F
- • Volume Candle
- • Area
- • Heikin-Ashi
Indicators
- • MA/EMA/SMA/WMA
- • Bollinger Bands
- • RSI
- • MACD
- • Stochastic
- • ATR
- • ADX
- • VWAP
- • Ichimoku
- • Supertrend
Overlays & Tools
- • Crosshair + Tooltip
- • Grid
- • Trendlines
- • Fibonacci
- • Annotations
- • Volume Profile
- • Order Book
Chart Types & Renderers
All 12 chart types are first-class renderer plugins. Switch between them at runtime with chart.setChartType(). Each renderer performs intelligent data transformation on the underlying OHLCV stream.
Candlestick
Traditional OHLCV representation. Bodies represent open–close range; wicks extend to high and low. WebGL-optimised for 60fps at any zoom depth.
| Prop | Type | Default | Description |
|---|---|---|---|
| upColor | string | "#34d399" | Fill color for bullish candles (close ≥ open). |
| downColor | string | "#f87171" | Fill color for bearish candles (close < open). |
| wickUpColor | string | auto | Wick color for bullish bars. Inherits upColor if unset. |
| wickDownColor | string | auto | Wick color for bearish bars. Inherits downColor if unset. |
| borderWidth | number | 1 | Candle body border stroke width in pixels. |
| wickWidth | number | 1 | Wick stroke width in pixels. |
Hollow Candle
Bullish continuation bars are hollow (outline only), bearish bars are filled. Strong trend signals at a glance with zero additional indicator overhead.
Volume Candle
Candle body width is proportional to normalised volume across visible bars. Instantly identifies high-conviction moves.
| Prop | Type | Default | Description |
|---|---|---|---|
| maxBodyWidth | number | 0 | Maximum body width in pixels. 0 = auto (fills bar spacing). |
| minBodyWidth | number | 2 | Minimum body width in pixels to keep thin candles visible. |
Line & Step Line
Close-price line chart. step-line uses horizontal segments between bars (no interpolation) — ideal for discrete data series.
| Prop | Type | Default | Description |
|---|---|---|---|
| lineColor | string | "#8b5cf6" | Line stroke color. |
| lineWidth | number | 2 | Stroke width in pixels. |
| field | "open"|"high"|"low"|"close" | "close" | OHLCV field to plot. |
| smoothing | number | 0 | Bezier smoothing factor (0 = sharp, 1 = smooth). |
Area Chart
Gradient-filled area below the close line. Effective for overlaying moving averages on cumulative data.
| Prop | Type | Default | Description |
|---|---|---|---|
| lineColor | string | "#8b5cf6" | Top line color. |
| areaTopColor | string | "rgba(139,92,246,0.3)" | Fill color at the top of the area. |
| areaBottomColor | string | "rgba(139,92,246,0)" | Fill color at the bottom (fades to transparent). |
| lineWidth | number | 2 | Stroke width of the top line. |
Baseline
Values above a reference price render green, below render red. Perfect for relative-performance or mean-reversion strategy overlays.
| Prop | Type | Default | Description |
|---|---|---|---|
| baseline* | number | — | Reference price level (horizontal baseline). |
| topFillColor | string | "rgba(52,211,153,0.15)" | Fill above baseline. |
| bottomFillColor | string | "rgba(248,113,113,0.15)" | Fill below baseline. |
| topLineColor | string | "#34d399" | Line color above baseline. |
| bottomLineColor | string | "#f87171" | Line color below baseline. |
Heikin-Ashi
Modified OHLC calculation that smooths price noise. The engine transforms raw OHLCV data internally. All candlestick color options apply.
HA_close = (O+H+L+C)/4 · HA_open = prev(HA_open+HA_close)/2 · HA_high = max(H, HA_open, HA_close) · HA_low = min(L, HA_open, HA_close)Renko
Time-independent bricks. New bricks only form when price moves by a fixed amount. ATR auto-sizing is supported.
| Prop | Type | Default | Description |
|---|---|---|---|
| brickSize | number | 0 | Brick size in price units. 0 = automatic ATR-based sizing. |
| method | "close" | "hl" | "close" | "close" tracks closing prices; "hl" allows high/low reversals. |
| atrPeriod | number | 14 | ATR look-back period used when brickSize = 0. |
| upColor | string | "#34d399" | Rising brick fill color. |
| downColor | string | "#f87171" | Falling brick fill color. |
Line Break
N-line break reversal pattern. Classic is 3-line break — a new block only forms when price breaks the highest (or lowest) of the previous N lines.
| Prop | Type | Default | Description |
|---|---|---|---|
| lines | number | 3 | Number of prior lines that must be broken for a reversal. Classic = 3. |
| upColor | string | "#34d399" | Rising block fill color. |
| downColor | string | "#f87171" | Falling block fill color. |
Point & Figure
Classic X (rising) and O (falling) column chart. Price-driven, ignores time. ATR auto-sizing keeps box sizes relevant across symbols and timeframes.
| Prop | Type | Default | Description |
|---|---|---|---|
| boxSize | number | 0 | Box size in price units. 0 = dynamic ATR-based. |
| reversal | number | 3 | Number of boxes required for a column reversal. |
| xColor | string | "#34d399" | X (rising column) color. |
| oColor | string | "#f87171" | O (falling column) color. |
Kagi
Thick Yang lines for bullish breakouts, thin Yin lines for bearish. Time-independent. Identifies support/resistance without the noise of regular candlestick charts.
| Prop | Type | Default | Description |
|---|---|---|---|
| reversalPct | number | 0.03 | Reversal as a fraction (0.03 = 3% price move triggers reversal). |
| reversalAbs | number | 0 | Absolute price reversal. Takes precedence if > 0. |
| yangColor | string | "#34d399" | Yang (thick/rising) line color. |
| yinColor | string | "#f87171" | Yin (thin/falling) line color. |
| lineWidth | number | 2 | Base line width. Yang is rendered 2× thicker. |
Indicators & Technical Analysis
The IndicatorApi controls all technical indicators. 30+ built-in indicators with Web Worker computation — indicator math never blocks the main thread. Custom indicators extend BaseIndicator.
addIndicator()
Add a technical indicator via the chart's indicator API. The engine calculates and overlays the result automatically.
| Prop | Type | Default | Description |
|---|---|---|---|
| type* | string | — | Indicator ID string: "sma", "ema", "rsi", "macd", "bbands", "vwap", etc. |
| params | object | {} | Indicator-specific params: { period: 20, source: 'close', multiplier: 2 }. |
| pane | number | 0 | Pane index. 0 = main price pane. 1+ = separate sub-pane. |
| color | string | auto | Plot line color. Auto-assigned from theme palette if omitted. |
| overlay | boolean | true | Overlay on main pane (true) or in separate sub-chart pane (false). |
| visible | boolean | true | Initial visibility toggle. |
| id | string | auto | Custom stable ID for referencing this indicator instance. |
Built-in Indicator Reference
Trend Following
- • SMA (Simple MA)
- • EMA (Exponential MA)
- • WMA (Weighted MA)
- • DEMA
- • TEMA
- • HMA (Hull MA)
- • VWAP
- • ALMA
- • SMMA
Volatility
- • Bollinger Bands
- • Keltner Channel
- • Donchian Channel
- • ATR
- • Std Dev
- • Chaikin Volatility
Momentum
- • RSI (14)
- • Stochastic %K/%D
- • CCI
- • MFI
- • ROC
- • Williams %R
- • TSI
- • CMO
- • Momentum
Oscillators
- • MACD (12,26,9)
- • DMI/ADX
- • Aroon (Up/Down)
- • Parabolic SAR
- • Supertrend
- • Ultimate Oscillator
Volume Analysis
- • OBV (On-Balance)
- • A/D Line
- • CMF
- • VWMA
- • RVOL
- • Volume Delta
- • Cumulative Delta
Advanced / AI
- • Ichimoku Cloud
- • Pivot Points
- • ZigZag
- • Elliott Wave
- • Support/Resistance
- • Market Structure
Common Indicator Parameters
| Prop | Type | Default | Description |
|---|---|---|---|
| period | number | — | Look-back period for calculation (e.g., 14 for RSI-14). |
| source | "open"|"high"|"low"|"close"|"hl2"|"hlc3"|"ohlc4" | "close" | Price source field to feed into the calculation. |
| fast | number | — | Fast period (MACD, Stochastic, ADX). |
| slow | number | — | Slow period (MACD, PSAR, etc). |
| signal | number | — | Signal smoothing period (MACD). |
| stdDev | number | — | Standard deviation multiplier (Bollinger Bands, Keltner). |
| multiplier | number | — | ATR multiplier (Supertrend, Keltner). |
| kPeriod | number | — | Stochastic %K smoothing. |
| dPeriod | number | — | Stochastic %D period. |
| stepSize | number | — | PSAR acceleration step increment. |
| maxStep | number | — | PSAR maximum acceleration factor. |
Custom Indicator
Extend BaseIndicator to create custom indicators. The calculate() method runs inside a Web Worker.
VWAP & Anchored VWAP
VWAP (Volume Weighted Average Price) is a special indicator that resets at session open. Anchored VWAP resets at a user-defined time/price anchor.
Streaming & Real-Time Data
The DataApi abstracts data sources behind a unified interface. Supports WebSocket, Server-Sent Events, REST polling, and custom feed implementations. Incremental rendering ensures 60fps is maintained even at 1,000 ticks/second.
updateCandle() — Live Tick Updates
The simplest streaming API — push individual bar updates directly. The engine decides whether to update the last bar or append a new one based on the timestamp and candle interval.
DataApi Connection Config
| Prop | Type | Default | Description |
|---|---|---|---|
| protocol* | "websocket"|"sse"|"rest" | — | Data transport protocol. |
| url* | string | — | Endpoint URL. |
| apiKey | string | undefined | Bearer token or API key for authentication. |
| symbol* | string | — | Market symbol identifier. |
| timeframe* | string | — | Candle interval: "1m", "5m", "15m", "1h", "4h", "1D", "1W". |
| reconnect | boolean | true | Automatically reconnect on disconnect. |
| maxRetries | number | 5 | Maximum reconnection retry attempts. |
| retryDelay | number | 1000 | Base delay in ms between retries (exponential back-off). |
| pollInterval | number | 5000 | Poll interval in ms (REST protocol only). |
| pingInterval | number | 30000 | WebSocket heartbeat ping interval in ms. |
| transform | Function | passthrough | Custom message transform fn: (raw) => Candle. |
Chart Events
Subscribe to chart-level events using the event bus. All callbacks receive typed event objects.
Historical Data Loading
Combine historical data with live streaming for seamless full-history charts.
chart.setData(), then start the live stream with chart.updateCandle(). The chart engine merges new ticks with historical candles automatically — no deduplication logic required.Custom Overlays & Drawings
The DrawingApi provides both built-in drawing tools and a low-level Canvas 2D API for fully custom overlays. Extend BaseOverlay for arbitrary rendering on top of the chart canvas.
DrawingApi — Built-in Tools
| Prop | Type | Default | Description |
|---|---|---|---|
| setTool(type) | void | — | Activate drawing mode: "trendline" | "horizontal" | "vertical" | "rectangle" | "arrow" | "fibonacci" | "text" | "pitchfork". |
| clearTool() | void | — | Exit drawing mode and deactivate cursor. |
| getDrawings() | Drawing[] | — | Return all current drawing objects. |
| removeDrawing(id) | void | — | Remove a specific drawing by its stable ID. |
| clearAll() | void | — | Remove all drawings from the chart. |
| exportDrawings() | object | — | Serialize all drawings to a JSON-serializable object. |
| importDrawings(state) | void | — | Restore drawings from a previously exported state. |
BaseOverlay — Custom Canvas Rendering
For fully custom rendering extend BaseOverlay. The render() method is called every frame with a coordinate-transform context.
Render State / Coordinate API
| Prop | Type | Default | Description |
|---|---|---|---|
| visibleBars | Candle[] | — | Array of candle objects currently in the visible viewport. |
| priceToY(p) | (price: number) => number | — | Convert a price to canvas Y-coordinate (pixels). |
| yToPrice(y) | (y: number) => number | — | Convert canvas Y-coordinate to price. |
| timeToX(t) | (time: number) => number | — | Convert Unix timestamp to canvas X-coordinate. |
| xToTime(x) | (x: number) => number | — | Inverse: canvas X to Unix timestamp. |
| barWidth | number | — | Current width of a single bar in pixels. |
| canvasWidth | number | — | Total canvas width in pixels. |
| canvasHeight | number | — | Total canvas height in pixels. |
| dpr | number | — | Device pixel ratio (1 on standard, 2 on retina). |
Overlay Examples
User Interactions
The InteractionApi manages all user input: zoom, pan, crosshair, drawing tools, and keyboard shortcuts. All interactions can be enabled/disabled at runtime.
Zoom & Pan
| Prop | Type | Default | Description |
|---|---|---|---|
| enableZoom | boolean | true | Mouse-wheel and pinch-to-zoom. |
| enablePan | boolean | true | Click-drag to pan the chart. |
| minBarsVisible | number | 5 | Minimum number of bars visible when zoomed in. |
| maxBarsVisible | number | 5000 | Maximum number of bars visible when zoomed out. |
| zoomSensitivity | number | 1.0 | Mouse wheel sensitivity multiplier. |
| enableDoubleClick | boolean | true | Double-click to reset chart view. |
| enableKeyboard | boolean | true | Arrow-key panning. +/- keys for zoom. |
Crosshair & Tooltip
| Prop | Type | Default | Description |
|---|---|---|---|
| visible | boolean | true | Show/hide crosshair. |
| mode | "free" | "magnetic" | "magnetic" | "free" follows cursor exactly; "magnetic" snaps to bar centers. |
| lineColor | string | auto | Crosshair line color. |
| lineWidth | number | 1 | Crosshair line width in pixels. |
| lineDash | number[] | [4, 4] | Dash pattern for crosshair lines. |
| showPriceLabel | boolean | true | Show price label on the y-axis. |
| showTimeLabel | boolean | true | Show time label on the x-axis. |
| labelBackground | string | auto | Background color of axis labels. |
Axis Configuration
| Prop | Type | Default | Description |
|---|---|---|---|
| xAxis.visible | boolean | true | Show or hide the time axis. |
| xAxis.height | number | 26 | Time axis bar height in pixels. |
| xAxis.timezone | string | "UTC" | Timezone for label formatting (IANA timezone name). |
| yAxis.visible | boolean | true | Show or hide the price axis. |
| yAxis.position | "right" | "left" | "right" | Which side the price axis renders on. |
| yAxis.precision | number | 2 | Decimal places for price labels. |
| yAxis.logScale | boolean | false | Enable logarithmic price scale. |
| yAxis.inverted | boolean | false | Invert the y-axis (price increases downward). |
| yAxis.autoScale | boolean | true | Auto-fit price range to visible bars. |
Grid Configuration
Performance Optimisation Tips
- renderer: 'webgl' — Use WebGL for maximum GPU-accelerated throughput (default)
- performanceHint: 'performance' — Reduces visual quality for best FPS on low-end devices
- Limit visible indicator count. Use sub-panes for oscillators to reduce main pane overdraw.
- Call
chart.api.data.prependData()for history loading — avoids full re-render. - Avoid calling
chart.setData()during streaming — usechart.updateCandle()for tick updates. - Destroy charts when unmounted:
chart.destroy()frees GPU memory, WebSocket, and Workers. - For dashboards with 10+ charts, use
renderer: 'canvas'on background charts to save GPU budget.
Options Payoff Chart
PayoffChart is a fully standalone 2D Canvas renderer for options strategy payoff diagrams. It ships separately from the financial chart and requires no OHLCV data. It renders P&L curves, breakeven lines, a spot price marker, standard deviation bands, crosshair tooltips, and supports pan/zoom interactions out of the box.
@quatick/quatick-charts. It does not depend on the financial Chart class and can be used independently.Live Strategy Demo
Select a strategy below to see its payoff curve, breakevens, and 1σ / 2σ standard deviation bands. Spot: 19 500 · IV: 15% · DTE: 30.
Iron Condor — Short two OTM options + long two further OTM options. Max profit in a range-bound market.
Quick Start
Chart Configuration — IPayoffChartConfig
| Prop | Type | Default | Description |
|---|---|---|---|
| container | HTMLElement | string | — | Mount element or CSS selector. |
| height | number | 400 | Chart height in pixels. Width fills the container. |
| theme | "dark" | "light" | IPayoffChartTheme | "dark" | Color scheme. Pass a full IPayoffChartTheme object for full control. |
| animation | IPayoffAnimationConfig | — | Controls fade-in duration and easing for curves. enabled, fadeInCurves, duration, easing. |
| crosshair | IPayoffCrosshairConfig | — | enabled, color, width, style. Enables hover crosshair with price/PnL readout. |
| tooltip | IPayoffTooltipConfig | — | enabled, backgroundColor, textColor, borderColor, borderRadius, padding, fontSize. |
| xAxis | IPayoffXAxisConfig | — | visible, height, fontSize, gridLines, tickCount, format (function). |
| yAxis | IPayoffYAxisConfig | — | visible, width, fontSize, position ('left'|'right'), format (function). |
| interactions | IPayoffInteractionConfig | — | enablePan, enableZoom, zoomSensitivity, kineticScrolling. |
| oiOverlay | IOIOverlayConfig | — | Open interest bar overlay. enabled, showCalls, showPuts, heightRatio, position. |
Strategy Leg — IStrategyLeg
| Prop | Type | Default | Description |
|---|---|---|---|
| id | string | — | Unique identifier for this leg. |
| instrumentType | "option" | "future" | "perpetual" | "option" | Instrument type. |
| optionType | "call" | "put" | — | Required when instrumentType is 'option'. |
| positionType | "long" | "short" | — | Direction of the leg. |
| strike | number | — | Strike price for option legs. |
| expiry | string | — | ISO-8601 expiry date string (e.g. '2025-06-26'). |
| quantity | number | 1 | Number of lots. |
| premium | number | — | Premium per unit (in the same currency as price). Used to compute net cost. |
| lotSize | number | 1 | Contract lot size. P&L is scaled by quantity × lotSize. |
| iv | number | — | Implied volatility as a decimal (e.g. 0.15 for 15%). Used for Greeks and target-date curve. |
| greeks | IGreeks | auto | Optional pre-computed Greeks (delta, gamma, theta, vega, rho). If omitted, calculated from iv. |
Calculator — calculatePayoffChartData()
Helper that takes strategy legs and market params and returns a complete IPayoffChartData object ready to pass to chart.setData(). Computes the at-expiry curve, a target-date curve, breakevens, max profit/loss, net premium and net Greeks.
Data Object — IPayoffChartData
| Prop | Type | Default | Description |
|---|---|---|---|
| legs | IStrategyLeg[] | — | Strategy leg definitions (passed through from input). |
| curves | IPayoffCurve[] | — | At-expiry and target-date payoff curves. Each curve has id, label, points[], color, lineWidth, dash, fillArea, fillOpacity. |
| spotPrice | number | — | Current underlying price used to draw the spot marker. |
| breakevens | number[] | [] | Prices at which strategy P&L equals zero. |
| maxProfit | number | — | Max profit per lot. Infinity for unlimited-profit strategies. |
| maxProfitPrice | number | — | Underlying price at which max profit occurs. |
| maxLoss | number | — | Max loss per lot (negative). -Infinity for unlimited-risk strategies. |
| netPremium | number | — | Net premium received (positive) or paid (negative). |
| netGreeks | IGreeks | — | Aggregate delta, gamma, theta, vega, rho for the strategy. |
| sdBands | IStdDevBand[] | [] | Standard deviation bands. Each band has sigma, lower, upper, color, opacity, label. |
| daysToExpiry | number | — | Days to front-month expiry. |
| impliedVolatility | number | — | IV used for the target-date curve calculation. |
| oiData | IOIDataPoint[] | [] | Optional open interest data per strike for the OI overlay bar chart. |
Chart Methods
| Prop | Type | Default | Description |
|---|---|---|---|
| setData(data) | void | — | Set or update the full payoff data. Triggers fade-in animation for new curves. |
| setOIData(oiData) | void | — | Update the open interest overlay independently without re-computing payoff curves. |
| setOIEnabled(enabled) | void | — | Toggle the OI overlay visibility. |
| setConfig(config) | void | — | Apply partial config updates at runtime (theme, axis visibility, etc.). |
| setTheme(theme) | void | — | Switch dark/light or apply a custom IPayoffChartTheme. |
| requestRender() | void | — | Force an immediate re-render (e.g. after external state change). |
| on(event, callback) | void | — | Subscribe to events: 'hover', 'breakevenHover', 'resize', 'destroy'. |
| off(event, callback) | void | — | Unsubscribe a previously registered event listener. |
| destroy() | void | — | Tear down the chart, remove the canvas from the DOM, and release all resources. |
Standard Deviation Bands
SD bands visually show the expected move for the underlying over the life of the strategy. Calculate σ from IV and DTE and pass them via data.sdBands.
Open Interest Overlay
Render call and put open interest as horizontal bars below the payoff curves. Useful for identifying support/resistance clusters through OI concentration.
Events
createPayoffChart in a useEffect and call chart.destroy() in the cleanup function. Dynamic import with import('@quatick/quatick-charts') avoids SSR issues.Advanced API Reference
Chart Instance Methods
Complete list of methods on each Chart instance.
| Prop | Type | Default | Description |
|---|---|---|---|
| setData(candles) | void | — | Load or replace entire dataset. Input must be sorted by time. |
| updateCandle(candle) | void | — | Append or update the last bar with a live tick. O(1) update. |
| prependData(candles) | void | — | Prepend historical candles without re-rendering the view. |
| setChartType(type) | void | — | Switch renderer at runtime. Preserves data and indicators. |
| render() | void | — | Force a full re-render. |
| resetView() | void | — | Reset zoom/pan to full data view. |
| fitContent() | void | — | Fit all data into the visible viewport. |
| getVisibleRange() | Range | — | Return { from, to, barCount } of the current viewport. |
| getEarliestTime() | number | — | Return Unix timestamp of earliest candle in dataset. |
| getLatestTime() | number | — | Return Unix timestamp of most recent candle. |
| on(event, cb) | void | — | Register event listener. |
| off(event, cb) | void | — | Remove event listener. |
| getMetrics() | Metrics | — | Return performance metrics object (FPS, render time, memory). |
| enableProfiling(bool) | void | — | Enable/disable performance profiling. |
| screenshot() | string | — | Export chart as PNG data URL. |
| destroy() | void | — | Destroy chart, release GPU/Worker/WebSocket resources. |
API Module Map
chart.api.candlestickSet candle/bar colors, hollow mode, wick styles.
chart.api.themeSwitch theme preset or apply custom color overrides.
chart.api.axisConfigure X/Y axes, precision, log scale, inversion.
chart.api.gridToggle grid lines, colors, dash patterns.
chart.api.crosshairConfigure crosshair appearance and mode.
chart.api.indicatorAdd/remove/configure technical indicators.
chart.api.drawingDrawing tools, custom overlays, import/export.
chart.api.interactionZoom, pan, keyboard shortcuts, interaction lock.
chart.api.layoutPane management, margins, multi-pane layout.
chart.api.dataData feed connection, live streaming, disconnect.
chart.api.exportScreenshot, SVG export, JSON data export.
Core TypeScript Types
Complete Event Reference
Plugin Development
Every chart feature is a plugin. Create renderer plugins, indicator plugins, or overlay plugins by extending the appropriate base class and registering with PluginRegistry.
Performance Profiling
Export API
Multi-Pane Layout
The layout engine supports multiple stacked panes, each with their own price scale. Sub-panes are created automatically when indicators use pane: 1 or higher.
| Prop | Type | Default | Description |
|---|---|---|---|
| panes[n].height | number | string | "auto" | Pane height in pixels or '%'. Main pane fills remaining space. |
| panes[n].visible | boolean | true | Toggle pane visibility. |
| panes[n].resizable | boolean | true | Allow user to drag-resize the pane boundary. |
| panes[n].minHeight | number | 60 | Minimum pane height in pixels. |
Memory & Resource Management
- Always call chart.destroy() when unmounting (React useEffect cleanup, Vue onUnmounted).
- Large datasets: use
prependData()for lazy history loading. Avoid replacing the entire dataset during streaming. - Web Workers: Indicator calculations run off-main-thread by default. No special config required.
- IndexedDB: Use the optional
@quatick/cache-adapterto cache historical data locally. - GPU context loss: The chart listens for WebGL context-loss events and automatically recovers.