Skip to content

Packages

API reference

Every export of every package, grouped by what it is for.

How This Page Is Organized

Every runtime export of every package, at version 0.1.0, grouped by package and then by purpose. Type-only exports are listed where they matter and omitted where they are only the options object of the function above them.

@ortex-charts/financial re-exports all of @ortex-charts/core, so anything in the core tables is importable from financial too. Nothing re-exports @ortex-charts/math: data types such as Bar and Tick are imported from there directly.

The Entry Points

The five functions that create something. Everything else configures or extends what they return.

function createChart(container: HTMLElement, options?: DeepPartial<ChartOptions>): Chart;

function createFinancialChart(container: HTMLElement, options?: FinancialChartOptions): FinancialChart;

function createChartShell(container: HTMLElement, options?: ChartShellOptions): ChartShell;

function createSparkline(container: HTMLElement, options?: Partial<SparklineOptions>): Sparkline;

function createAdapter(spec: AdapterSpec, deps?: AdapterDeps): Adapter;

Plus the three in @ortex-charts/viz: createTreemap, createHeatmap and createCategoryChart, each (container, options) => Component.

@ortex-charts/math

Pure functions and small classes. No DOM, no canvas. Runs in Node and in a worker.

Data Types and Conversion

Export Description
Bar One OHLCV row, with optional buyVolume and sellVolume.
Tick One trade: time, price, size, optional aggressor side.
BarSeries OHLCV in struct-of-arrays form with Float64Array columns.
ValueSeries Single-value series in the same form.
TimeValuePoint A [time, value] pair.
Range A numeric [from, to] pair.
barSeriesFromRows(rows) Rows to columns; allocates the aggressor columns only when a row carries them.
barSeriesToRows(series) Columns back to rows.
valueSeriesFromPoints(points) [time, value] pairs to columns.
valueSeriesFromColumns(time, value) Two arrays to a ValueSeries; throws when the lengths differ.
EMPTY_BARS A shareable empty BarSeries.
clamp(v, lo, hi) Clamp a number into a range.

Scales

