BloxwapChart SDK
API reference

Configuration

A single typed object for chart data, appearance, scales, and rendering.

Defaults and partial updates

import { defineConfig, DEFAULT_CONFIG } from '@bloxwap/chart';

const config = defineConfig({
  series: { type: 'candlestick' },
  priceAxis: { mode: 'regular', autoScale: true },
  theme: { background: '#131722' },
});

chart.updateConfig({ grid: { visible: false } });

defineConfig type-checks and returns your partial; it does not fill in defaults. resolveConfig returns a full config merged over DEFAULT_CONFIG. The defaults exported by the package are the authoritative source for every value.

Nested objects merge recursively. Arrays and functions replace. undefined entries are ignored. Treat chart.getConfig() as read-only and mutate through updateConfig so changes render and caches stay valid.

Root fields

FieldDefaultPurpose
data[]Initial candle data
width, height800, 500Initial size for an injected document's canvas
wasmtrueAttempt WASM/SIMD kernels with JS fallback
seriesCandlestickMain-series appearance
indicators, drawings[]Configured instances
indicatorPaneWeight1Sub-pane weight; the main pane weighs 3
priceAxis, timeAxisVisibleAxis appearance and transforms
timeScaleBar-indexedBar-indexed or time-continuous horizontal layout
statusLineHiddenSymbol and candle/indicator information
theme, grid, crosshairSee defaultsCanvas styling
volumeOffVolume overlay at the bottom of the main pane
watermarkHiddenText/image behind the chart
formattersBuilt-in functionsPrice and UNIX-second time label formatting

Series

FieldDefaultPurpose
typecandlestickcandlestick, hollow-candlestick, heikin-ashi, line, area, bar, histogram
upColor, downColor#26a69a, #ef5350Direction colors
colorByPreviousClosefalseDetermine direction from previous close
bodyVisible, wickVisibletrueCandle body and wick visibility
borderVisiblefalseCandle border visibility
wickUpColor, wickDownColorEmptyInherit body colors when empty
borderUpColor, borderDownColorEmptyInherit body colors when empty
lineColor, lineWidth#2962ff, 2Line/area stroke
areaFillColor, areaFillOpacity#2962ff, 0.2Area fill
histogramColor#7e57c2Histogram fallback color

Price axis

FieldDefaultPurpose
visibletrueReserve space and paint the axis
width64Minimum CSS-pixel width; explicit precision may expand it
tickCount6Approximate tick count
positionrightleft or right
autoScaletrueFit the main range to visible data
scaleSeriesOnlyfalseExclude overlay indicators from the main range
invertedfalsePut higher prices lower on the canvas
moderegularregular, percent, indexed, logarithmic
lockPriceToBarRatiofalsePreserve scale units per bar across zoom/resize
priceToBarRationullPositive ratio override; null captures the current ratio
precisionnullFixed decimal digits (0–12); null retains formatter behavior
plusButtonfalseShow the toolbar's add-price-line button on axis hover

priceAxis.labels contains lastPrice, highLow, indicator, and countdown (the bar-close countdown under the last-price badge). priceAxis.lines contains lastPrice, previousClose, and highLow. All start disabled. High/low references use the visible candle range.

Price transforms preserve raw data coordinates: yToPrice, drawing points, and candles continue to use actual prices even when the axis displays percentages.

Time axis and status line

timeAxis includes visible (true), height (24), tickCount (6), and intervalMs (null). intervalMs is the bar interval the countdown uses; null falls back to timeScale.intervalMs, then to the time between the last two candles.

statusLine includes visible (false), symbol ('Symbol'), symbolVisible, ohlc, change, volume, indicators, and countdown. All detail toggles except volume and countdown start enabled. The line follows the hovered candle or falls back to the latest candle. When the values don't fit the plot's width, as on a phone, they wrap onto more rows between values, keeping the countdown with the value before it, and the indicator rows move down. OHLC values take the candle's direction color, the change value takes the color of its sign, and both use the series up/down colors. Indicator values are labelled with a single-line study's short name or each line's style label, or with the line key in capitals for custom studies without style metadata.

See snapshots and countdown for the countdown and its ticker.

Time scale

FieldDefaultPurpose
continuousfalsePlace candles by time so gaps show as empty space
intervalMsnullSlot width in milliseconds; null infers the most common gap between candles

See time scale for what continuous mode changes and what stays bar-indexed.

Indicator instances

Each entry of indicators is an IndicatorConfig:

FieldPurpose
id, nameInstance id and registered indicator name
paramsParameter overrides merged over the definition's defaults
pane'main' or 'sub'
colorsColor overrides, indexed like the definition's defaultColors; the 'up' and 'down' tokens follow the series colors
visibleShow or hide the whole study
lineWidthsStroke width per line plot; missing or non-positive entries keep 1px. Default []
hiddenLinesKeys of lines, bars, fills, or levels to hide. Default []

Use chart.updateIndicator(id, patch) to change one. See indicators.

Volume overlay

FieldDefaultPurpose
overlayfalseDraw volume bars along the bottom of the main pane, under the series
upColor, downColor'up', 'down'Bar colors; the tokens follow series.upColor and series.downColor
opacity0.5Multiplies the bar color's alpha (0 to 1)
height0.2Fraction of the pane height reached by the tallest visible bar

The overlay has its own vertical scale, so it never changes the price range. It is independent of the vol sub-pane indicator. On a Heikin Ashi series, bars take the Heikin Ashi direction.

Canvas styling

GroupFields
themebackground, textColor, borderColor, fontFamily, monoFamily, fontSize, scaleFontSize, scaleFontFamily
gridvisible, horizontal, vertical, color
crosshairvisible, mode, color, dashed, labelBackground, labelColor
watermarkvisible, text, image, color, opacity, fontSize, fontFamily
formattersprice(value), time(timestamp)

Crosshair modes are cross, dot, arrow, and demonstration. labelColor: 'auto' chooses black or white for contrast. An empty watermark font family inherits the theme font.

theme.borderColor paints the separators between panes. theme.scaleFontSize (null) and theme.scaleFontFamily ('') set the price and time scale text; they follow fontSize and monoFamily when unset. See theming and presets.

Presets

createChart({ preset }) layers a named preset or any partial under theme and config. CHART_PRESETS holds the built-in presets, currently bloxwapDark. withPreset(preset, partial) layers them in your own code, and presetChartTheme(preset) keeps a preset's colors when the toolbar switches themes. See theming and presets.

For browser UI controls over these fields, see toolbar and settings.

Edit on GitHub

On this page