Exciting Update: Version 1.0.0 is now available, introducing high-performance technical indicators and custom drawing tools. Read more
Version: 1.0.0

window.ChartingAPI

The public ChartingAPI object provides methods to extend the canvas charting engine, register technical indicators, custom candles, drawing tools, horizontal options scales, and configure global watermark overlays.

Overview

The ChartingAPI is exposed globally on the window namespace. It serves as the bridge between native environments (iOS WKWebView / Android WebKit WebView) and the charting bundle scripts.

Candles & Rendering

registerCandleType(type, renderFn) Method

Registers a new candle renderer function that draws custom style candles on the HTML5 canvas.

Parameters:
  • type: string (e.g. 'heikin_ashi', 'hollow')
  • renderFn: function(ctx, visibleBars, slot, bodyW, chartH, priceToY, themeColors, xOffset, chartInstance)
ChartingAPI.registerCandleType('my_candle', (ctx, bars, slot, bodyW, chartH, priceToY) => {
  // custom rendering logic
});
getCandleRenderer(type) Method

Retrieves the registered candle renderer function by type name.

Returns: function | null
getAvailableCandleTypes() Method

Returns a list of all registered candle renderer keys.

Returns: string[]

Custom Drawings

registerCustomDrawing(type, config) Method

Registers a new vector drawing tool configuration.

Parameters:
  • type: string
  • config: object { clicks: number, render: function, renderPreview: function, hitTest: function }
getCustomDrawing(type) Method

Retrieves a registered custom drawing config by name.

Returns: object | null
getAvailableCustomDrawings() Method

Returns all custom drawing names.

saveDrawings(chart) Method

Saves the vector drawings of the chart instance to browser LocalStorage.

loadDrawings(chart) Method

Loads drawings from browser LocalStorage for the current chart symbol and renders them.

registerPriceScaleDrawingLabel(renderFn) Method

Registers a renderer function for drawing label values on the vertical Y-axis price scale.

registerTimescaleDrawingLabel(renderFn) Method

Registers a renderer function for drawing label values on the horizontal X-axis time scale.

Technical Indicators

registerIndicator(type, config) Method

Registers a custom technical indicator (such as SMA, RSI, MACD, Bollinger Bands) to the charting engine registry.

Parameters:
  • type: string
  • config: object { name: string, type: 'pane' | 'overlay', params: object, calculate: function, render: function }
getIndicator(type) Method

Retrieves the technical indicator configuration registered with the specified type.

getAvailableIndicators() Method

Returns a list of all registered indicator types.

Horizontal Scales

registerHorizontalScale(type, scaleObj) Method

Registers a new custom horizontal scale helper (e.g. yield-curve or option strikes scale mapping indices to x-axis positions).

Parameters:
  • type: string
  • scaleObj: object { barToX, xToBar, getVisibleRange, drawTimeScale, drawTimeBadge }
getHorizontalScale(type) Method

Retrieves the registered horizontal scale helper object by its name.

getAvailableHorizontalScales() Method

Returns keys of all registered horizontal scales.

Intervals & Loader

registerCustomInterval(resolution) Method

Registers a new custom interval (resolution) to appear inside the timeframe selector dropdown toolbar.

getCustomIntervals() Method

Returns all registered custom resolution intervals.

getSmartLoader() Method

Retrieves the SmartLoader constructor class used to handle scrollback historical fetching.

Watermarks

setWatermark(settings) Method

Sets global chart watermark overlay parameters dynamically and triggers a render sweep.

Settings:
  • show: boolean
  • watermarkMode: 'always' | 'replay' | 'none'
  • watermarkColor: string
  • showWatermarkTicker: boolean
  • showWatermarkDescription: boolean
  • showWatermarkInterval: boolean
getWatermark() Method

Returns the current watermark settings object.

getPendingWatermarkSettings() Method

Returns pending watermark changes (used before chart init is finalized).