Export Description
PriceScale Value-to-pixel mapping for one price axis, with autoscale and margins.
PriceScaleMode "normal" | "logarithmic" | "percentage" | "indexedTo100".
PriceScaleOptions Options for PriceScale (distinct from the chart's own price-scale options).
TimeIndexScale The index-based time axis: bar index to pixel, time to fractional index, zoom and scroll, extrapolation past the data.
TimeIndexScaleOptions, LogicalRange Its options and visible-range type.
symLog10(v) Symmetric base-10 log, linear near zero and defined for negatives.
symPow10(t) Its inverse.

Ticks

Export Description
priceTicks(...) Nice tick values for a price scale given pixel height and a minimum label gap.
PriceTick, PriceTickOptions Its result and options.
timeTicks(...) Ticks for the index axis with weighted labels so labels never collide.
TimeTick, TimeTickOptions Its result and options.
TickWeight The label significance ladder: year beats month beats day beats hour.
minimumWeight(barSpacing, minLabelGap, resolution) The finest weight worth labeling at a given zoom.
labelFor(parts, weight, locale) Label text for a tick: the coarsest unit that changed.

Formatting

Export Description
formatPrice(v, options?) Grouped fixed-precision number with an ASCII minus.
formatPercent(v, options?) Percentage formatting.
formatCompact(v, options?) 1.23M, 4.56B.
formatVolume(v) Volume shorthand.
precisionFromMinMove(minMove) Decimals implied by a minimum move.
precisionForRange(lo, hi, tickCount, minPrecision?) Decimals needed so neighboring tick labels differ.
NumberFormatOptions precision, grouping, sign.
formatBarTime(time, options) Bar label appropriate to the resolution.
formatClock(time, options) Time of day in a zone.
formatDate(time, options) Date in a zone.
TimeFormatOptions timeZone, resolution, locale.

Time Zones

Export Description
zonedParts(time, zone) Wall-clock parts of a timestamp in a zone.
ZonedParts Their shape.
tzOffsetMinutes(time, zone) Offset from UTC at that instant.
zonedTimeToUtc(parts, zone) Wall-clock parts back to a timestamp.
localWallToUtc(localMs, zone) A local wall-clock millisecond value back to UTC.
startOfZonedDay(time, zone) Midnight of that day in the zone.
minuteOfZonedDay(time, zone) Minutes since midnight in the zone.

Resolutions

Export Description
parseResolution(text) "1", "15", "1D", "1W", "1M" to a Resolution; throws on nonsense.
Resolution, ResolutionUnit The parsed form and its unit.
floorTimeToBar(time, res, zone?) Start of the bar containing a time, honoring anchorMinute.
nextBarTime(time, res, zone?) Start of the following bar.
sameBar(a, b, res, zone?) Whether two times share a bar.
anchoredResolution(res, session) A resolution phased from the session open.
intervalForUnit(unit) The D3 interval for a resolution unit.

Sessions

Export Description
parseSession(text) "0930-1600", "0400-0930,0930-1600", "24x7", with an optional :days suffix.
Session, SessionSegment The parsed form.
mergeSegments(segments) Sort and merge touching or overlapping segments.
sessionMinutes(session) Total minutes in a session.
isInSession(time, session, zone) Membership, including overnight wraps.
sessionBoundsForDay(time, session, zone) [start, end] pairs for that day.
sessionMinuteAt(time, session, zone) Minutes elapsed in the session, NaN when closed.

Bars and Alignment

Export Description
ticksToBars(ticks, res, zone?) Trades to bars.
applyTick(last, tick, res, zone?) Fold one tick into the current bar; returns the bar and whether it appended.
aggregateBars(series, res, zone?) Coarser bars from finer ones, carrying aggressor volumes through.
heikinAshi(series) The Heikin-Ashi transform.
finiteRange(bars) Bar-index range whose close is finite.
priceExtent(bars, from, to) Min low and max high over an inclusive index range.
valueExtent(values, from, to) Min and max of a value column over an inclusive index range.
BarBuffer Growable OHLCV storage with amortized appends and zero-copy views.
alignToTimeline(masterTimes, series, options?) One value per master time, NaN where the rules give nothing.
alignTail(masterTimes, from, series, options?) The same for the tail only, which is the live path.
timesToIndices(masterTimes, times, barDurationMs) Fractional master indices for arbitrary times.
unionTimes(...columns) One sorted, de-duplicated timeline from several.
AlignMode, AlignOptions "exact" | "forwardFill" | "nearest" | "bucket", and maxGapMs.
Export Description
rollingSum, rollingMean, rollingStd, rollingMin, rollingMax Windowed statistics over a Float64Array.
ema(values, length) Exponential moving average.
wilderSmooth(values, length) Wilder's smoothing, for RSI and ATR.
pctChange, logReturns, cumulativeReturn, diff Return series.
lowerBound, upperBound Bisect on a sorted array.
nearestIndex(sorted, t) Closest index; ties go earlier.
indexRange(sorted, t0, t1) Inclusive index range within a value range.

Geometry

Export Description
traceLine(ctx, xs, ys, options?) Trace a polyline; NaN breaks the line into gaps.
traceArea(...) Trace a closed area between a series and a baseline.
crisp(px, lineWidth?, dpr?) Snap a coordinate so a one-pixel line is not blurred.
PathContext, CurveKind, PathOptions The minimal canvas path surface, "linear" | "step" | "monotone" | "smooth", and options.

@ortex-charts/core

The canvas engine.

Chart

Export Description
createChart(el, options?) Create a chart.
Chart The engine class; see the method groups below.
TimeScaleApi chart.timeScale: ranges, conversions and the range subscription.
CHART_DEFAULTS The full default ChartOptions.
ChartOptions and the option interfaces PriceScaleOptions, TimeScaleOptions, CrosshairOptions, CrosshairLineOptions, CrosshairMode, GridOptions, LegendOptions, WatermarkOptions.

Chart methods, grouped:

  • Options and theme: options, applyOptions, theme, setTheme, resolution.
  • Panes: addPane, removePane, pane, panesList, resizePanes, setPaneCollapsed, isPaneCollapsed, maximizePane, restorePanes, maximizedPane, subscribePaneChange.
  • Scales: priceScale, zoomPriceScale, panPriceScale, resetPriceScale, valueAtPixel.
  • Series: addSeries, removeSeries, series, getSeries, mainSeries, setMainSeries, times, nextPaletteColor, subscribeDataChange.
  • Price lines: addPriceLine, removePriceLine.
  • Primitives: addPrimitive, removePrimitive, primitive, paneView.
  • Interaction and events: subscribeCrosshairMove, subscribeClick, subscribeDblClick, subscribeLegendMenu, setCrosshairPosition, clearCrosshairPosition, crosshairState, setCursor.
  • Geometry: paneRect, plotRect, zoneAt.
  • Lifecycle: resize, size, requestDraw, flush, takeScreenshot, remove.

TimeScaleApi methods: fitContent, scrollToRealtime, scrollByPixels, zoom, setVisibleRange, setVisibleTimeRange, visibleRange, setBarSpacing, barSpacing, timeToCoordinate, coordinateToTime, indexToCoordinate, coordinateToIndex, timeToIndex, indexToTime, subscribeVisibleRangeChange.

Panes and Scales

Export Description
PaneModel A pane: canvases, legend element, scales and primitives.
PaneOptions heightRatio, minHeight, collapsed.
PriceScaleState One price scale in a pane; applyOptions, zoomAt, panBy, resetAutoScale, currentPlotDomain.
PRICE_SCALE_DEFAULTS Default price-scale options.

Series

Export Description
SeriesModel A series: data, options, alignment, price lines.
SeriesHost The interface a chart satisfies for a series.
registerSeriesType(name, def) Register a renderer so addSeries(name, …) works.
getSeriesType(name) Look one up; throws with the registered names.
SeriesTypeDef, SeriesView, SeriesKind The renderer contract.
SeriesTypeMap, BuiltInSeriesType Type-level map from a built-in name to its options.
SeriesOptionsBase, SeriesDataInput, SeriesValue Common options, accepted inputs, and the crosshair value shape.
LineSeriesOptions, AreaSeriesOptions, BaselineSeriesOptions, HistogramSeriesOptions, CandlestickSeriesOptions, BarSeriesOptions Per-type options.
pixelColumns(view, key) Pixel columns for the visible range, with one extra bar each side.
drawDecimated(...) Draw a dense line as one minimum and one maximum per pixel column.
bodyWidth(barSpacing, ratio) Candle body width that never exceeds the gap.
ohlcValueAt(columns, index) OHLCV at an index, or null.

SeriesModel methods: setData, update, updateNow, applyOptions, setType, valueAt, primaryValue, lastIndex, holdUpdates, releaseUpdates; properties id, type, kind, options, columns, raw, rawTimes, rawLength, holding, priceLines, optionsChanged.

Primitives, Drawing and Layout

Export Description
PanePrimitive, PaneView, PrimitiveLayer, PrimitivePointerEvent The primitive contract.
PriceLineOptions A horizontal line at a value with an axis label.
CanvasLayer A device-pixel-ratio aware canvas.
FrameScheduler Coalesces draw requests onto one animation frame.
applyLineStyle, hline, vline, roundRect, measureText, drawLabel, drawText Canvas helpers a primitive can reuse.
LabelStyle Options for drawLabel.
inRect(rect, x, y), Point, Rect Geometry helpers.

Theme and Formatting

Export Description
darkTheme, lightTheme The two built-in token sets.
Theme The token interface.
resolveTheme(theme) "dark", "light" or an object to an object.
parseColor(color) Any accepted color string to [r, g, b, a].
withAlpha(color, alpha) The same color at a new alpha.
contrastText(background) Black or white, whichever reads.
formatValue(value, priceFormat) Exactly what the chart would print for a series value.
formatAxisValue(value, format, lo, hi, tickCount) The same for an axis tick, adding decimals on a narrow range.
PriceFormat type, precision, minMove, optional formatter.

Events, Utilities and Licensing

Export Description
Emitter The minimal event emitter the library uses.
Listener, DeepPartial Its listener type, and the recursive partial used by every options argument.
merge(base, patch) Deep merge used by applyOptions.
uid(prefix) Unique id generator.
CrosshairEvent, VisibleRangeEvent, LegendMenuEvent, HitResult Event payloads.
LineStyle, PriceScalePosition "solid" | "dashed" | "dotted", "left" | "right" | "overlay".
setLicenseKey(key, options?) Install a license key; resolves with the final status.
licenseStatus() The current LicenseStatus.
hasFeature(name) Whether the current license grants a feature.
onLicenseChange(cb) Subscribe to status changes.
clearLicense() Reset to unlicensed, mostly for tests.
domainAllowed(hostname, domains) The domain-matching rule, including the localhost exemption.
ORTEX_CHARTS_PUBLIC_KEY The embedded Ed25519 verification key.
LicenseState, LicensePayload, LicenseStatus, SetLicenseOptions Licensing types.
Branding, BRANDING_DEFAULTS, BrandingOptions, BrandingPosition The mark and its options.
ortexLogoSvg, ortexLogoDataUri, ORTEX_LOGO_ASPECT The wordmark as markup, as a data URI, and its aspect ratio.

@ortex-charts/financial

Everything in core, plus the following.

The Financial Chart

function createFinancialChart(container: HTMLElement, options?: FinancialChartOptions): FinancialChart;
Member Description
chart, main, volume The core chart, the main series, and the volume series or null.
setData(bars), update(bar) Data in.
setSeriesType(type, options?), seriesType() Switch the main series style without losing state.
addIndicator(id, inputs?, options?) Add an indicator.
setMarkers(markers) Trade-style marks; returns the primitive.
setEvents(events) Time-anchored annotations; returns the primitive.
setFootprint(flow, options?) Order-flow cells, and exact aggressor volumes on the bars.
addVolumeProfile(options?) A volume or market profile on the main pane.
replay(options?) The bar-replay controller, created on first use.
alerts(options?) The price-alerts primitive, created on first use.
live(source, options?) Stream a live source into the main series.
connect(wsOptions, streamOptions?) Open a WebSocket and stream it in.
bind(feed, options) Bind a datafeed.
remove() Dispose.

MainSeriesType is "candlestick" \| "bar" \| "line" \| "area" \| "baseline".

Data

Export Description
bindDatafeed(chart, series, feed, options) Initial load, lazy history, realtime subscription, symbol and resolution switching.
Datafeed, BarsRequest, BarsResponse, SymbolInfo, BindOptions, DatafeedBinding The datafeed contract.
WebSocketSource, websocketSource(options) A reconnecting WebSocket that parses messages into items.
ManualSource A source you push into.
pollingSource(fetchNext, intervalMs) Poll an async function.
LiveSource, SocketStatus, WebSocketSourceOptions Source types.
streamTo(series, source, options?) Fold live items into a series; what live calls.
StreamOptions, LiveItem Its options and the accepted item shapes.

Adapters

Export Description
createAdapter(spec, deps?) Build a datafeed and live sources from a spec; throws on an invalid one.
validateAdapterSpec(spec) Structural checks with actionable messages.
Adapter, AdapterDeps The result and its injectable dependencies.
AdapterError Thrown with the list of problems.
ortexAdapterSpec(options), OrtexAdapterOptions The preset for the ORTEX API.
AdapterSpec, HistorySpec, LiveSpec, SymbolSpec, SearchSpec, MessageSpec, RecordSpec, RecordsSpec, RecordKind, FieldSpec, FieldRef, TimeFieldSpec, TimeUnit, Condition, JsonTemplate, DateParamSpec The spec vocabulary.
getPath, readField, readNumber, parseTime, formatTimeParam Field and time readers, exported so a host can reuse them.
fillTemplate, fillJsonTemplate, matches Template filling and condition matching.
mapRecord, mapRecords, explainMapping Mapping, and why a sample produced nothing.
MappedRecord, TemplateContext Their types.

Indicators

Export Description
addIndicator(chart, id, inputs?, options?) Add an indicator to any chart.
registerIndicator(def) Register your own.
getIndicator(id) Look one up; throws with the registered ids.
listIndicators() Every registered definition.
indicators The built-in library namespace, including BUILT_IN_INDICATORS and barDelta.
sourceColumn(columns, source) Resolve close, hl2, hlc3, ohlc4 and the rest.
IndicatorDef, IndicatorInput, IndicatorOutput, IndicatorContext, IndicatorInputType, AddIndicatorOptions, IndicatorInstance The indicator contract.

Markers, Events, Drawings

Export Description
addSeriesMarkers(chart, series, markers), SeriesMarkersPrimitive Trade-style marks.
SeriesMarker, MarkerShape, MarkerPosition Their types.
addEvents(chart, series, events, options?), EventsPrimitive Lanes, badges, callouts, lines and ranges.
ChartEvent, EventStyle, EventsOptions Their types.
createDrawingTools(chart, options?), DrawingsPrimitive Drawing tools on a pane.
Drawing, DrawingKind, DrawingPoint, DrawingStyle, DrawingChange, DrawingToolsOptions Their types.
DRAWING_STYLE_DEFAULTS, POINTS_REQUIRED Default style, and points needed per tool.

Order Flow

Export Description
addFootprint(chart, series, flow?, options?), FootprintPrimitive Footprint cells and the fallback delta strip.
footprintFromTicks(ticks, res, tickSize, zone?) Build footprints from sided ticks.
mergeFootprint(bars, flow) Copy aggressor totals onto bars.
footprintTotals(bar) Buy, sell, total, delta and the bar point of control.
footprintIndex(times, bar) The bar index a footprint belongs to.
addVolumeProfile(chart, series, options?), VolumeProfilePrimitive Volume and market profiles.
computeProfile(cols, from, to, options?, flow?) The pure function behind them.
FootprintBar, FootprintLevel, FootprintTotals, FootprintOptions Footprint types.
Profile, ProfileRow, ProfileKind, ProfileMode, ProfileColumns, VolumeProfileOptions Profile types.

Replay, Linking, Alerts

Export Description
createReplay(target, options?), ReplayController Bar replay with higher-timeframe followers.
ReplayState, ReplayOptions, ReplayTarget Its types.
linkCharts(charts, options?), LinkOptions Synchronize time range and crosshair across charts.
addAlerts(chart, series, options?), AlertsPrimitive Draggable price alerts with crossing events.
Alert, AlertEvent, AlertsOptions Their types.

@ortex-charts/lite

Export Description
createSparkline(el, options?), Sparkline The 4.8 KB table-cell chart.
SPARKLINE_DEFAULTS Default options.
SparklineOptions, SparklineKind, SparklineData Its types.
renderScheduler The animation frame shared by every sparkline on the page.

@ortex-charts/ui

Export Description
createChartShell(el, options?) Toolbar, drawing rail and chart in one call.
ChartShell, ChartShellOptions The handle and its options.
ChartLayout, LayoutIndicator, SeriesPlacement, ScaleMode The layout JSON a host stores.
OverlayDef, OverlayContext Host-defined data overlays.
overlayKey(id, symbol, current), parseOverlayKey(key, current) The id@SYMBOL convention for compared symbols.
ToolbarItem, ToolbarAction The switches, and host buttons and menus.
DEFAULT_RESOLUTIONS ["1", "5", "15", "60", "1D", "1W", "1M"].
resolutionLabel(res) "60" to "1h", "1D" to "D".
DrawingsStore, localStorageDrawingsStore(prefix?) Drawings that follow the symbol.
openDataPicker(options), DataPickerOptions, PickerItem The "Add data to chart" modal.
openMenu(root, anchor, build, onClose?), Menu, MenuItemSpec Keyboard-navigable dropdowns.
openDialog(root, options), DialogOptions, FieldSpec, FieldValue Modal forms with a focus trap.
openSymbolSearch(options), SymbolSearchOptions The debounced symbol search popover.
ICONS, icon(name), IconName 52 inline SVG icons using currentColor.
UI_CSS, ensureStyles(doc), applyThemeVars(el, theme) The chrome stylesheet and its theme variables.
h(doc, tag, attrs?), button(spec), ButtonSpec DOM helpers used by the toolbar.
downloadCanvas(canvas, name), downloadText(text, name) Browser download helpers.

@ortex-charts/viz

Export Description
createTreemap(el, options?), Treemap, TREEMAP_DEFAULTS Sized-and-colored rectangles with drill-down.
TreemapNode, TreemapLayoutNode, TreemapLayoutOptions, TreemapOptions, TreemapHit Its types.
layoutTreemap(...), treemapLeaves(node), findPath(root, node) The layout without the canvas.
createHeatmap(el, options?), Heatmap, HEATMAP_DEFAULTS A row-by-column grid with a color scale.
HeatmapOptions, HeatmapScaleOptions, HeatmapHit Its types.
resolveHeatmapDomain(...), createColorScale(...) The scale, for host-drawn legends and table cells.
createCategoryChart(el, options?), CategoryChart, CATEGORY_CHART_DEFAULTS Bars and columns, stacked or grouped.
CategoryChartOptions, CategorySeries, CategoryValueAxisOptions, CategoryAxisOptions, CategoryHit Its types.
sortedCategoryOrder(...), categoryExtent(...) Ordering and extent helpers.
VizComponent, VizBaseOptions, ThemeInput The shared component base.
Tooltip, TooltipContent, TooltipRow The DOM tooltip the components use.
formatValue(value, format), ValueFormat Viz number formatting.
niceTicks(...), niceDomain(...), thinLabels(...), thinnedIndices(...), fitText(...), LabelThinning Axis and label helpers.
blend(a, b, t) Color interpolation.
canvasToPNG(canvas, options?), downloadPNG(...), downloadBlob(...) Image export.
rowsToCSV(rows, columns?, options?), downloadCSV(...), CSVColumn, CSVOptions CSV export.
composeCanvases(canvases, background?, options?), ComposeOptions Stack canvases into one image.
renderScheduler The shared animation frame.
VIZ_VERSION The package version string.

@ortex-charts/react

Export Description
Chart, ChartProps The core chart in a div; children attach to it.
Pane, PaneProps An extra pane; provides its id to nested series.
Series, SeriesProps, SeriesOptionsFor A series on the enclosing chart and pane.
FinancialChart, FinancialChartProps, IndicatorSpec The financial chart with data, indicators, markers and a live source as props.
ChartShell, ChartShellProps The full shell, with controlled symbol, resolution, theme and layout.
Sparkline, SparklineProps A sparkline in an inline-block span.
useChart(), usePaneId() Context accessors for your own children.
ChartContext, PaneContext The contexts themselves.
useChartEvents(chart, props), ChartEventProps Subscribe a chart to the four event props.
useLiveSource(factory, deps) A LiveSource that survives re-renders and is closed once.

The package also re-exports the types callers need alongside the components: ChartHandle, ChartOptions, DeepPartial, SeriesModel, SeriesDataInput, SeriesOptionsBase, SeriesTypeMap, CrosshairEvent, VisibleRangeEvent, FinancialChartHandle, FinancialChartOptions, SeriesMarker, LiveSource, LiveItem, StreamOptions, AddIndicatorOptions, IndicatorInstance, SparklineHandle, SparklineOptions, SparklineData, ChartShellHandle, ChartShellOptions, ChartLayout, OverlayDef and Bar.

Registries You Can Extend

Three registries decide what the library can draw, and all three are open.

registerSeriesType(name, def);   // core — a new series renderer
registerIndicator(def);          // financial — a new indicator
chart.addPrimitive(primitive);   // core — anything else drawn on a pane

Everything built in goes through these same three, so a series type, indicator or primitive you register is not a second-class citizen: it appears in the legend, the toolbar menus and saved layouts exactly as the built-ins do. See Series types, Indicators and Concepts.