# Unifin Charts - full documentation (v26.10.18) --- # Documentation (Shared edition) Source: /docs import { LiveChart } from '@/components/live-chart'; Unifin Charts ships as one engine in two editions. The documentation mirrors that split: **Standard** covers the charting core, the series, the indicators, the look pack and the embedding surfaces; **Pro** covers the workspace layer, the terminal panels, the order book chart and the screeners. The reference pages (API, editions, versions, changelog) are shared by both. ## Standard chart One live scene with every Standard feature on: streaming bars, volume, legend, OHLC readout, price tag, sparks, hover card, event lane, price line, A-B ruler and the timeframe switch. The palette is the Unifin gradient in dark. The mark in the bottom-left corner is the attribution of the Standard surface - the sign and the name of the library, linked to this site. Pro is white-label and renders without it (Editions (/docs/editions)). ## Editions | Edition | Covers | Entry point | | --- | --- | --- | | **Standard** | Core rendering, scales, series, indicators, drawings, profiles, effects, embedding | `@unifin/chart-react`, `@unifin/chart-element`, `@unifin/chart-core` | | **Pro** | Analytic figures, analytics kits, terminal panels, order book chart, screeners | `@unifin/chart-react/pro` on top of Standard | - Standard edition (/docs/standard) - start here: install, first chart, series, indicators, features, effects, gallery. - Pro edition (/docs/pro) - surfaces of the Pro entry point. - Editions (/docs/editions) - entry points, surfaces and budgets. - Product comparison (/docs/product-comparison) - capability table against a typical library. ## Shared reference - API overview (/docs/api) - renderer, series, scales, React, custom element, kits and indicators. - Theming and accessibility (/docs/standard/features) - palettes, tokens, locale packs, keyboard and ARIA. - Android and web views (/docs/android) - embedding the same bundles in a native shell. - iOS applications (/docs/ios) - the same page and bridge inside a `WKWebView`. - AI integrations (/docs/ai) - the machine-readable surfaces of the portal. - Versions (/docs/versions) and Changelog (/docs/changelog) - one version number per release. ## Finding a page Every page that moved when the editions were introduced keeps its old address and points to the new one, so external links keep working. If a link lands on a moved page, the browser is sent to the new address automatically. --- # Standard edition (Standard edition) Source: /docs/standard import { LiveCatalogue } from '@/components/live-catalogue'; This page covers the Standard edition: what the library contains and how the packages fit together. For a first working chart, read Getting started (/docs/standard/getting-started). The professional surfaces are documented in the Pro edition (/docs/pro) - the engine is the same in both. Unifin Charts is a charting library for financial products. It draws market data on canvas, keeps chart state in a framework-free core and ships bindings for React and plain HTML pages. ## What is included | Area | Contents | | --- | --- | | Rendering | Canvas2D renderer with an optional WebGL2 backend, six token-based palettes (dark, light, corporate, capitalMarkets, orange, unifin) with the `system` alias, four presentation profiles | | Series | 23 types: candles, outline candles, bars, line, area, histogram, step, baseline, footprint, renko, kagi, point-and-figure, line break, volume candles, line with markers, HLC area, HLC glow, HLC bars, high-low, columns, range columns, Heikin-Ashi glow, delta candles | | Scales and panes | Linear, logarithmic, percentage, indexed-to-100 and volume scales; up to 16 panes with per-pane scales | | Data | Bars and ticks, 22 timeframes with resampling, pageable feeds, caching, reconnecting streams | | Indicators | Registry-driven engine with incremental recalculation and a catalogue of 128 studies, listed on Indicators (/docs/standard/indicators) | | Drawings | 96 tools, undo and redo, templates, snapshots, share links | | Profiles | Volume profile, POC and value area, clusters, TPO | | Order flow | Footprint chart, ladder, tape, cumulative delta, and a Pro order book chart with five variants | | Trading UI | Order ticket with six order types, risk ruler, draggable stop and take levels, read-only roles | | Alerts | Rule conditions, message templates, retry policy, delivery over platform channels | | Embedding | React components, a custom element, and a core you can drive from your own canvas | ## Try a chart on this page The catalogue below renders inside this page with the published packages - no iframe and no example server. Switch the series type and the theme: ## Install the packages ```bash pnpm add @unifin/chart-react # React components, bindings and the core pnpm add @unifin/chart-element # the custom element pnpm add @unifin/chart-core # core only, no framework ``` ## Create a chart ```tsx import { UnifinChart } from '@unifin/chart-react'; export function PriceChart({ bars }) { return ( ); } ``` The component creates the canvas and forwards props to the core; chart state stays in the core. ## How the packages are arranged | Package | Role | | --- | --- | | `@unifin/chart-core` | Rendering, scales, data, indicators, drawings, profiles, order flow, trading models, SDK | | `@unifin/chart-react` | React components, hooks and the framework-free binding; Pro entry point for panels | | `@unifin/chart-element` | `` for Vue, Angular and static pages | | `@unifin/chart-indicators` | The 128-study catalogue on top of the engine | | `@unifin/chart-kit-bonds`, `@unifin/chart-kit-portfolio`, `@unifin/chart-kit-options` | Domain kits: yield maths, portfolio risk, option surfaces | > **Note** All packages are versioned in lockstep: one number per release, so an edition and the > core can never drift apart. See Versions (/docs/versions). ## See also - Getting started (/docs/standard/getting-started) - install, first chart, themes, events. - Series types (/docs/standard/series-types) - every chart type with a snippet and a frame. - Features (/docs/standard/features) - scales, panes, indicators, drawings, order flow, accessibility. - Live gallery (/docs/standard/gallery) - the series explorer and the theme switch on this portal. - Pro edition (/docs/pro) - workspace layer, terminal panels, order book chart and screeners. - API overview (/docs/api) - renderer, series, scales, React and element surfaces. --- # Getting started (Standard edition) Source: /docs/standard/getting-started import { LiveChart } from '@/components/live-chart'; This page takes you from an empty project to a chart with data, a theme and a locale. Both charts below are rendered on this page by the library itself, and the same chart appears in the Pro edition (/docs/pro) - Pro adds surfaces on top of it instead of replacing it: ## Before you start - Node.js 18 or newer and a package manager (`pnpm`, `npm` or `yarn`). - Historical bars of the instrument you want to show, as an array of plain objects. - For live updates: a feed that pushes bars or ticks, for example over WebSocket or SSE. ## Install the packages ```bash pnpm add @unifin/chart-react # React components and the core pnpm add @unifin/chart-element # the custom element pnpm add @unifin/chart-core # framework-free core only ``` Install the package that matches your host: `chart-react` already depends on the core, so a React application does not install `chart-core` separately. ## Add the stylesheet once The look of the kit controls (panels, dialogs, toolbars, the data table) ships as a stylesheet asset of the binding, not as code inside it, so a page pays for the CSS once and no CSS text travels in the JavaScript bundle: ```ts import '@unifin/chart-react/styles.css'; // once, before the first kit control renders ``` A host that cannot load a file (a widget built by hand, a test harness) hands the text over instead: `ensureUiStyles(document, { styles })`. The chart itself needs no stylesheet at all. ## Prepare the data Bars and ticks are plain objects - no adapters, no classes: ```ts type Bar = { time: number; // UTC milliseconds of the bar open open: number; high: number; low: number; close: number; volume: number; }; type Tick = { time: number; price: number; size: number; side?: 'buy' | 'sell' }; ``` > **Note** `time` is always UTC milliseconds of the bar open, never a local time and never seconds. > Bars must be sorted by `time`; the library keeps the order it receives. ## Create a chart in React ```tsx import { DARK_THEME, UnifinChart } from '@unifin/chart-react'; export function Terminal({ bars }: { bars: Bar[] }) { return ( console.log('chart ready', chart)} /> ); } ``` The component owns the canvas and forwards props to the core. Series, scales and interaction state live in the core, so nothing is duplicated in React state - read values through the handle from `onReady` or listen to events. ## Create a chart on a plain page ```html import { defineUnifinChart } from '@unifin/chart-element'; defineUnifinChart(); const chart = document.querySelector('unifin-chart'); chart.bars = await loadBars('AAPL', '5m'); chart.addEventListener('unifin-ready', (event) => console.log(event.detail)); ``` Attributes cover scalars, properties take data (`bars`, overlays, drawings), and events arrive as `CustomEvent`. The element sets `role`, `aria-label` and a keyboard map on the host unless you provide your own. ## Apply a theme `theme` accepts `dark`, `light`, `corporate`, `capitalMarkets`, `orange`, `unifin` and `system` (`system` follows `prefers-color-scheme`), or a theme object you build yourself: ```tsx ``` Every name resolves through the registry exported by the core, so a host can also pass the palette object directly: ```ts import { CHART_THEMES, resolveThemeByName } from '@unifin/chart-core'; const corporate = CHART_THEMES.corporate; const unifin = resolveThemeByName('unifin'); ``` | Name | Look | Fits | | --- | --- | --- | | `dark` | Navy surface, blue accent | Terminals, night layouts (default) | | `light` | Near-white surface, deep blue accent | Documents, printing, daylight | | `corporate` | Flat light grey, restrained blue | Reports, portfolio and screening pages | | `capitalMarkets` | Charcoal surface, brass accent, compact density | Dense professional terminals | | `orange` | Near-black surface, amber accent, monospace readout | Trading desks and wall boards | | `unifin` | Brand navy with a teal accent | Brand pages and product demos | | `system` | `dark` or `light` by host preference | Shells that follow the OS | The switch never rebuilds the chart: a palette is a set of token values, so only the paint pass runs. Colors, radius, font and row density come from the host design tokens (`--ud-*`, `--ud-radius`, `--ud-density`), so a white-label shell restyles the chart without touching layout. ## Set the locale, the profile and the hover hold | Option | Values | What it changes | | --- | --- | --- | | `locale` | `ru`, `en`, `uz`, `kz` | Axis labels, numbers, dates, accessibility text | | `renderProfile` | `sparkline`, `mini`, `standard`, `terminal` | Which layers are painted and how dense they are | | `seriesType` | Any registered series type | How bars are drawn (see Series types (/docs/standard/series-types)) | | `priceAxisWidth` | Pixels | Width of the value axis; `0` hides it | | `tooltipHold` | Milliseconds | How long the hover card and the crosshair readout stay after the pointer leaves | The hover card does not vanish with the pointer: the last hover is kept for a hold window so the values stay readable. The default is five seconds (`TOOLTIP_HOLD_MS` in the core), any value up to 60000 ms is accepted, and `0` hides the card the moment the pointer leaves. React takes the prop, plain HTML takes the attribute: ```html ``` ```tsx ``` ```ts import { Canvas2DRenderer, DARK_THEME, Series, PriceScale, TimeScale } from '@unifin/chart-core'; const series = new Series('AAPL', '5m'); series.setHistory(bars); const timeScale = new TimeScale({ width: 896, barSpacing: 5 }); timeScale.setBarCount(series.length); timeScale.setVisibleRange(series.length - 90, series.length); const priceScale = new PriceScale(); priceScale.setHeight(540); priceScale.fitContent(series.toArray(), series.length - 90, series.length); new Canvas2DRenderer().render(context, { bars: series.toArray(), width: 960, height: 540, timeScale, priceScale, theme: DARK_THEME, seriesType: 'candles', timeframe: '5m', locale: 'en', priceAxisWidth: 64, renderProfile: 'standard', }); ``` ## Drive the core directly Hosts that own the canvas call the renderer themselves. The snippet above is the whole contract: one `TimeScale`, one `PriceScale` and the bars. Re-render on resize and on every data update; the renderer keeps no global state. > **Caution** A canvas with zero height paints nothing. Give the container a width and a height > before the first render, and re-render after a layout change. ## See also - Series types (/docs/standard/series-types) - choose the right chart type. - Features (/docs/standard/features) - scales, panes, indicators, drawings, order flow. - Editions (/docs/editions) - trim the bundle for your product. - API overview (/docs/api) - objects, props and attributes. --- # Series types (Standard edition) Source: /docs/standard/series-types This page lists every series type with a frame and the identifier you pass to the renderer. A type is a single option: you can switch it without touching scales, panes or drawings. ```ts import { Canvas2DRenderer } from '@unifin/chart-core'; renderer.render(context, { // frame: bars, scales, theme, sizes seriesType: 'candles', }); ``` The same identifier is accepted by the React prop, the custom element attribute and the render input: | Host | How to set it | | --- | --- | | Core renderer | `RenderInput.seriesType` | | React | `` | | Custom element | `series-type="candles"` | ## Type catalogue | Type | Identifier | Best for | | --- | --- | --- | | Candles (#candles) | `candles` | Default price chart | | Outline candles (#outline-candles) | `outlineCandles` | Dense screens, lighter ink | | Bars (#bars) | `bars` | Classic OHLC columns | | Line (#line) | `line` | Closing prices, clean trends | | Area (#area) | `area` | Trend with a sense of magnitude | | Histogram (#histogram) | `histogram` | Volumes, seasonality, distributions | | Step (#step) | `step` | Settlement prices, reference curves | | Baseline (#baseline) | `baseline` | Above and below a reference level | | Footprint (#footprint) | `footprint` | Volume clusters inside each bar | | Renko (#renko) | `renko` | Noise-filtered bricks | | Kagi (#kagi) | `kagi` | Demand and supply shifts | | Point and figure (#point-and-figure) | `pointAndFigure` | X and O breakout columns | | Line break (#line-break) | `lineBreak` | Three-line break reversals | | Volume candles (#volume-candles) | `volumeCandles` | Price and liquidity in one column | | Line with markers (#line-with-markers) | `lineWithMarkers` | Sparse series with explicit points | | HLC area (#hlc-area) | `hlcArea` | Full range with a readable close | | HLC glow (#hlc-glow) | `hlcGlow` | Full range with gradient shading | | High-low (#high-low) | `highLow` | Dense range strips | | HLC bars (#hlc-bars) | `hlcBars` | Index series without an open | | Columns (#columns) | `columns` | Open-to-close bodies, dense dashboards | | Range columns (#range-columns) | `rangeCandles` | Range bars with their true height | | Heikin-Ashi glow (#heikin-ashi-glow) | `heikinAshiGlow` | Smoothed candles with a richer body | | Delta candles (#delta-candles) | `deltaCandles` | Body tone from order flow | | Adaptive detail (#adaptive-detail) | `adaptive` | One type for every zoom level | | Spline (#spline) | `spline` | Smooth curves that stay inside the data | | Lollipop (#lollipop) | `lollipop` | Events: dividends, reports, corporate actions | ## Live type explorer Pick a type: the chart streams the same engine the frames below come from, so a type can be judged live before reading its block. import { LiveSeriesTypes } from '@/components/live-series-types'; ## Candles The default view: a body between open and close, wicks for the extremes, colors from the theme tokens. (image: /shots/type-candles.png) ```ts seriesType: 'candles'; ``` ## Outline candles The same geometry as candles with hollow bodies - lighter on dense screens and in multi-chart layouts. (image: /shots/type-outline-candles.png) ```ts seriesType: 'outlineCandles'; ``` ## Bars OHLC columns for readers who take open and close from the side ticks. (image: /shots/type-bars.png) ```ts seriesType: 'bars'; ``` ## Line A single polyline over closing prices - the fastest way to read a trend. (image: /shots/type-line.png) ```ts seriesType: 'line'; ``` ## Area A line with a filled area underneath, useful when the volume pane is not on screen but magnitude matters. (image: /shots/type-area.png) ```ts seriesType: 'area'; ``` ## Histogram Vertical columns from the baseline; the usual choice for volume panes and distribution studies. (image: /shots/type-histogram.png) ```ts seriesType: 'histogram'; ``` ## Step A piecewise-constant line: the value holds until the next one arrives. Common for settlement prices and reference rates. (image: /shots/type-step.png) ```ts seriesType: 'step'; ``` ## Baseline Two zones split by a base level; values above and below it are colored differently. (image: /shots/type-baseline.png) ```ts seriesType: 'baseline'; ``` ## Footprint Per-price volume clusters inside each bar with point of control, imbalance and absorption cues. The host supplies the per-price data; a narrow bar degrades to a compact delta block. (image: /shots/type-footprint.png) ```ts seriesType: 'footprint'; ``` ## Renko Bricks of a fixed price size with time ignored: only moves that clear the brick threshold open a new brick. The brick size follows the instrument tick grid unless you pass your own. (image: /shots/type-renko.png) ```ts seriesType: 'renko'; ``` ## Kagi A single line whose thickness follows the prevailing direction; the line turns when the price reverses past the reversal threshold. (image: /shots/type-kagi.png) ```ts seriesType: 'kagi'; ``` ## Point and figure Columns of X and O built by price movement with a configurable reversal distance. (image: /shots/type-point-and-figure.png) ```ts seriesType: 'pointAndFigure'; ``` ## Line break Three-line break: a reversal column appears only after a strong enough close in the opposite direction. (image: /shots/type-line-break.png) ```ts seriesType: 'lineBreak'; ``` ## Volume candles The body alpha follows a rolling volume average, so quiet bars fade and the busiest bar paints at full strength. Price and liquidity in one column - handy when the volume pane is not on screen. (image: /shots/type-volume-candles.png) ```ts seriesType: 'volumeCandles'; ``` ## Line with markers A closing-price polyline with a dot on every bar. Data gaps restart the line; when the bar slot gets narrow the markers hide and the line stays. (image: /shots/type-line-with-markers.png) ```ts seriesType: 'lineWithMarkers'; ``` ## HLC area A ribbon between high and low with the close drawn on top: the band shows the range of every bar while the line keeps the close readable. (image: /shots/type-hlc-area.png) ```ts seriesType: 'hlcArea'; ``` ## HLC glow The showcase sibling of the HLC area: the corridor between high and low is filled with a vertical gradient, the area under the close line carries a soft glow, and the close stroke fades towards the oldest bars. On a canvas without gradient support it degrades to the flat HLC area fill. (image: /shots/type-hlc-glow.png) ```ts seriesType: 'hlcGlow'; ``` ## High-low One thin vertical segment per bar from high to low in the text color - the volume-profile look for dense daily and intraday strips. (image: /shots/type-high-low.png) ```ts seriesType: 'highLow'; ``` ## HLC bars A high-low stem with a single closing tick on the right. Index series often publish only high, low and close, so the opening tick of the bars type would be noise. (image: /shots/type-hlc-bars.png) ```ts seriesType: 'hlcBars'; ``` ## Columns A filled open-to-close column without wicks. It sits between candles (wick plus body) and histogram (one value from a baseline) and reads well in dense dashboards. (image: /shots/type-columns.png) ```ts seriesType: 'columns'; ``` ## Range columns Range bars already carry a fixed range, so the column height is that range - a row of equal bricks instead of a borrowed candle look. (image: /shots/type-range-candles.png) ```ts seriesType: 'rangeCandles'; ``` ## Heikin-Ashi glow The smoothed Heikin-Ashi candle with a gradient body and a halo outline. The smoothing itself is a data transformation; this type only renders it, so the candle shape stays and the body gets richer. (image: /shots/type-heikin-ashi-glow.png) ```ts seriesType: 'heikinAshiGlow'; ``` ## Delta candles A candle whose body carries order flow: the tone follows the sign of the bar delta and its saturation the share of that delta in the normaliser - usually the SMA of `|delta|`, otherwise the mean `|delta|` of the visible window. Bars without a delta keep the plain candle look, so the type replaces `candles` on a host that has no footprint feed. (image: /shots/type-delta-candles.png) ```ts renderer.render(context, { // frame: bars, scales, theme, sizes seriesType: 'deltaCandles', deltas: [-420, 1150, 0, 880], // one value per bar deltaSma: 600, // optional explicit normaliser }); ``` The tone is a pure function, `deltaTone(delta, normaliser, theme)`, so a bar color can be asserted without a canvas. ## Adaptive detail One type for the whole zoom range: it reads the bar density and picks the readable representation. At six pixels per bar and above it draws the candles, between 2.5 and 6 pixels a high-low ribbon in the direction colour, and below 2.5 pixels the close line plus a thin direction strip at the foot of the plot. The colour of the bars survives every step down, so a compressed chart still reads up and down; a bar without a finite open or close is skipped instead of being tinted by a guess. (image: /shots/type-adaptive.png) ```ts import { adaptiveDetailMode } from '@unifin/chart-core'; renderer.render(context, { // frame: bars, scales, theme, sizes seriesType: 'adaptive', }); adaptiveDetailMode(9); // 'candles' adaptiveDetailMode(4); // 'ribbon' adaptiveDetailMode(1.5); // 'line' ``` ## Spline The `spline` type smooths the close line with a monotone cubic interpolation. The curve never leaves the span of its neighbouring points, so a smoothed chart cannot show a price that was never traded - the classic Catmull-Rom spline overshoots on sharp moves and does exactly that. A gap in the data breaks the curve instead of bridging it. ```ts ``` (image: /shots/type-spline.png) ## Lollipop The `lollipop` type is the event look: a dot on every bar with a stem down to a baseline. The baseline is the close of the first visible bar, so the frame reads as a move against the start of the period; a host that plots dividends or corporate actions pins its own baseline. Dots of a dense window are thinned out by the dot diameter, so they never merge into a solid band. ```ts ``` (image: /shots/type-lollipop.png) ## Rendering backends The Canvas2D renderer draws every type. The optional WebGL2 backend accelerates the five heaviest-traffic types - `candles`, `bars`, `line`, `step` and `area` - and falls back to Canvas2D where WebGL2 is unavailable. Custom types registered by the host stay on Canvas2D. ## See also - Charts (/docs/pro/charts) - scales, panes and profiles around the series. - Analytics kits (/docs/kits) - analytic series on a non-time axis. - API overview (/docs/api) - the renderer input and the React props. --- # Bar insight (Standard edition) Source: /docs/standard/bar-insight Five reading aids for a single bar, all optional and all additive: a host that sets none of them gets the frame it had before. The scene below renders them with the library itself - one panel per feature, both themes. import { LiveBarInsight } from '@/components/live-bar-insight'; ## Volume inside the body `polish.vapInBody` draws the volume-at-price profile of the bar as thin rows inside its body, built from the cluster cells a host already has (`FootprintAccumulator`). Row width follows the volume of the level, the biggest level of the bar sets the scale. `polish.bodyDepth` adds a volume-driven shade inside the body, so dense bars read deeper than thin ones. ```ts renderer.render(context, { // frame: bars, scales, theme, sizes polish: { vapInBody: true, bodyDepth: true }, footprint: { cells }, // FootprintCell[], the cluster data block }); ``` Both options degrade honestly: without cells, on a body narrower than 18 px, or with a broken volume they paint nothing instead of guessing. ## Adaptive detail The `adaptive` series type reads the bar density and picks the representation: candles, a high-low ribbon of the direction colour, or the close line with a direction strip. See Series types (/docs/standard/series-types#adaptive-detail) for the thresholds and the exports. ## Session ghost and trend tone `polish.trendTone` fades the body colour by the ATR-normalised impulse of the bar (`|close - open| / atr`) - a calm bar keeps a weak tone, a forceful one goes solid. `PeriodGhost` gives the host the bars of the period before the newest one together with the index shift that puts them behind the live bars of the same moment. ```ts import { periodGhost } from '@unifin/chart-core'; const ghost = periodGhost(bars, 86_400_000); // previous day, or null renderer.render(context, { // frame: bars, scales, theme, sizes ghost, // dashed contour plus its close line polish: { trendTone: { atr: 0.8 } }, // atr comes from the host statistics }); ``` The ghost is background only: it takes no part in the crosshair, the tooltip, the legend or the hit tests. ## Delta in the bar `polish.deltaBars` shows the sign of the bar delta on the candle itself: `'background'` tints the whole slot, `'tail'` colours the lower half of the body while the upper half keeps the price movement. The tone is the same rule as the delta candle - sign from the delta, saturation from its share in the normaliser (the host `deltaSma`, otherwise the mean `|delta|` of the visible window). ```ts renderer.render(context, { // frame: bars, scales, theme, sizes deltas: [-420, 1150, 0, 880], // one value per bar polish: { deltaBars: 'tail' }, }); ``` Without deltas, or with a broken value, the candle stays plain. ## Timeframe morph `morphBars(previous, next, progress)` folds one timeframe into another without a jump: every bar of the next series starts from the aggregation of the previous bars inside its own window - what the bar would look like if the feed were aggregated to the new step - and walks to its own value. The model is pure: the host owns the clock and asks for the bars of a moment. ```ts import { morphBars, morphDurationMs, morphProgress } from '@unifin/chart-core'; const duration = morphDurationMs(prefersReducedMotion); // 0 under reduced motion const bars = morphBars(previous, next, morphProgress(elapsedMs, duration)); ``` `morphBars(previous, next, 1)` returns the `next` array itself, so the last frame of the fold is the real series, not an approximation of it. --- # Series and levels (Standard edition) Source: /docs/standard/levels This page covers the looks that were added on top of the classic series: a smoothed close line, an event lollipop, the levels of the previous sessions, the automatic Fibonacci retracement and the comparison overlay of several instruments. ## What is on this page Five panels, all rendered by the library itself with deterministic data: 1. **Spline** - the monotone smoothed close line next to the plain line. 2. **Lollipop** - one dot per bar with a stem down to the close of the period start. 3. **Session levels** - the previous day and week high, low and close. 4. **Automatic Fibonacci** - the retracement of the last significant impulse. 5. **Comparison** - six instruments rebased to 100 on one scale. import { LiveSeriesLab } from '@/components/live-series-lab'; ## Spline The `spline` series smooths the close line with a monotone cubic interpolation. The curve never leaves the span of its neighbouring points, so a smoothed chart cannot show a price that was never traded - unlike the classic Catmull-Rom spline, which overshoots on sharp moves. ```ts import { UnifinChart } from '@unifin/chart-react/light'; ``` The smoothing itself is one function: `splinePoints(points, { tension })` returns the sampled curve. `tension` runs from 0 (the full monotone curve) to 1 (straight segments), and a gap in the data breaks the curve instead of bridging it. ## Lollipop The `lollipop` series is the event look: a dot on every bar and a stem down to a baseline. The baseline is the close of the first visible bar, so one glance reads the move of the whole window; a dividend or a report series can pin its own baseline. ```ts ``` Dots are thinned out automatically when the slot is narrower than the dot: the step follows the dot diameter, so a dense window never turns into a solid bar. ## Session levels `sessionLevelsMulti(bars, { periods: ['day', 'week'], utcOffsetMs })` returns the high, the low and the close of the previous session for every requested period. The running session is never a "previous" one, and the session boundary is the period step plus the host offset - the library owns no exchange calendar for every market. ```ts const levels = sessionLevelsMulti(bars, { periods: ['day', 'week'], utcOffsetMs: 6 * 3_600_000 }); ``` The tag of a level turns to the warning tone when the price has broken it: a previous high is broken upwards, a previous low downwards, and the previous close either way. The levels are read-only graphics - they never enter the drawing journal. ## Automatic Fibonacci `autoFibonacci(bars, { atr, atrShare, lookback })` finds the swings of the series (a pivot needs `lookback` lower highs or higher lows on both sides), takes the last impulse that covers at least `atr * atrShare` and returns the retracement levels between its ends, sorted by price. ```ts const fib = autoFibonacci(bars, { atr: 0.6 }); ``` A tiny final wobble does not hide the impulse the market is actually trading: the search walks the swing pairs from the newest one backwards. The manual Fibonacci tool of the drawing engine stays available and is not affected. ## Comparison overlay The overlay puts up to ten instruments on one scale, rebased to 100 at the first visible point of each series, and labels every line at its last point. The colours come from `COMPARE_PALETTE`, so ten lines stay distinguishable. ```ts import { rebaseToBaseline } from '@unifin/chart-core'; const overlay = { series: instruments.map((instrument) => ({ label: instrument.symbol, points: rebaseToBaseline(instrument.points), })), }; ``` The ranking table next to the chart is built by `comparisonTable` and `sortComparisonRows`: the same change in percent the overlay draws, sorted and ranked. ## See also - Series types (/docs/standard/series-types) - the full catalogue of the 26 series types. - Bar insight (/docs/standard/bar-insight) - what one bar can tell: volume-at-price, depth, delta. - Chart and series (/docs/charts) - the painter contract behind every series type. --- # Indicators (Standard edition) Source: /docs/standard/indicators import { LiveIndicators } from '@/components/live-indicators'; This page covers the indicator engine and lets you explore the whole catalogue: pick a study, see its chart, its parameters and the code that enables it. Indicators are registry-driven definitions, not baked-in formulas: each study declares its inputs, outputs and reference levels, and the engine runs it incrementally over the bar history. | Category | Studies | Examples | | --- | --- | --- | | Trend | 16 | SMA, EMA, WMA, HMA, Supertrend, PSAR | | Momentum | 24 | RSI, Stochastic, MACD, CCI, Williams %R, TRIX | | Volatility | 16 | ATR, Bollinger Bands, Keltner Channels, Donchian | | Volume | 16 | OBV, VWAP, MFI, CMF, volume oscillators | | Strength | 24 | ADX, Aroon, DPO, Vortex, relative strength | | Statistics | 16 | Correlation, regression, standard error, variance | | Cycles | 12 | Ehlers-style period and phase studies | | Custom | 4 | Studies built with the definition API | ## Explore the catalogue Pick any study: the chart re-renders with it attached (overlay studies paint on the price pane, oscillators get their own strip with reference levels), and the code block shows how to enable it in your host. The values row mirrors the newest bar, and the table lists the parameters the definition declares. ## The contract behind every study - **Definition**: `id`, `title`, `category`, `placement` (`overlay` or `oscillator`), declared `inputs` (with defaults, ranges and options) and `outputs` (`line`, `histogram`, `area`, `points`, `bands`, `fill`), plus optional reference `levels`. - **Incremental by design**: `update` steps one bar from the carried state, so live appends never rebuild history; a forming bar is replayed from the state snapshot taken before it. - **Isolation**: a broken study reports its error on the instance and never breaks the chart or its neighbours. - **Host contract**: the core paints, the host computes - results reach the price pane through `overlays` (one value per bar, `null` breaks the line) and your own pane through the same numeric arrays. The generated API reference for the package is on chart-indicators (/docs/api/chart-indicators). ## Register your own A custom study is a definition object registered into an `IndicatorRegistry`, or a plugin installed through `installPlugin(registry, { id, version, source, license, definitions })`. Plugins are validated - identity, source, licence and catalogue size (up to 32 studies) - before anything is registered, and a collision leaves the registry untouched. ## See also - Features (/docs/standard/features) - how indicators sit next to the other layers. - Analytics kits (/docs/kits) - domain models that feed their own figures. - API overview (/docs/api) - the definition contract and the engine surface. --- # Features (Standard edition) Source: /docs/standard/features import { LiveChart } from '@/components/live-chart'; This page maps the feature areas of the library to the entry point that ships them: **Standard** (`@unifin/chart-react/standard`) for base charting and **Pro** (`@unifin/chart-react/pro`) for the professional workspace. The framework-free core is shared by both. ## Areas | Area | Standard | Pro | | --- | --- | --- | | Rendering (#rendering) | Canvas2D and optional WebGL2, profiles, palettes, volume and legend layers | Panels and figures on the same painters | | Scales and panes (#scales-and-panes) | Five scale modes, stacked panes, volume pane preset | Multi-chart layouts and sync groups | | Data (#data) | Bars, ticks, resampling, pageable feeds, caching, reconnect | - | | Indicators (#indicators) | Registry-driven engine, 128 studies, host overlays | Formula studio and template catalogue | | Drawings (#drawings) | 96 tools, undo and redo, templates, snapshots, share links | Object tree and bulk actions | | Volume profile and order flow (#volume-profile-and-order-flow) | - | Profile, clusters, ladder, tape, heatmap, order book chart | | Alerts (#alerts) | - | Rule builder, groups, templates, retry policy | | Trading UI (#trading-ui) | - | Order ticket, risk ruler, draggable levels, paper broker | | Workspace and replay (#workspace-and-replay) | - | Layouts, command palette, market replay | | Chart chrome (#chart-chrome-and-measurement) | Watermark, grid styles, legend, events, price lines, A-B ruler, panning | Quote header | | Look pack (#look-pack-and-skins) | Backdrops, bar palettes, volume tones, readout skins | - | | Accessibility and theming (#accessibility-and-theming) | Tokens, six palettes, keyboard and ARIA, locale packs | Panels on the same controls | | Performance (#performance) | Frame budgets, decimation, tiles | Worker rendering, WASM pilot | ## Rendering - Canvas2D renderer with dirty-region repainting and device-pixel-ratio aware text. - Optional WebGL2 backend for the five heaviest-traffic series types, with automatic fallback. - Four presentation profiles: `sparkline`, `mini`, `standard`, `terminal`. - Six token-based palettes - dark, light, corporate, capitalMarkets, orange, unifin - plus the `system` alias and white-label hosts; the registry is public (`CHART_THEMES`, `resolveThemeByName`). - Optional volume columns and an OHLCV legend layer; empty, loading and error states adapt to the pane size. - Live presets on the custom element: a sheen sweep, a cursor glow and sparks that follow the newest close (Live effects (/docs/standard/effects)). ## Scales and panes | Item | Details | | --- | --- | | Price scale modes | `linear`, `log`, `percentage`, `indexedTo100`, `volume` | | Time scales | Seconds to monthly bars, session-aware labels | | Panes | Up to 16 stacked panes, drag handle, shared time scale, per-pane price scale | | Axis side | `RenderInput.priceScalePosition: 'left' \| 'right'` (default `right`) | | Volume pane | `addVolumePane(layout)` gives the strip its own `volume` scale and shared time | (image: /shots/axis-left-dark.png) Pro adds `ChartGrid` for multi-chart layouts and sync groups that tie the crosshair and the visible range across charts, including layout persistence. ## Data - Bars and ticks; resampling between timeframes is built in. - Pageable `Datafeed` interface with a memory adapter for tests and a market-data adapter for REST, SSE and STOMP transports. - Bar cache, idempotent reconnect and deterministic ordering. - Split and dividend adjustments for histories; calendar events (dividends, splits, reports) map onto the bar axis. ## Events Fifty-plus typed events cover viewports, crosshair, drawings, alerts, delivery, replay, order lines, paper trading, indicators and data gaps. Every stream uses one pattern: the subscribe call returns an unsubscribe function, listeners are isolated from each other, and idle operations stay silent. ## Indicators - Registry-driven engine: parameters, panes, styles and legends come from descriptors. - Incremental recalculation - updating one bar recalculates the affected tail only. - A catalogue of 128 studies: moving averages, oscillators, volatility bands, volume studies, relative strength and more - see Indicators (/docs/standard/indicators). - Host-computed overlays draw on top of the price series without registering a study. (image: /shots/indicators-dark-en.png) (image: /shots/indicators-light-en.png) ## Drawings - 96 tools: lines, channels, Fibonacci, Gann, shapes, patterns, measurement, positions. - Anchors snap to bars and prices; magnet mode aligns to OHLC values. - Undo and redo history, template library, JSON snapshots with tolerant parsing, compact share links. (image: /shots/fibonacci-dark-en.png) ## Volume profile and order flow - Volume profile with POC, value area, histogram rows, step control and composite profiles. - Cluster and footprint views with per-price volume, imbalance and absorption cues. - Ladder and tape models with cumulative delta, plus a book heatmap that coarsens over long sessions. - Order book chart with five canvas variants (depth area, depth histogram, ladder, heatmap, imbalance) - see Order book chart (/docs/pro/orderbook). (image: /shots/pro-flow-dark-en.png) ## Analytic figures Waterfall, bullet, box plot, fan chart and the shared heatmap painter plot values on a domain axis instead of a clock. They read one paint input, take colors from the theme and the look pack, and degrade to flat fills without gradients - see Analytic figures (/docs/pro/charts). ## Alerts - Rule conditions over price, indicators and drawing objects. - Message templates with named placeholders and locale defaults. - Retry with exponential backoff and jitter; delivery plugs into the host channels. ## Trading UI - Order ticket with six order types: LIMIT, MARKET, STOP_LIMIT, TAKE_PROFIT, FOK, IOC. - Risk ruler: drag to measure reward-to-risk, levels snap to the price grid. - Stop and take levels draggable on the chart; positions and profit are drawn in the pane. - Pending order lines draggable on the chart with a version journal. - Paper broker and session report for rehearsal; read-only modes for view-only roles. (image: /shots/dashboard-dark-en.png) ## Workspace and replay - Multi-pane terminal layouts with a command palette. - One control kit: toolbar, buttons, inputs, dialogs, menus and tooltips shared by every panel. - Market replay with speed control, seeking and recording serialization. - Formula studio: validate and preview custom formulas before saving them to the catalogue. - Template catalogue: ten starter workspaces with revisions, JSON import and export, and share codes. (image: /shots/pro-workspace-dark-en.png) (image: /shots/pro-replay-dark-en.png) (image: /shots/pro-grid-dark-en.png) ## Chart chrome and measurement These options are off by default; each one exists as a React prop, an element attribute and a render input - the attribution mark is the exception: it is a React prop of the Standard surface. | Option | What it adds | | --- | --- | | `watermark`, `watermarkPosition`, `watermarkImage` | The ticker stamp in the centre or the bottom-left corner, plus a host image for a white-label mark | | `attribution` | The Unifin mark with the link to the site in the chart corner; on by default, `false` is the white-label Pro setting | | `gridStyle`, `gridPeriod` | Dotted grid lines, and a brighter divider where a month, quarter or year opens | | `legend` | The compact OHLCV row with a ticker heading and a collapse chevron | | `events` | The corporate-event lane above the time axis with badges and a detail card | | `priceLines` | Price and alert lines with an axis tag, an optional padlock and a hover highlight | | `measure` | A pinned A-B ruler: delta in price and percent, span in bars and time | | `volume.tag` | The value tag of the newest volume column | | `polish.leftFade` | The history fade at the left edge, so the newest bars read as "now" | | `QuoteHeader` | The instrument strip above a chart: bid, ask, spread, last price and change | Panning is public: `panByPixels` and `panByBars` on the React result, on the binding and on the element turn a swipe or a trackpad delta into calls. The canvas keeps touch gestures with pointer capture. The full lists live on the React API (/docs/api/chart-react) and core API (/docs/api/chart-core) pages. ## Look pack and skins One `look` object groups the presentation choices: backdrop, bar palette, volume tone, gradient stroke and readout skin. Every field is optional and additive - without it the chart keeps the flat rendering, and the `classic` palette always resolves to the live theme colors, so a white-label shell stays repaintable through its tokens. | Option | What it changes | | --- | --- | | `look.backdrop` | `flat`, `gradient` or `aurora` (accent glow from the top-right corner) | | `look.bars` | `classic`, `neon`, `sunset`, `ice` or `mono` - the up and down pair | | `look.barGradient` | Gradient bodies, bright at the top towards the palette tail | | `look.volumeTone`, `look.volumeAlpha` | The volume band reads as a separate layer with its own tone and opacity | | `look.indicatorGradient` | Tapers the stroke of line, step, area and indicator curves | | `look.readoutSkin` | The OHLC readout row as `plain` columns, `chip` pills or `cards` boxes | | `look.font` | `onest`, `inter`, `serif`, `mono` or any literal font stack | Every control of Live effects (/docs/standard/effects) maps to one of these fields, and each field is also an attribute of the custom element (`backdrop`, `bars-style`, `volume-tone`, `volume-alpha`, `indicator-gradient`, `readout-skin`, `font`). ## Timeframes The switcher above changes the step without reloading a feed: the scene keeps a one-minute base and rebuilds the window through the public `resample` of the core - open is the first bar of the bucket, close the last, high and low the extremes, volume the sum. The window is sliced to a steady bar count, so a coarse step shows fewer, wider bars. On the custom element the same switch is the `timeframe` attribute and repaints with a short crossfade. ## Accessibility and theming - Theme tokens drive every color; swapping a palette does not touch layout. - Six palettes ship in the registry - dark, light, corporate, capitalMarkets, orange, unifin - plus the `system` alias; every palette is checked for WCAG AA text contrast in the core test suite. - Host tokens cover palette, radius, font and row density (`compact` / `normal`). - Keyboard focus, roles and ARIA labels are wired on the custom element and the React components. - Animated transitions respect reduced-motion preferences. - Locale packs for Russian, English, Kazakh and Uzbek across the core and the kits. (image: /shots/pro-ux-dark-en.png) ## Performance - Frame budgets are enforced with in-repo benchmarks: interactive charts stay inside the per-frame compute budget on a full-size window. - Decimation and tile ranges keep hundreds of millions of bars scrollable. - Optional worker rendering moves painting off the main thread; an experimental WASM path accelerates the heaviest studies with a parity check against the reference implementation. (image: /shots/pro-perf-dark-en.png) ## See also - Editions (/docs/editions) - entry points and bundle budgets. - Product comparison (/docs/product-comparison) - how the feature set compares to typical charting libraries. - Series types (/docs/standard/series-types) - the drawing types behind the rendering area. --- # Live effects (Standard edition) Source: /docs/standard/effects import { LiveEffects } from '@/components/live-effects'; This page covers the presentation presets of the custom element - a sheen sweep, a cursor glow and live sparks - plus the look pack, the spark styles and the replay cursor. Presets are opt-in, follow the motion policy and cost nothing while they are off. ## Try it live The panel under the heading groups every option of the element into cards - **Interaction**, **Events**, **Chrome**, **Look pack**, **Presets** and **Replay** - and the table below the chart lists each control with its attribute, the accepted values and the value in force right now, so a setting can be checked without reading the source. The strip above the table shows the newest bar, the second strip follows the pointer: time, price and the OHLCV of the bar under the crosshair. Switch scenes (every switch fires a spark burst), pick a look, switch the timeframe, toggle the presets, replay the history and watch the sparks pop at the newest close. Everything on this page runs on the real library build - the component uses the same public API you would. ## Interaction parameters | Control | Attribute / member | Values | What it changes | | --- | --- | --- | --- | | Crosshair | `crosshair` | `hidden`, `free`, `magnet` | Crosshair on hover; `magnet` snaps to the nearest bar | | Readout | `readout-mode` | absent, `line`, `rows` | Values strip of the hovered bar above the plot | | Tooltip card | `tooltip` | present, absent | Hover card next to the crosshair | | Tooltip hold | `tooltip-hold` | `0` .. `60000` ms | How long the card stays after the pointer leaves (default five seconds) | | Price tag | `price-tag` | present, absent | Last price notch on the value axis | | Volume tag | `volume-tag` | present, absent | Volume value on the volume pane | | OHLCV legend | `legend` | present, absent | Legend row with the newest bar | | Window chips | `chips` | present, absent | Window high and low markers plus the last price notch | | Left fade | `left-fade` | absent, number `0` .. `0.6` | Fade of the oldest bars in the window | The hover card does not vanish with the pointer: the hold window keeps the last hover readable, and `crosshair-move` / `crosshair-leave` report the values so a host can mirror them (the strip in the demo does exactly that). ## Corporate events on the chart Events are a property, not an attribute: a marker carries a time and a title, and the frame paints one badge row above the time axis. Hovering a badge paints its card, clicking it fires `event-click`. ```ts import type { EventLaneInput } from '@unifin/chart-core'; const element = document.querySelector('unifin-chart') as HTMLElement & { events: EventLaneInput | null }; element.events = { markers: [ { time: Date.UTC(2026, 8, 21, 7, 0), title: 'Earnings', kind: 'earnings' }, { time: Date.UTC(2026, 8, 21, 9, 0), title: 'Dividends', kind: 'dividends' }, ], minGap: 10, // minimum pixels between two badges; crowded badges collapse }; ``` | Member | Type | Notes | | --- | --- | --- | | `events.markers` | `{ time, title, kind?, glyph? }[]` | One badge per marker; `time` is the bar it belongs to | | `events.glyphs` | `Record` | Glyph override per kind | | `events.minGap` | Pixels | Collapsing distance; the demo slider drives it | | `events` | `EventLaneInput \| null` | `null` removes the lane | | `event-click` | event | Detail is the marker that was clicked | The React binding takes the same object through the `events` prop, so a portal and a plain HTML page show the same lane. ## Chrome parameters | Control | Attribute | Values | What it changes | | --- | --- | --- | --- | | Theme | `theme` | `dark`, `light`, `corporate`, `capitalMarkets`, `orange`, `unifin`, `system` | Palette of the whole frame; only tokens change, the chart is not rebuilt | | Grid | `show-grid` | `true`, `false` | Plot grid | | Grid style | `grid-style` | `solid`, `dotted` | Grid stroke style | | Grid period | `grid-period` | `month`, `quarter`, `year` | Period separators of the time axis | | Value axis | `price-axis` | `right`, `left` | Side of the value scale | | Axis width | `price-axis-width` | Pixels | Width of the value scale; `0` hides it | | Value scale | `price-scale-mode` | `linear`, `log`, `percentage`, `indexedTo100`, `volume` | Value scale of the pane | | Time axis | `time-axis` | `auto`, `hidden` | Upper panes hand the time axis to the pane below | | Watermark | `watermark-position` | `center`, `bottom-left` | Ticker watermark position | | State | `state` | `empty`, `loading`, `error`, `waiting` | Empty, loading and failure states of the frame | | Mini mode | `mini` | present, absent | Sparkline density and a narrow axis | `locale` stays `en` on this portal: the pages are English by design, the attribute takes `ru`, `en`, `uz` and `kz` for hosts that ship other languages. ## Look pack | Control | Attribute | Values | | --- | --- | --- | | Backdrop | `backdrop` | `flat`, `gradient`, `aurora` | | Bars | `bars-style` | `classic`, `neon`, `sunset`, `ice`, `mono` | | Volume tone | `volume-tone` | `theme`, `dim`, `accent`, `contrast` | | Volume alpha | `volume-alpha` | `0.15` .. `1` | | Readout | `readout-skin` | `plain`, `chip`, `cards` | | Font | `font` | `onest`, `inter`, `serif`, `mono` | | Indicator gradient | `indicator-gradient` | present or absent | | Line gradient | `line-gradient` | absent, `on`, or a share `0.02` .. `0.9` | | Volume gradient | `volume-gradient` | absent, `on`, or a share `0.02` .. `0.9` | | Chart gradient | `chart-gradient` | absent, `on`, or `from=#..,to=#..,angle=..,phase=..` | The three gradients are independent and work in every palette. `line-gradient` shades candle and column bodies from the bright top towards their own darker tail and tapers line and area strokes, so a body no longer needs a bar palette to carry a gradient. `volume-gradient` does the same for the volume columns and is independent of the volume tone, so a themed band can still be shaded. `chart-gradient` replaces the flat theme fill with a ramp derived from the palette; on the brand palette the ramp drifts its phase on every repaint, which reads as a slow shimmer - the drift follows the repaints the host already drives instead of adding an animation loop, and it freezes when the system asks for reduced motion. All three create at most one gradient object per colour and frame, so a long history keeps the flat frame cost. Gradient rendering degrades gracefully: a canvas without `createLinearGradient` keeps the flat S13 fill, an invisible volume tone keeps the theme columns, and `classic` always resolves to the live theme colours. ## Replay Engage the cursor with `replayPlay(speed, from)`, walk bar by bar with `replayStep(delta)`, pause with `replayPause()` and leave with `replayExit()`. `replay:progress` reports the index, progress, playing flag and speed, so the host can drive its own transport UI. The demo above starts the cursor 60 percent into the history and streams the exact same engine the Pro workspace uses. ## Presets | Preset | What it draws | When it fires | | --- | --- | --- | | `sheen` | a soft highlight sweeping across the frame | continuously while active | | `cursorGlow` | a radial glow following the pointer | while active and the pointer moves | | `sparks` | a burst of particles at the newest close | when the preset turns on, on scene switches and on every live update of the last bar | All three are refused with `false` while the host prefers reduced motion; nothing animates silently. ## Live sparks in detail - The burst spawns at the newest bar: its screen point is the bar centre at the last close, so the sparks always sit exactly where the price moved. - Up to 48 particles live at once; a burst burns out in about 900 ms with gravity and damping, so the effect stays cheap and self-limiting. - The element runs its own animation loop and repaints while particles are alive - no timers on the data side, no perpetual redraw, and nothing to clean up when the burst ends. - `chart:spark` fires for every burst with `{ scene, source }`: `source` is `"scene"` for switches and preset activation, `"live"` for data updates. - `sparksAlive` reads the current particle count - handy for demos, telemetry and tests. ## Element API ### Properties and methods | Member | Type | Notes | | --- | --- | --- | | `fx(preset, on)` | `(preset: string, on: boolean) => boolean` | Turns a preset on or off. Unknown names and reduced-motion refusals return `false`. | | `fxActive` | `readonly FxPreset[]` | Active presets in canonical order: `sheen`, `cursorGlow`, `sparks`. | | `sparksAlive` | `number` | Alive spark particles of the current burst. | | `setScene(scene)` | `(scene: string) => boolean` | `candles`, `bars`, `renko` or `profile`; a successful switch fires the scene burst. The `bars` scene paints OHLC bars, the other scenes keep candles. | | `look` | `ChartLookInput \| null` | The look pack of the frame; the scalar knobs also have attributes (`backdrop`, `bars-style`, `volume-tone`, `volume-alpha`, `indicator-gradient`, `readout-skin`, `font`). | | `sparkStyle` | `SparkStyleName` | Burst style of the sparks: `burst`, `bengal`, `sparkler`, `fountain`, `comet`, `ember`, `confetti`, `pulse`, `shower`, `nova`. | | `replayPlay(speed, from)` | `(speed?: ReplaySpeed, from?: number) => boolean` | Starts the history cursor; `from` seeks to a bar index first. | | `replayStep(delta)` | `(delta?: number) => boolean` | Pauses and moves the cursor by whole bars (negative walks back). | | `replayPause()`, `replayExit()` | `() => void` / `() => boolean` | Pauses the cursor; `replayExit` leaves replay mode and draws the full history. | | `bars` | `readonly Bar[]` | Assigning new data redraws and fires the live burst whenever the newest value changed. | ### Events | Event | Detail | Fires | | --- | --- | --- | | `chart:spark` | `{ scene: string, source: 'scene' \| 'live' }` | every burst | | `replay:progress` | `ReplayViewState` | started, paused, seek, step and speed changes | ### CSS contract The element only toggles classes; the look is yours. While a preset is active the host carries `uf-fx-sheen`, `uf-fx-cursor-glow` or `uf-fx-sparks`; scene bursts add `uf-fx-spark-burst` for 600 ms, and the cursor glow reads the `--uf-fx-x` / `--uf-fx-y` custom properties the element keeps updated. A minimal host stylesheet: ```css unifin-chart { position: relative; } unifin-chart.uf-fx-sheen::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.09) 50%, transparent 60%); background-size: 240% 100%; animation: uf-sheen 2.8s linear infinite; } @keyframes uf-sheen { from { background-position: 120% 0; } to { background-position: -120% 0; } } ``` ### Minimal usage ```html import { defineUnifinChart } from '@unifin/chart-element'; defineUnifinChart(); const chart = document.getElementById('demo'); chart.fx('sparks', true); chart.addEventListener('chart:spark', (event) => console.log(event.detail)); ``` ```ts import { FX_PRESETS, isFxPreset, resolveFx } from '@unifin/chart-element'; // Host-side preset state without the element methods: const state = resolveFx([], 'sparks', true, { reducedMotion: false }); state.active; // ['sparks'] - or [] with state.refused === true under reduced motion ``` ## Driving the particles yourself The particle model is a public, pure API of the core package - hosts that paint their own layers can run it without the element: ```ts import { createSparks, spawnSparks, stepSparks, SPARKS_LIMIT } from '@unifin/chart-core'; const sparks = createSparks(); // deterministic xorshift state spawnSparks(sparks, x, y, 12); // burst at a screen point, capped at SPARKS_LIMIT stepSparks(sparks, frameDeltaMs); // advance, apply gravity and drop burnt particles ``` `RenderInput.sparks` passes the alive particles to the renderer (painted above the data in the interaction layer and clipped to the plot), `RenderStats.sparks` reports the painted count, and the React binding accepts a `sparks` getter (`ChartBindingOptions.sparks()`) so any host can push its own particles per frame. ## Frame extras Beyond the presets, the renderer takes frame extras that a host turns on per chart: the history fade (`polish.leftFade`), the dotted grid and the period dividers (`gridStyle`, `gridPeriod`), the collapsible legend (`legend.toggle`, `legend.collapsed`), the pinned measure ruler (`measure`), price and alert lines (`priceLines`), the corporate-event lane (`events`) and the volume tag (`volume.tag`). They follow the same layer order as the rest of the frame and never animate on their own, so the motion policy below applies to the presets. The option list is on the React API page (/docs/api/chart-react) and the core API page (/docs/api/chart-core). ## Motion policy Every preset follows one rule: while the system prefers reduced motion, enabling a preset returns `false` and nothing is drawn. The same policy gates the scene crossfade and the view animations, so a host never has to special-case effects. ## See also - Pro effects (/docs/pro/effects) - the volume effects and the look pack on the Pro surfaces. - Features (/docs/standard/features) - the look pack and the chrome options in context. - Series types (/docs/standard/series-types) - the types the scene switcher draws. - API overview (/docs/api) - renderer, series, scales and binding surfaces. --- # Live gallery (Standard edition) Source: /docs/standard/gallery import { LiveCatalogue } from '@/components/live-catalogue'; import { LiveChart } from '@/components/live-chart'; import { ShowcaseGrid, StatsBand } from '@/components/showcase'; This page collects the live examples: a runtime series explorer and the shipped surfaces, all rendered on this page by the library. Every chart here is live: the portal imports `@unifin/chart-react` as a package and renders it in place. Nothing depends on an external example server, and there are no embedded frames. ## Series explorer All twenty-three series types switchable at runtime (footprint clusters are built from the host bar data inside the component): ## Product surfaces Curated frames of the shipped surfaces (all captured with the English interface): ## Renko Bricks of a fixed price size with time ignored - a classic noise filter: ## Kagi A single line whose thickness reflects the prevailing direction: ## Point and figure X/O columns built by price movement with a reversal distance: ## Line break Three-line break reversals: ## Volume candles Body transparency follows a rolling volume average - quiet bars fade, busy bars paint at full strength: ## Line with markers A close polyline with an explicit dot on every visible bar: ## HLC area A ribbon between the high and the low with the close on top: ## HLC glow An artistically shaded sibling of the HLC area: a lit corridor between the high and the low, a soft glow under the close line and a stroke that fades into history: ## High-low One thin vertical segment per bar, high to low - dense range strips: ## Baseline Two zones split by a base level - handy for comparing against a close or a VWAP: ## Where the full scenes live The professional scenes (multi-pane workspace, market replay, order flow, drawings) are part of the Pro gallery (/docs/pro/gallery); the interactive charts above show the same renderer and the same public API. ## See also - Series types (/docs/standard/series-types) - the identifier behind every chart on this page. - Live effects (/docs/standard/effects) - the preset switches, the look pack and the gradients. - Getting started (/docs/standard/getting-started) - the same API in your own project. - Live gallery Pro (/docs/pro/gallery) - the professional surfaces in the same live form. --- # Pro edition (Pro edition) Source: /docs/pro import { LiveChart } from '@/components/live-chart'; import { LiveFrameEffects } from '@/components/live-frame-effects'; import { LiveProEffects } from '@/components/live-pro-effects'; This page covers the Pro edition: what the third entry point adds on top of Standard, which packages ship it and where each Pro surface is documented. Pro is the paid edition of the library. It does not fork the engine: the core, the scales, the painters and the data layer are the same, and `@unifin/chart-react/pro` adds the workspace layer on top. That keeps one chart engine, one theme contract and one look pack across the editions. ## The Pro effects, live Pro desk The look engine at desk strength, on the chart itself: the volume effects of the core depth painters, the four gradients, the presets with live sparks, the replay and the look pack - the desk composition no Standard scene demos, driven here through the real public API. The bar switches the timeframe, the live stream and the palette; the cards under the chart drive the look pack, the gradients, the presets, the replay and the volume effects. Every control writes a real attribute or method of the chart element and the status line reports what it applied. The full property reference lives on Pro effects (/docs/pro/effects). ## The desk frame effects, live Pro desk The second layer of the desk look: the value area ramp with the POC, VAH and VAL pills, the area glow under the line, the parallax depth layer and the three desk presets (terminal dark, corporate light, white label). Every layer is opt-in and paints nothing while it is off. The row switches the effect layer and the palette; the presets merge a desk look over the host look without touching it, and the counters line under the canvas reports what the painters wrote. The full reference lives on Pro effects (/docs/pro/effects). ## The same chart, in both editions The chart below is the one from the Standard getting started page, rendered by the same component: Pro does not replace it, the Pro surfaces are drawn on top of it. The zoom dock in the top right corner (Pro only) drives the same command the mouse wheel does: `+` zooms in, `-` zooms out. Pro is white-label: no Unifin mark sits on a Pro surface. The terminal panels, the analytics kits and the order book chart carry no vendor branding at all, and a Pro chart removes the Standard mark with `attribution={false}` (see Editions (/docs/editions)). ```tsx import { UnifinChart } from '@unifin/chart-react/standard'; import { OrderbookChart } from '@unifin/chart-react/pro'; // Pro is white-label: the Standard attribution mark is off on this surface. ; ``` ## Editions at a glance | Edition | Entry point | Ceiling | Adds | | --- | --- | --- | --- | | Standard | `@unifin/chart-react/standard` | 14 KB | The base chart surface with the attribution mark (the same entry also publishes as `/light`) | | **Pro** | `@unifin/chart-react/pro` | 500 KB | The workspace layer, the terminal panels and the order book, without any vendor mark | | Root | `@unifin/chart-react` | 14 KB | The Standard surface plus the palette registry; kept for hosts of earlier majors | The ceilings are gzip sizes of the built ESM entries and are checked by `tools/bench/size-budget.mjs` (see Editions (/docs/editions) for the full table and the buffer rules). ## What ships in Pro | Surface | What it is | Docs | | --- | --- | --- | | Order book chart (/docs/pro/orderbook) | Ten canvas variants of a live two-sided book | `/docs/pro/orderbook` | | Terminal panels (/docs/pro/panels) | Liquidity ribbon, delta candles, pace of tape, auction landscape, efficient frontier | `/docs/pro/panels` | | Analytic figures (/docs/pro/charts) | Waterfall, bullet, box plot, fan chart and the candle heatmap grid | `/docs/pro/charts` | | Pro effects (/docs/pro/effects) | What the Pro entry point adds on screen - the order book, the terminal panels, the risk figures - next to the effects shared with Standard | `/docs/pro/effects` | | Trade desk (/docs/pro/trade) | The order bracket with the risk zones, the Sell / volume / Buy strip, the Order and DOM panel, exits and confirmations | `/docs/pro/trade` | | Drawing dashboard (/docs/pro/drawing) | The tool rail with search and favorites, the figure style panel with fill patterns and the history | `/docs/pro/drawing` | | Fibonacci and volatility (/docs/pro/fibonacci) | The Fibonacci zone and plan, ATR levels, study fills, the MA fan and the fair value gaps | `/docs/pro/fibonacci` | | Research studies (/docs/pro/research) | The study contract of host code, the indicator dialog and the template gallery | `/docs/pro/research` | | Strategies and backtest (/docs/pro/strategy) | The declarative strategy text, the paged history contract and the backtest report | `/docs/pro/strategy` | | Analytics kits (/docs/kits) | Fixed income, portfolio, swaps and options kits with their models | `/docs/kits` | | Screeners (/docs/kits) | Fixed income screening, portfolio monitoring and option chain analytics, live on the kit pages | `/docs/kits` | | Live gallery Pro (/docs/pro/gallery) | The Pro surfaces rendered live on the portal | `/docs/pro/gallery` | | Workspace layer | Layouts, replay, command palette, drawing tree, alert manager, trading UI | `/docs/standard/features` | | Order flow | Footprint, clusters, tape, volume profile and the ladder | `/docs/standard/features` | | LINK and snapshots | Saved workspaces carried between hosts and windows | `/docs/pro/panels` | Every Pro surface is a presentation binding: the arithmetic lives in the core (`OrderbookModel`, `tapeWindows`, `frontierCurve`, `auctionGrid`, `liquidityRibbonGrid`), so it can be asserted without a canvas and the same numbers drive a custom drawing surface. ## Turning Pro on 1. Install the same package as Standard - Pro is a subpath, not a second package: ```bash pnpm add @unifin/chart-react ``` 2. Import from the Pro entry point: ```tsx import { OrderbookChart, PaceOfTapePanel } from '@unifin/chart-react/pro'; ``` 3. Keep the theme contract: Pro panels read the active theme and the look pack, so a white-label shell repaints them through its `--ud-*` tokens without touching the layout. ## See also - Editions (/docs/editions) - the four entry points and the size budgets. - Features (/docs/standard/features) - the capability map, Pro rows included. - Pro effects (/docs/pro/effects) - the effect catalogue behind the live engine on this page, with the property tables. - Order book chart (/docs/pro/orderbook) - the ten variants and the component surface. - Trade desk (/docs/pro/trade) and drawing dashboard (/docs/pro/drawing) - the desk surfaces of the programme. - Research studies (/docs/pro/research) and strategies and backtest (/docs/pro/strategy) - host studies, the strategy language and the report. - Screeners (/docs/kits) - fixed income, portfolio and option chain screening live on the kit pages. - Live gallery Pro (/docs/pro/gallery) - the Pro surfaces rendered live. --- # Analytic figures (Pro edition) Source: /docs/pro/charts import { LiveFigures } from '@/components/live-figures'; This page covers the analytic figures: painters that plot values on a domain axis instead of a clock. Every painter reads the same `AnalyticPaintInput`, takes its colors from the theme and the look pack, and degrades to flat fills when gradients are unavailable. ## Figure catalogue | Figure | Painter | Data | Notes | | --- | --- | --- | --- | | Waterfall (#waterfall) | `paintWaterfall` | Steps `{ label, value, kind }` | `start` grows from zero, `delta` stacks on the running base, `total` spans the accumulated value; `waterfallSpans` holds the base arithmetic | | Bullet (#bullet) | `paintBullet` | `{ value, target?, ranges }` | Qualitative bands behind a solid value marker and a dashed target tick; the scale clamps out-of-range targets | | Box plot (#box-plot) | `quantiles`, `paintBoxPlot` | A sample of numbers | Quartiles by linear interpolation (R type 7), whiskers at 1.5 IQR, outliers as marks | | Fan chart (#fan-chart) | `paintFanChart` | Median plus band pairs | Bands are drawn widest first so the narrowest reads on top; the median reuses `paintAnalyticCurve` | | Heatmap (#heatmaps) | `paintHeatmapGrid` | `HeatmapGridLike` | One painter for every heatmap in the library: depth landscape, monthly returns and the candle screener | ## Waterfall Pass one step per row and mark its kind: `start` opens the bridge, `delta` moves it, `total` closes it at the accumulated value. ```ts import { DARK_THEME, NumericAxis, paintWaterfall, waterfallSpans } from '@unifin/chart-core'; const steps = [ { label: 'Revenue', value: 820, kind: 'start' as const }, { label: 'Costs', value: -310, kind: 'delta' as const }, { label: 'Net', value: 0, kind: 'total' as const }, ]; const input = { xAxis: new NumericAxis({ min: 0, max: steps.length, width: 640 }), yMin: 0, yMax: 900, plotWidth: 640, height: 320, theme: DARK_THEME, }; paintWaterfall(ctx, steps, input); // -> painted columns waterfallSpans(steps); // -> running bases, no canvas needed ``` ## Bullet `ranges` are the qualitative bands (bad, target, good), `value` is the solid marker and `target` the dashed tick. Targets outside the scale are clamped instead of widening it. ```ts paintBullet( ctx, { value: 74, target: 80, ranges: [40, 70, 100] }, { xAxis, yMin: 0, yMax: 100, plotWidth: 320, height: 120, theme: DARK_THEME }, ); ``` The bands are painted top-down with a rising alpha, then the value marker (solid) and the target tick (dashed). `bulletRanges` sorts and filters the boundaries, `bulletScale` fixes the upper bound. ## Box plot `quantiles` is pure, so the numbers can be asserted without a canvas: quartiles use linear interpolation, whiskers stop at the last value inside `1.5 x IQR`, and anything further out is reported as an outlier. A sample with fewer than two finite values returns `null` instead of a degenerate box. ```ts const box = quantiles(samples); if (box !== null) { paintBoxPlot(ctx, [box], { xAxis, yMin: box.min, yMax: box.max, plotWidth: 160, height: 320, theme: DARK_THEME }); } ``` ## Fan chart The fan chart is a composition: each band is a `paintAnalyticBand` call and the median is `paintAnalyticCurve`. Both clip horizontally, so a long scenario cone stays cheap, and the bands accept any pair of `AnalyticPoint` lists - a Monte Carlo cone feeds them directly. ```ts paintFanChart( ctx, median, // AnalyticPoint[] [ { low: p10, high: p90 }, { low: p25, high: p75 }, ], { xAxis, yMin, yMax, plotWidth: 720, height: 360, theme: DARK_THEME }, ); ``` Bands are drawn widest first and the alpha steps up towards the median (`FAN_BAND_ALPHA` plus `FAN_BAND_ALPHA_STEP` per band). ## Heatmaps `heatmapColor` is the single place where a cell color is decided: the tone picks the palette (`accent`, `up`, `down` or the signed `diverging`) and the intensity picks the alpha from a quantised cache. `bookGrid` adapts the order book landscape and `monthlyGrid` (portfolio kit) adapts the returns grid, so a new heatmap is data plus a tone - never a new painter. ```ts import { candleHeatmapGrid, DARK_THEME, paintHeatmapGrid } from '@unifin/chart-core'; const grid = candleHeatmapGrid(cells); // { symbol, period, change } paintHeatmapGrid(ctx, { grid, tone: 'diverging', theme: DARK_THEME, width: 640, height: 360 }); ``` ## See also - Analytics kits (/docs/kits) - domain packages that feed these figures. - Pro terminal panels (/docs/pro/panels) - the same painters inside the Pro panels. - Order book chart (/docs/pro/orderbook) - the heatmap painter in a live panel. - API overview (/docs/api) - painter signatures and inputs. --- # Terminal panels (Pro edition) Source: /docs/pro/panels import { LiveProFigures } from '@/components/live-pro-figures'; import { LiveDeskS85 } from '@/components/live-s85'; This page covers the Pro terminal panels: each one is a canvas binding over a host-owned model with a single image label for assistive technology. The panels share the analytic figure family of the core: they plot values on a domain axis instead of a clock, take their colors from the theme and the look pack, and degrade to flat fills when gradients are unavailable. The arithmetic lives in the core (`tapeWindows`, `frontierCurve`, `auctionGrid`, `liquidityRibbonGrid`), so it is testable without a canvas and the panel only measures, paints and labels. ## Panel catalogue | Panel | Reads | Paints | | --- | --- | --- | | `LiquidityRibbonPanel` | Sampled book states `{ time, imbalance, depth }` | The imbalance drift as a ribbon row (`paintLiquidityRibbon`, diverging tone) | | `DeltaCandlesPanel` | Bars plus a per-bar `deltas` array | Candles whose body tone follows the delta sign and its share of the normaliser | | `PaceOfTapePanel` | The print tape | Aligned time windows (`tapeWindows`) as an acceleration histogram | | `AuctionHeatmapPanel` | TPO cells `{ time, price, tpo }` | A price-by-time landscape with the POC line and the value-area borders | | `EfficientFrontierPanel` | Candidate portfolios on risk/return | The concave upper hull (`frontierCurve`), the candidates and the current portfolio | ## Component ```tsx import { PaceOfTapePanel } from '@unifin/chart-react/pro'; ; ``` Every panel takes the same shell props: `theme` (defaults to the dark palette), `look` (the look pack) and `height`; the data props differ per panel and are listed in the catalogue above. Panels never fetch and never mutate their model - a host feeds them from a live feed, a replay or a recorded session. ## Desk dock and replay Pro only The desk wave adds the bottom dock, the replay cursor with its transport and the corporate event lane - one live set below. The dock reads the paper account through `paperKpi` (balance, equity, realised and unrealised P&L, position margin, order margin, free margin) and shows five boards over one `DataTable`. The replay cursor is a frame layer of the core (`paintReplayCursor`): the host owns the cursor index in `ReplayEngine`, the arrows step whole bars and Home/End jump to the ends. `ReplayBar` keeps the transport and the trading strip of the replay, `EventMarkers` extends the event lane (earnings, dividends, news, splits, reports) with numbered groups above thirty markers, and `InstrumentCard` renders host data only: a missing field prints `-` and a card without sections is not drawn. ## See also - Order book chart (/docs/pro/orderbook) - the sixth terminal surface, with five canvas variants. - Analytic figures (/docs/pro/charts) - the shared painters these panels bind. - API overview (/docs/api) - panel props and core model signatures. --- # Widgets (Pro edition) Source: /docs/pro/widgets import { LiveMarketsWidget } from '@/components/live-markets-widget'; This page covers `MarketsWidget`, the first component of the Pro widgets catalogue: a compact card of market rows with an SVG sparkline, a signed change and host-owned pagination. The widget ships from `@unifin/chart-react/widgets` and carries no chart, canvas or data feed. Rows arrive from the host; the component never fetches, subscribes or stores them. ## Widget catalogue | Widget | Import | Status | Surface | | --- | --- | --- | --- | | `MarketsWidget` | `@unifin/chart-react/widgets` | Beta | Five market rows, one SVG sparkline per row, a signed change, optional page dots, a footer link and an optional menu trigger | ## Try it live The card opens on the light palette. The dots switch five prepared lists and the menu trigger opens a panel drawn by the host. ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `title` | `string` | required | Card title, for example `Markets` | | `items` | `readonly MarketsWidgetItem[]` | required | Rows of the current page; the component neither slices nor sorts them | | `locale` | `LocaleCode` | `ru` | Number formats and accessible texts; `uz` and `kz` use the English accessible texts | | `theme` | `ChartTheme` | neutral CSS values | Colors and radius; every missing token falls back on its own | | `pagination` | `MarketsWidgetPagination` | none | Controlled page dots; without the prop there are no dots | | `footerLink` | `MarketsWidgetFooterLink` | none | Footer link; a missing or unsafe `href` removes the link | | `onMenu` | `() => void` | none | Menu trigger; without the prop the ellipsis button is not rendered | | `asOf` | `number` | none | Snapshot time in epoch milliseconds, read only through `aria-description` | | `labels` | `Partial` | RU/EN catalogue | Accessible text overrides; an empty string falls back to the default | | `formatValue` | `(item, locale) => string` | built-in format | Host value formatter; an exception or an empty string falls back to the default | | `formatChange` | `(item, locale) => string` | built-in format | Host change formatter; an exception or an empty string falls back to the default | | `className` | `string` | none | Host class for the outer layout; colors and radius stay in the theme | | `ariaLabel` | `string` | `title` | Accessible name of the card section | ## Item fields | Field | Type | Default | Description | | --- | --- | --- | --- | | `id` | `string` | required | Unique key of the row within the page | | `symbol` | `string` | required | Ticker or short instrument code, for example `IMOEX` | | `name` | `string` | `symbol` | Display name; a long name is truncated with the full value in `title` | | `value` | `number` | none | Numeric value formatted through `formatNumber` | | `formattedValue` | `string` | none | Ready value from the host; wins over `value` and `formatValue` | | `valueDigits` | `number` | `2` | Fraction digits of the default value format, clamped to 0..8 | | `change` | `number` | none | Change in percentage points: `1.39` means +1.39% | | `formattedChange` | `string` | none | Ready change from the host; wins over `change` and `formatChange` | | `trend` | `readonly number[]` | none | Sparkline series; non-finite points are skipped | ## Import and render ```tsx import { useState } from 'react'; import { MarketsWidget, type MarketsWidgetItem } from '@unifin/chart-react/widgets'; const PAGES: readonly (readonly MarketsWidgetItem[])[] = [ [ { id: 'imoex', symbol: 'IMOEX', name: 'Moscow Exchange Index', value: 3215.91, change: 1.39, trend: [3118, 3141, 3168, 3215.91] }, { id: 'usdrub', symbol: 'USD/RUB', value: 83.0705, valueDigits: 4, change: -0.96, trend: [84.31, 83.97, 83.48, 83.0705] }, ], [{ id: 'brent', symbol: 'BRENT', value: 74.18, change: 0.63, trend: [72.85, 73.26, 73.72, 74.18] }], ]; export function MarketsCard() { const [page, setPage] = useState(0); return ( ); } ``` The host keeps the page index and passes the rows of that page. `pages` counts pages, `current` is a 0-based index, and the active dot never calls `onChange`. ## Formatting and locales Value priority is `formattedValue`, then `formatValue`, then `value` with `valueDigits`. Change priority is `formattedChange`, then `formatChange`, then `change` with a sign and a percent suffix. - `NaN` and `Infinity` render as `-`. - `en` groups thousands with a comma and separates decimals with a dot: `3,215.91`. - `ru` groups thousands with a space and separates decimals with a comma: `3 215,91`. - An exception in a host formatter does not escape: the built-in format takes over. > **Note** The `locale` prop defaults to `ru`. Pass `en` for an English card, as the live demo does. ## Themes The card paints only from the `ChartTheme` you pass: panel, grid, text, muted text, accent, up, down and radius. Missing tokens resolve one by one, so a partial theme stays renderable. Without a `theme`, the card uses neutral CSS values: a transparent surface, the surrounding text color and the inherited font. Pass a palette object for a colored card. ```tsx import { LIGHT_THEME } from '@unifin/chart-core'; import { MarketsWidget, type MarketsWidgetItem } from '@unifin/chart-react/widgets'; const rows: readonly MarketsWidgetItem[] = [ { id: 'rgbi', symbol: 'RGBI', name: 'Moscow Exchange Government Bond Index', value: 107.69, change: 0.14 }, ]; ; ``` No stylesheet is required. `className` adds outer layout only; colors and radius remain in the theme, so a white-label host repaints the card through its own palette. ## Accessibility - The card is a section named by `ariaLabel`, or by `title` when the prop is absent. - Rows form a semantic list; every row carries an `aria-label` with the name, ticker, change and value. - The sparkline is `aria-hidden`: it repeats the numbers of its row. - Page dots are `` with a 1-based label and `aria-current="page"` on the active dot. - The footer link is keyboard focusable; external `http(s)` links receive `rel="noopener noreferrer"`. - `asOf` is exposed only as an `aria-description`, so the visual layout stays unchanged. ## Server rendering The component has no effects, no `useId` and no access to `window`, `document` or `ResizeObserver`. `renderToString` returns the same markup on the server and in a second render; React 18 and React 19 are supported. > **Caution** `pagination.onChange` and `onMenu` are callbacks. Pass them from a client component; a > server component can render the card itself but cannot hand it functions. ## Budget and stability The `@unifin/chart-react/widgets` subpath is budgeted at 6 KB gzip and the built entry measures 5.30 KB gzip. A host that does not import the subpath pays nothing extra. Every export of the subpath is in beta. New optional props are additive; a breaking prop change follows the major version. ## See also - Pro edition (/docs/pro) - the entry points, the surfaces and the budgets. - Terminal panels (/docs/pro/panels) - the canvas panel family of the Pro entry point. - Analytics kits (/docs/kits) - the board pages the footer link opens. - Editions (/docs/editions) - the size budgets of every entry point. --- # Drawing dashboard (Pro edition) Source: /docs/pro/drawing import { LiveDrawing } from '@/components/live-drawing'; The Pro edition ships a full drawing dashboard over the same engine: a palette rail on the left, a floating style panel next to the selected figure and a context menu on right click. Everything is driven through the public drawing API, so the host stays the owner of the store and the journal while the dashboard stays a set of controlled components. ## How charting works Charting on the desk is three steps, and the live demo below marks the step you are on: 1. **Pick a tool** on the rail - search it with `/` or open a family; the rail remembers favorites and the five most recent tools. 2. **Drag on the chart** - one tool places one figure; the desk returns to the selection mode right after the figure lands, so a stray click never starts a second shape. 3. **Style the zone** - click any figure to open its look: line, fill with a pattern, text; the strip below the chart repeats the fill patterns, `Escape` closes the panel. The desk above is that flow live on the real library chart: the same streaming scene as the desk pages carries the crosshair, the tooltip and pan and zoom while no tool is armed, and the step strip highlights what to do next. Dragging paints the zone with the picked tool and clicking a zone opens its style panel - the panel never opens by itself, so the chart stays readable right after a figure lands. Change the pattern in the panel or on the strip and press "To all of type" to spread the look to the other zones. Every figure is anchored to bar and price points, so it stays glued to its bars through the stream and a pan. The rail tray and the search popover close on a pick and on any click outside the rail. The rail keeps its state as plain JSON, so a workspace snapshot restores the active tool, the favorites and the five most recent tools without any host code. ## The tool rail `DrawingToolbar` renders all 95 catalogue tools grouped by seven families with two-level subgroups. The rail carries: - search on `/` across the tool title, the tool id and the catalogue code; - favorites and the five most recent tools, kept in the serialisable `DrawingPaletteState` of the core; - the lock and the "hide markup" toggle - hiding never deletes anything, the drawings stay in the store and the host only skips their painting; - unique hotkeys for every tool that never collide with the platform keymap or the navigation keys; - full keyboard access: every control is a button with an accessible name, `Escape` leaves the tool mode. The rail renders nothing in `mini` and `readOnly` surfaces, so the same bundle serves widgets and terminals. ## The figure style panel `DrawingStylePanel` is the floating dashboard of the selected figure: line colour, style and width, fill colour and opacity, the pattern grid, then the text group. Three actions sit below the fields: "To all of type" applies the current look to every figure of the same tool in one journal step, "Template" saves the look as a style template, and delete follows the host policy. ### Fill patterns The core registry `FILL_PATTERNS` carries fifteen samples; the four canonical ones are always present: empty (a transparent fill), a 45 degree hatch, dots and a grid. - every sample is painted by pure functions over the canvas contract - no `createPattern`, no offscreen canvas, no DOM; - the geometry is memoised by pattern and integer bounds, so one frame builds one tile set per pattern and colour; - a context without clipping support (or without `arc` for the dots) degrades to the flat alpha fill instead of failing; - the field `DrawingStyle.fillPattern` is additive: an unknown id falls back to `solid`, and older snapshots load without migration. The panel previews every sample as a small SVG built from the same tile geometry, so previews need no chart and render on the server. ## Style templates A style template is the saved look of one figure - line, fill with its pattern, and text. Save the current look from the panel and the next figure of the same type starts with it. Templates live in the core `DrawingStyleLibrary`, persist through the host storage as a versioned JSON envelope, and a starter set of four canonical looks (trend, zone, Fibonacci, position) loads idempotently. ## The figure context menu Right click opens `DrawingContextMenu`: show or hide, lock, raise or lower, clone, save as template, switch the pattern, delete. The menu opens offset from the click so it never covers the figure anchors, stays inside the canvas bounds, and follows the host deletion policy - the Pro desk asks its own confirmation dialog before the journal call. ## Hosting notes - The rail, the panel and the menu are controlled components: they emit the next state or a style patch and never mutate the store themselves. - Hiding markup and locking are flags: the drawings stay intact, and the host decides how they paint. - The fill painter is a core helper: a host that renders the drawing layer through `buildLayerOps` passes the `rect`, `ellipse`, `polygon` and `fill` operations to `paintFillPattern` with the colours of the active theme. - No `eval`, no network calls: patterns, templates and the palette are plain data. --- # Fibonacci and volatility overlays (Pro edition) Source: /docs/pro/fibonacci import { LiveFib } from '@/components/live-fib'; The Fibonacci and volatility overlays share one rule: the numbers come from pure core modules, the painters only read them, and every plan action lands on the contracts the platform already has. The zone, the bands, the fan and the gaps are ordinary layers over the live chart - the host computes once per history change and repaints per frame. The overlays live in the `@unifin/chart-core/studies` subpath, so a host that does not show them pays nothing for their weight. The desk above is that study layer live on the real library chart: the same streaming scene as the desk pages carries the crosshair, the tooltip and pan and zoom while the pointer is away from the anchors. Switch the Fibonacci zone, the ATR bands, the MA fan and the fair value gaps on the toggle row, drag the round anchors to rebuild the impulse (the magnet snaps to a swing within 8 px), press Auto impulse to rebuild the frame from the visible window, and change the ATR multiplier or the anchor. The plan block below the chart turns the selected level into the platform contracts: the break alert counts once, the level order and the stop order count once each. ## The retracement zone `fibonacciLevels(from, to)` gives the seven base ratios with their labels and prices; `autoFibonacci` finds the impulse for you when the host asks for it. `paintFibZone` fills the zone between the anchors with one ramp per frame - the accent at 0.10 at the impulse end fading to 0.02 - draws the impulse as a dashed line and labels every level with a pill carrying the ratio and the price. Two readability rules: a zone shorter than `FIB_ZONE_MIN_FILL_PX` (24 px) keeps its lines and drops the fill, and a cramped scale keeps the three key ratios (0.382, 0.5, 0.618) with an ellipsis instead of the hidden ones. A pill never sits on the last-price tag - it steps aside when the two would collide. A canvas without gradient support degrades to a flat fill instead of throwing. ## Dragging and the one-click plan `dragFibAnchor` moves one anchor of the frame; the magnet snaps it to a swing inside `FIB_SNAP_PX` (8 px by default, configurable through `snapPx`, switchable off) and leaves a free position alone outside the threshold, so the manual pick is never fought. A locked frame ignores drags, any other drag leaves the automatic mode, and `resetFibToAuto` returns the frame to the impulse. The `extend` flag adds the projection ratios 1.272, 1.414, 1.618 and 2.0 on top of the base seven - it adds, it never rewrites them. The plan block turns the analytics into work with one click: `fibBreakAlertRule` builds a platform price-cross alert on the level, `fibLimitOrderRequest` a LIMIT order on it and `fibStopOrderRequest` a STOP_LIMIT behind the 0.618 with a protective buffer (below the level for a buy, above it for a sell). The builders produce the very `AlertRule` and `OrderRequest` shapes the manual forms use, so the hosts' validation and delivery paths stay the only ones in play. ## ATR levels and bands `atrLevels(bars, { mult, anchor, atrPeriod })` returns the stop and the 1R, 2R and 3R targets around an anchor, the day range and the expected move (the ATR times the square root of the configured steps). The anchor strategy is explicit: the last close by default, the last confirmed swing or the session open of the last UTC day. The multiplier is clamped to a sane range, and a non-numeric history yields an empty list instead of NaN prices. `paintAtrBandLayer` paints one band from the anchor to every requested level: the stop takes the down colour, the targets the up colour, each band fades from the anchor to its far edge and carries a pill label. The layer is static - nothing pulses - and it never crosses the price axis. ## Study fills The band studies - Bollinger, Keltner, Donchian, the EMA cloud - share one option: `studyFill` is `none`, `solid` or `gradient`. The gradient goes from the leading line to the far edge of the band, alpha 0.20 down to 0.08, with a single ramp per band and per frame; the solid mode uses a flat 0.14; `none` keeps the lines alone. The mode is a property of the band overlay, so it flips between frames without rebuilding the binding, and `null` values simply split the band into separate areas. ## The MA fan `computeMaFan(bars, { count, base, step })` builds up to forty simple averages with one rolling pass per line - never quadratic in the history - and `paintMaFan` fades them with age from one shared ramp (the freshest line is the most opaque). The fan is one overlay, not twenty indicator instances: no legend zoo, no repeated calculation, and switching it off leaves nothing behind. The layers walk only the visible window, so a 100 000-bar history costs what the screen shows. ## Fair value gaps `fairValueGaps(bars, { limit })` implements the classic three-bar fair value gap: the window between the high of the left bar and the low of the right bar of a triple (and the mirrored bearish one). A gap stays open until a later bar touches its near boundary; the list keeps only the most recent blocks, as many as the limit asks. `paintFairValueGaps` fills the open zones with a two-stop ramp - denser at the boundary the price leans on - clips them to the plot and lets the fill die out on the closing bar, so a closed gap stops shouting. --- # Volatility cone (Pro edition) Source: /docs/pro/volatility import { LiveVolatility } from '@/components/live-volatility'; The volatility cone anchors the realized volatility at one bar and projects it forward: sigma is the sample standard deviation of the log returns over the window ending at the anchor, and every band runs at `price * exp(± z * sigma * sqrt(h))` - the same square-root rule the ATR expected move follows. The fill is a gradient ramp that fades from the anchor to the far edge, the median stays dashed, and the anchor circle drags along the bars. ## Reading the cone - Wide bands mean an expensive tape: one sigma already sits far away, and a stop inside the cone is likely to be visited by noise alone. - A low sigma near the anchor narrows the cone towards a line - the market is quiet and the usual ranges compress. - The window picks the memory of the study: 20 bars react to the last session, 120 to the last weeks; the horizon sets how far the projection runs. ## The layer `paintVolatilityCone` draws the nested bands in the accent colour, keeps every shape inside the plot (the price axis strip stays clean) and falls back to flat fills when the canvas cannot paint gradients. The dashed line is the driftless median of the projection, and the pills label each band on its upper edge. ## Swing arrows The same desk carries the swing high/low arrows: a small triangle above every impulse swing high and below every swing low, filtered by the ATR share of the leg and capped to the newest points. The "Highs and lows" switch in the toolbar toggles the option on this page, and every Pro scene can enable the same flag through the shared desk chart. ## See also - Fibonacci and volatility overlays (/docs/pro/fibonacci) - the ATR levels, the MA fan and the study fills. - Indicators (/docs/standard/indicators) - the indicator catalogue, including the volatility family. --- # Research studies (Pro edition) Source: /docs/pro/research import { LiveResearchS86 } from '@/components/live-s86'; The library ships the catalogue, and a host extends it without touching the package: a study is a plain definition object with a calculation function. The same contract drives the catalogue, the indicator dialog and the template gallery, so a custom study appears next to the built-in ones with its own parameters. Both charts above are the real library chart: the candle pane streams the newest bar of the shared desk history, the pane below is the same feed read through the RSI study, and the report walks the backtest engine over that very history. The template gallery stays live next to them: a card fills its parameter form and the save hands the resolved parameters to the host. ## The study definition A definition names the study, declares the placement, the inputs and the outputs, and computes values into the output buffers. Nothing is executed from data: the calculation is a function of the host, and the engine only calls it over bars. ```ts import type { IndicatorDefinition } from '@unifin/chart-core'; const drift: IndicatorDefinition = { id: 'custom.session-drift', title: 'Session drift', category: 'custom', placement: 'oscillator', apiVersion: 1, incremental: false, inputs: [ { id: 'window', title: 'Window', kind: 'number', default: 12, min: 2, max: 60, step: 1 }, { id: 'smooth', title: 'Smooth', kind: 'boolean', default: true }, ], outputs: [{ id: 'drift', kind: 'line' }], calculate: ({ bars, params, outputs, from, to }) => { const window = typeof params.window === 'number' ? params.window : 12; const buffer = outputs.drift; if (buffer === undefined) return; for (let index = from; index = window ? bars[index]!.close - bars[index - window]!.close : Number.NaN; } }, }; ``` ## Registration and validation `IndicatorRegistry` holds the definitions of the runtime; several registries may live side by side, and a new binding keeps the registrations when the host passes its registry along. Every definition passes the validator first: ```ts import { IndicatorRegistry, validateStudyParams } from '@unifin/chart-core'; const registry = new IndicatorRegistry(); registry.register(drift); const problems = validateStudyParams(drift, { window: 120 }); // [{ path: 'params.window', message: '120 is above max 60' }] ``` | Refusal | Problem you receive | | --- | --- | | Missing or malformed id | `id must be a lowercase slug (letters, digits, dot, dash)` | | Default outside the declared range | `inputs.period default 120 is above max 100` | | Duplicate registration | `id is already registered` | | Unknown runtime parameter | `params.lvl is not declared; declared: period, smoothing` | | Value of the wrong kind | `params.period expects a finite number` | ## The indicator dialog and the element The React dialog accepts registered studies through `studyDialogItems`: a definition maps to a row with its category and its editable number, boolean and select inputs. The custom element owns a runtime registry as well and exposes `registerStudy`, `studyIds` and the `studies` registry: a study registered from host code survives a binding recreation and never throws at the host - a broken definition returns `false` and leaves the contract problems in `definitionProblems`. ## Template gallery The gallery carries ready-made research: four study presets (RSI with zones, an EMA cloud, volatility bands, an MA fan) and three strategy presets (an EMA cross, a range breakout, a mean reversion). Presets are data: the host picks a card, the parameter form fills from the declared defaults, and saving hands the resolved parameters to the host. The presets come from `@unifin/chart-core/studies`: ```ts import { STUDY_TEMPLATES, studyTemplate, studyTemplateParams } from '@unifin/chart-core/studies'; import { TemplateGallery } from '@unifin/chart-react/pro'; const rsi = studyTemplate('tpl.rsi-zones'); const defaults = rsi === null ? {} : studyTemplateParams(rsi); // { period: 14, upper: 70, lower: 30 } ``` A study preset is a full `IndicatorDefinition`, so it registers unchanged. A strategy preset is declarative text of the strategy language - see Strategies and backtest (/docs/pro/strategy) for the engine that runs it. --- # Strategies and backtest (Pro edition) Source: /docs/pro/strategy import { LiveStrategy } from '@/components/live-strategy'; The strategy layer turns a trading idea into data: a small declarative text that parses into a structure, never into code. The same structure runs through the backtest engine over historical bars, and the report reads the numbers the engine produced. Type in the editor: the preset chips load the three shipped strategies, the text is parsed by `parseStrategy` - data, never code - and the run button pushes it through the real backtest engine over the live history of the chart above; the report reads the engine numbers and a typo comes back as a problem with its line and column. Every press of Run backtest answers in the status line next to the button - the run number, the trades found, the net P&L and the walk time in milliseconds - and the report block pulses, so the press is visible even when the numbers of the walk repeat. A rejected source turns the status line red and gives the problem back with its line and column. The entry and exit markers of the tail trades ride the events lane of that chart and the newest trade carries its entry and exit price lines, so the chart tells the story of the run. The editor opens with a momentum sample tuned to this history; the chips load the templates as they ship, levels included. ## The strategy text A strategy declares its inputs, its entry and exit rules as conditions of the alert catalogue, and an optional risk block. Comments start with `#`. ```text # Moving average cross strategy ma-cross input symbol = SBER input timeframe = 1H input size = 20 input commission = 0.0005 input slippage = 0.0003 input leverage = 1 entry when indicatorCross(fast=ema10, slow=ema30, direction=up) exit when indicatorCross(fast=ema10, slow=ema30, direction=down) risk stop = 1.5% risk target = 3% ``` ```ts import { parseStrategy, serializeStrategy } from '@unifin/chart-core/strategy'; const strategy = parseStrategy(text); strategy.inputs.size; // 20 strategy.entry?.conditions[0]; // { kind: 'indicatorCross', fast: 'ema10', slow: 'ema30', direction: 'up' } serializeStrategy(strategy); // canonical text, stable round-trip ``` A rule combines conditions with `and` or `or`; mixing the two in one rule is refused. Conditions take positional arguments, so an error names the line and the column: an unknown condition, an unknown parameter (`unknown parameter "lvl" of priceCross; expected level, direction`) or a value outside an enum all come back as problems of one `StrategySyntaxError`. The rule limits are declared constants (`STRATEGY_MAX_RULES`, `STRATEGY_MAX_TOTAL_RULES`) and checked at parse time. ## Conditions the engine runs on bars The engine executes price and indicator rules on plain bars; conditions that need chart objects are refused with a named error instead of being ignored. | Runs on bars | Needs chart objects | | --- | --- | | `priceCross`, `priceUp`, `priceDown`, `changePercent` | `drawingTouch`, `drawingBreak` | | `volumeSpike`, `rangeExit` | `candlePattern` | | `indicatorCross`, `indicatorLevel` | `formula` (a host evaluator) | ## History and the backtest History arrives through a paged source: the host feeds pages of bars and the engine never reaches for the network itself. A page carries a cursor and the loader walks it while the page limit and the bar limit hold; a failed page comes back as `HistoryLoadError` with a reason (`page-failed`, `page-limit`, `bar-limit`, `empty-history`). ```ts import { collectHistory, parseStrategy, runBacktest } from '@unifin/chart-core/strategy'; const bars = await collectHistory(source); // paged backend contract const result = runBacktest(parseStrategy(text), { bars }); result.metrics.totalPnl; // commission and slippage are applied to every trade ``` The engine marks the position to market on every bar: an entry buys at the close plus slippage, the stop is checked before the target inside the same bar (the conservative order), the margin gate compares the notional of the position against the cash and the leverage, and an open position is closed at the last bar. ## The report `BacktestPanel` renders the finished result of the engine: trades, wins, losses, win rate, total and average P&L, profit factor (`-` when there were no losses), the maximum drawdown, the Sharpe ratio and the largest win and loss, next to the equity curve. The panel never computes - it reads `BacktestResult`. ```tsx import { BacktestPanel } from '@unifin/chart-react/pro'; value.toFixed(2)} /> ``` ## From the chart Setting a strategy from the chart is the same composition the editor above demonstrates: the gallery (or the host's own dialog) hands a strategy source to the host, the host parses it, runs the backtest and paints the entries and exits next to the bars. The language stays declarative, so the host keeps every platform gate - orders still leave only through `TradingAdapter` and the six `trading-ms` types. The text the trader types goes through the same `parseStrategy`, so an unknown condition or parameter comes back as a problem with its line and column, never as executed code. Whole strategy presets live in the template gallery: the EMA cross, the range breakout and the mean reversion are declarative sources of `@unifin/chart-core/studies`. See Research studies (/docs/pro/research) for the gallery and the study contract. --- # Trading from the chart (Pro edition) Source: /docs/pro/trade import { LiveTrade } from '@/components/live-trade'; The trading layer keeps the platform contract: the library never talks to a brokerage API. The host implements the `TradingAdapter` over its BFF and owns every call, while the desk components render the state and route the intents. Orders use the six `trading-ms` types only - MARKET, LIMIT, STOP_LIMIT, TAKE_PROFIT, FOK and IOC - and the roles stay TRADER, OPERATOR, COMPLIANCE and PARTICIPANT. The desk above works from the chart itself: press the Buy or Sell chip on the canvas and the order form opens right on the chart - pick one of the six platform types, the amount, the price and the protective levels, and submit. The plan then draws itself on the chart and one command writes exactly one journal record, one event and one toast, while the repeated key stays idempotent. Every screen docks on the chart: the Plan chip floats the bracket card and the exits block, the Panel chip docks the Order / DOM panel, the trade bar sits along the bottom edge and the position row along the top, while the toasts and the live counters stay wired to the same state. Once the plan is on, drag its entry, stop and take lines: they are chart price lines of the library, painted with their axis tags by the renderer, and the drag reads the live pixel and price scales of that chart - the pending price follows the pointer with the live risk numbers, the release writes exactly one journal version, the lock freezes a level and the exits block drives the same layer. ## The bracket: one command, one story `BracketSeam` carries the plan through a single path: the order goes to the adapter, the accepted result creates the markup object, the trading journal records it, one event leaves the seam and the host turns it into a toast. Role and mode gates plus `validateOrderRequest` run before the adapter, so a refused plan never touches the BFF and never creates an object. The stop and the take are optional; the distances are available in ticks of `tickStep` and in percents of the entry through `bracketDistances`. `BracketLayer` paints the story on the chart. A drag opens a session and moves only the pending price - the live numbers follow `computeRisk` while the pointer moves - and releases exactly one version into the journal, no matter how many frames the drag lasted. The lock blocks a level from dragging, removing one level keeps the others, and the risk and profit zones use the fill patterns of the drawing registry. ## The trade bar `TradeBar` is the Sell / volume / Buy strip the host usually docks at the bottom of the chart. It is controlled: the spread comes from the bid and ask props, never from a timer. The quick volume set (1, 5, 10 by default) is configurable, `readOnly` blocks the buttons and explains the reason, `mini` hides the strip, and the keyboard follows a configurable mapping - Enter sends Buy and Shift+Enter sends Sell until the host flips `enterSendsBuy`. ## The panel: Order and DOM `TradePanel` carries two tabs over one source of truth. The Order tab wraps the ticket of the six platform types with the bid and ask quick prices, the notional in the account currency, the leverage and tick rows, the full-text call to action and the risk row. Validation problems render next to the fields, never as a toast. The DOM tab is the ladder with the volume field, the Flat, CXL All and Reverse actions, the Buy Mkt and Sell Mkt buttons and the position row; the refresh gate `createDomRefreshGate` keeps it under ten refreshes per second during a book storm, and every action has an accessible name and stays behind its host callback. ## Exits and confirmations The exits block carries the take-profit and stop-loss toggles, their prices, the distances in ticks and percents, the quick 1R and 2R targets built by `targetFromRisk`, the ATR hook and the drag entry. The confirmation policy lives in the core: `confirmationDecision` compares the order against the thresholds of the host - quantity, notional and the share of the deposit - names every trigger that fired, and `OrderTicket.confirm` refuses to touch the adapter while a fired threshold stays unconfirmed. The thresholds can be switched off explicitly by omitting them, and the exits block shows the reason of the fired threshold as a hint. ## Position and toasts `PositionRow` is the compact line of the open position: size, average, the unrealised P&L recomputed from the last tick with no internal state, and the close action. `TradeToasts` rides the shared toast stack with a five-second life and an idempotency key, so a repeated platform event never duplicates a toast. The trade pulse of a bar follows the motion policy of the kit - when the reduced motion is requested it is not rendered at all. ## Hosting notes - orders are created by TRADER and PARTICIPANT; OPERATOR and COMPLIANCE watch and export, and the `readOnly` mode blocks everyone; - every send path goes through the host callbacks that own the adapter: the components never call the platform themselves; - the tickets, the seam and the layer are framework-free in the core, so the same logic serves React, the custom element and the terminal windows. --- # Options desk (Pro edition) Source: /docs/pro/options import { LiveOptionsDesk } from '@/components/live-options-desk'; Two halves of one picture: the chain shows what the market quotes at every strike, and the strategy gallery shows what a combination of those quotes pays at expiry. The chain selection marks the strike on the payoff with a dashed line, so picking a level and reading the combination is one motion. ## The chain Every strike from 85 to 115 comes with both sides at once: mid, delta from the quoted implied volatility, IV and open interest for the call and the put. The chevron of a row expands the legs behind the strike, the `Zone` column shades in-the-money strikes green and out-of-the-money red, the IV columns carry the heat scale, and the locale switch moves the digits between en-US, de-DE and ru-RU - the numbers of a broker desk read the way the desk writes them. ## The strategies The gallery collects sixteen combinations grouped by bias - bullish, bearish, neutral, volatility and hedging: singles, verticals both ways, straddles and strangles long and short, the butterfly, the condor, the iron condor and the collar. Every chip draws the payoff at expiry with the profit and loss zones filled, the now-curve on top (follow the volatility slider), the breakevens of the combination, the risk summary - net premium, maximum profit and loss - and the legs table behind the position. ## Reading the payoff - A debit spread pays a smaller, capped amount: the filled zones show exactly where the cap sits. - Short combinations mirror the picture: a credit up front and the risk growing with the move. - The now-curve flattens the wings before expiry - time value is still alive inside the strikes. ## See also - Options kit (/docs/kits/options) - the pricing, greeks and payoff math behind the desk. - Volatility cone (/docs/pro/volatility) - reading the expected range of the underlying. - Table kit (/docs/kits/table) - the board engine: sorting, heat, sub-rows and locales. --- # Order book chart (Pro edition) Source: /docs/pro/orderbook import { LiveOrderbook } from '@/components/live-orderbook'; import { LiveBookCube } from '@/components/live-book-cube'; This page covers the Pro order book chart: ten canvas variants, the component surface, the look pack and the core painter behind them. It is part of the Pro edition (/docs/pro): the engine is the same as in Standard, the widget is not. The order book chart turns a two-sided book into one of ten canvas views. It is a **Pro** feature: the painter lives in the core, the `OrderbookChart` component ships in `@unifin/chart-react/pro`, and the whole surface is presentation only - the data comes from `OrderbookModel`, so the same widget serves a live feed, a replay or a recorded session. ## Try it live Every control drives the real props: the variant chips switch the painter, the palette and font feed the look pack, the aggregation step buckets the prices, the book depth caps the rows, and the theme button repaints through the shell tokens. ## Ten variants The ten variants share one normalised view (`buildOrderbookView`) and one price scale; only the body of the picture changes. The first three match the familiar terminal readings, the next two are liquidity-first views, and the S96 desk wave adds five more readings - the mirror ladder, the depth bubbles, the ridgeline, the radial sonar and the walls. | Variant | What it draws | Best for | | --- | --- | --- | | `depth` | Cumulative depth curves of both sides around the mid price, filled with a vertical gradient | Reading where the book walls are | | `depthHistogram` | Per-level columns diverging from the mid rule | Comparing one level against its neighbours | | `ladder` | The classic price ladder with depth shading, a spread band, side totals and a mini depth strip | Placing an order at a price | | `heatmap` | A price x time liquidity landscape with an intensity heat scale | Watching liquidity build and pull over time | | `imbalance` | A pressure board - a bid/ask share gauge over diverging price rows | Reading who owns the book | | `mirror` | The mirror ladder: cumulative staircase bars left of the bids and right of the asks around a central price column, with the spread band between the sides | Two-sided weight at a glance, mid anchored | | `bubbles` | Depth bubbles over a faint cumulative skirt; the radius follows the level size and the three heaviest levels carry their size | Spotting single heavy levels in a sparse book | | `ridges` | A liquidity ridgeline: one soft ridge per level, lower rows first, the heaviest level labelled | The shape of the whole ladder as a skyline | | `radial` | A radial depth sonar: two filled lobes sweeping a half-circle per side over guide rings, with the mid and the spread at the centre | A showcase reading of the two-sided weight | | `walls` | Glowing liquidity walls: one pillar per level standing on the base line, the three heaviest labelled with their size | Where the walls really are | Gradient bodies degrade gracefully: a canvas without `createLinearGradient` keeps flat `withAlpha` fills, the bubbles fall back to soft squares without `arc`, the radial lobes to flat fills without `createRadialGradient`, so the widget stays legible on every backend. ## Look pack and themes The chart reads the same look pack as the price chart: the bar palette resolves bids and asks (`classic`, `neon`, `sunset`, `ice`, `mono`), the reading font comes from the four-font set, and every colour is derived from the active theme - no literal ever enters the painter, so a white-label shell repaints through its `--ud-*` tokens. ## Component ```tsx import { OrderbookChart } from '@unifin/chart-react/pro'; import { OrderbookModel } from '@unifin/chart-core'; const book = new OrderbookModel(); export function Book({ snapshot, look }) { book.apply(snapshot); return ( ); } ``` | Prop | Meaning | | --- | --- | | `depth` | Two-sided depth, best first (`OrderbookModel.depth(levels)`); the only required prop | | `variant` | `depth` (default), `depthHistogram`, `ladder`, `heatmap`, `imbalance`, `mirror`, `bubbles`, `ridges`, `radial`, `walls` | | `theme` | A `ChartTheme`; defaults to the dark palette | | `look` | The look pack - bar palette, gradient bodies and the reading font | | `levels` | Rows kept per side (book depth), default `12` | | `step` | Price aggregation step; derived from the level gaps when omitted | | `heatmap` | A `HeatmapGrid` for the `heatmap` variant (from `BookHeatmap.grid()`) | | `title` | Instrument stamp of the header | | `locale` | Header and axis language | | `height` | Fixed pixel height of the canvas host | The component exposes the book to assistive technology as a single `role="img"` with a label carrying the variant, spread and imbalance. It is a pure presentation surface: it never mutates the model and never places orders - use `OrderbookLadder` for clickable levels and order intents. ## Core painter `paintOrderbookChart(ctx, input)` and `buildOrderbookView(input)` are public in `@unifin/chart-core` (also on the `@unifin/chart-core/render` subpath), so a host that draws its own canvas can reuse the exact same geometry and palette: ```ts import { buildOrderbookView, paintOrderbookChart, DARK_THEME } from '@unifin/chart-core'; const view = buildOrderbookView({ depth: book.depth(20), step: 0.5, levels: 20 }); paintOrderbookChart(ctx, { variant: 'imbalance', view, theme: DARK_THEME, width, height, locale: 'en' }); ``` ## The book cube in 3D The depth history behind the heatmap also reads as a cube: every snapshot becomes a column, the price axis spans the levels and the level size sets the bar height, with the active snapshot in the accent tone. Drag, the wheel and the arrow keys steer the camera; the reset button and the two angle presets restore the canonical views, and the scene pauses while the section is out of view or the tab is hidden. (image: /shots/portal-bookcube-dark-en.png) ```ts import { bookCubeFromHistory, paintBookCube, scene3dCamera } from '@unifin/chart-core/scene3d'; const cube = bookCubeFromHistory(history); // [{ time, levels: [{ price, bid, ask }] }] paintBookCube(ctx, cube, { width, height, theme, camera: scene3dCamera() }); ``` Both are public entries of `@unifin/chart-core`; see the core API (/docs/api/chart-core). ## See also - Pro edition (/docs/pro) - the entry point, the budgets and the other Pro surfaces. - Terminal panels (/docs/pro/panels) - the five panel bindings of the same wave. - Features (/docs/standard/features) - the order flow area in the capability map. - Analytic figures (/docs/pro/charts) - the heatmap painter the depth landscape reuses. - API overview (/docs/api) - component props and core painter signatures. --- # Pro effects (Pro edition) Source: /docs/pro/effects import { LiveProEffects } from '@/components/live-pro-effects'; import { LiveOrderbook } from '@/components/live-orderbook'; import { LiveProFigures } from '@/components/live-pro-figures'; import { LiveRisk } from '@/components/live-risk'; import { LiveFrameEffects } from '@/components/live-frame-effects'; The Pro edition does not replace the chart. It adds its own surfaces on top of the same engine, and this page keeps the groups apart: first the surfaces only Pro ships, then the look engine driven at desk strength. ## What is unique to Pro Every export below ships only in the Pro entry point `@unifin/chart-react/pro`. The Standard entries do not carry these modules at all. | Group | Pro entry exports | What it draws | Docs | | --- | --- | --- | --- | | Order flow | `OrderbookChart`, `OrderbookLadder`, `PrintTape`, `BarProfilePanel` | Five order book variants, the depth ladder, the print tape and the per-bar profile | Order book (/docs/pro/orderbook) | | Terminal panels | `LiquidityRibbonPanel`, `DeltaCandlesPanel`, `PaceOfTapePanel`, `AuctionHeatmapPanel`, `EfficientFrontierPanel` | Liquidity ribbon, delta candles, pace of the tape, auction landscape and the efficient frontier | Terminal panels (/docs/pro/panels) | | Risk figures | `CorrelationPanel`, `RiskDecompositionPanel`, `ScenarioConePanel`, `AttributionPanel` | Correlogram, risk decomposition, scenario cone and the attribution bridge | Analytics kits (/docs/kits) | | Desk and workspace | `WorkspacePanel`, `MultiChartGrid`, `DrawingTree`, `CommandPalette`, `KeymapPanel`, `FavoritesBar` | Saved layouts, a grid of up to 16 panes, the object tree, the command palette, the hotkey map and the favorites strip | Features (/docs/standard/features) | | Alerts | `AlertManager`, `AlertGroupPanel`, `AlertGroupEditor`, `AlertActionList`, `createAlertNotifier`, `ToastStack` | Rule manager, condition groups, the action plan, toasts and the alert sound | Features (/docs/standard/features) | | Trading desk | `OrderTicketPanel`, `SessionPanel`, `PaperSessionPanel`, `ComparePanel`, `CompareChip`, `WatchlistPanel`, `DataWindowPanel` | Order ticket, sessions and timezones, the paper session report, comparison, watchlist and the data window | Terminal panels (/docs/pro/panels) | | Tables and export | `DataTable`, `chartPdfFromCanvas`, `openPanelPopout`, `createLinkBridge` | Financial boards, the PDF export, popped-out windows and the LINK bridge | Table kit (/docs/kits/table) | | Control kit | `UiButton`, `UiInput`, `UiSelect`, `UiDialog`, `UiMenu`, `UiTooltip`, `MOTION_DURATION` | One control language and one motion scale for every panel | React API (/docs/api/chart-react) | A Pro surface is white-label as well: the Standard attribution mark is not drawn on any of them. ## Pro-only effects Pro only The three families below are the Pro entry point itself. Each panel reads the active theme and the look pack, so a palette switch repaints it with the chart. ### Order book variants The five canvas variants of a live two-sided book: depth area, depth histogram, ladder, heatmap and imbalance. ### Terminal panels Liquidity ribbon, delta candles, pace of the tape, auction landscape and the efficient frontier - the panel painters of the Pro entry point. ### Risk figures Correlogram, risk decomposition, scenario cone and the attribution bridge from the risk kit. ## The look engine on the chart Pro desk The engine that drives every Pro surface, shown on the chart itself: the look pack, the four gradients, the presets, the replay and the volume effects of the core depth painters - the desk composition no Standard scene demos. ### Try it live The bar above the chart switches the timeframe, the live stream and the palette. The cards under the chart drive the look pack, the gradients, the presets, the replay and the volume effects: every row writes a real attribute or method of the element, and the status line under the chart reports the change it just applied - including a preset the system refused under reduced motion. The chip row of the volume effects counts the objects their painters wrote, and the counters above keep the palette, the look, the gradients and the presets in force readable at a glance. The volume effects, the live sparks and the white-label frame are what the desk adds here; the Pro panels of this page carry the same look into the book, the figures and the desk. ### Volume effects Three effects give a flat two-dimensional frame a sense of depth without WebGL and without a second render stack. All three are pure functions of the core `render` entry point: they take data and return geometry or paint with the host tokens. | Effect | Core entry | What it draws | | --- | --- | --- | | Isometric heat map | `buildIsometricGrid`, `paintIsometricGrid` | Value levels projected to a grid that runs in time and back in value; the depth of a cell follows its weight | | Candle parallax | `parallaxShape`, `paintParallaxCandles` | A shift away from the centre with a shadow plane; the candle geometry never changes, only the offset and the tone | | Depth profile | `depthProfileRows`, `paintDepthProfile` | A profile unfolded into depth; the row length follows the volume and the largest level leads | Each effect is capped, so a wide range cannot flood the frame: the isometric grid stops at `ISOMETRIC_MAX_ROWS` rows and `ISOMETRIC_MAX_DEPTH` pixels of depth, the parallax shift at `PARALLAX_MAX_OFFSET` and the profile row at `DEPTH_PROFILE_MAX_LENGTH`. A dense axis damps the parallax instead of smearing it. ```ts import { buildIsometricGrid, paintIsometricGrid } from '@unifin/chart-core/render'; const grid = buildIsometricGrid(cells, { cellWidth: 16, levelHeight: 5, skew: 4 }); const painted = paintIsometricGrid(ctx, grid, { accent: '#2962ff', up: '#26a69a', down: '#ef5350', warn: '#cc06fb' }, { x: 24, y: 40 }); ``` The painters own no palette: colours arrive as tokens of the chart palette and the scene fills the background, so a palette switch repaints the canvas together with the chart. A canvas that cannot paint keeps the flat fill instead of failing. ### Look pack and gradients The look pack is one object on the element (`look`) and a set of attributes with the same names. It restyles the frame without touching the data or the layout. | Control | Attribute | Values | | --- | --- | --- | | Backdrop | `backdrop` | `flat`, `gradient`, `aurora` | | Bars | `bars-style` | `classic`, `neon`, `sunset`, `ice`, `mono` | | Volume tone | `volume-tone` | `theme`, `dim`, `accent`, `contrast` | | Volume alpha | `volume-alpha` | `0.15` .. `1` | | Readout | `readout-skin` | `plain`, `chip`, `cards` | | Font | `font` | `onest`, `inter`, `serif`, `mono` | | Indicator gradient | `indicator-gradient` | present or absent | | Line gradient | `line-gradient` | absent, `on`, or a share `0.02` .. `0.9` | | Volume gradient | `volume-gradient` | absent, `on`, or a share `0.02` .. `0.9` | | Chart gradient | `chart-gradient` | absent, `on`, or `from=#..,to=#..,angle=..,phase=..` | The three gradients are independent and work in every palette. `line-gradient` shades candle and column bodies from the bright top towards their own darker tail and tapers line and area strokes. `volume-gradient` shades the volume band and stays independent of the volume tone. `chart-gradient` replaces the flat theme fill with a ramp derived from the palette. Each gradient creates at most one ramp per colour and frame, so a long history keeps the flat frame cost. A canvas without gradients keeps the flat fill, and `classic` always resolves to the live theme colours. ### Presets and replay The presentation presets are opt-in, follow the motion policy and cost nothing while they are off. | Preset | What it draws | When it fires | | --- | --- | --- | | `sheen` | a soft highlight sweeping across the frame | continuously while active | | `cursorGlow` | a radial glow following the pointer | while active and the pointer moves | | `sparks` | a burst of particles at the newest close | on activation, on scene switches and on every live update of the last bar | ```ts const element = document.querySelector('unifin-chart'); element.fx('sparks', true); // false when the system prefers reduced motion element.sparkStyle = 'nova'; // burst style, read on the next burst ``` The history replay is the same engine the Pro workspace uses. `replayPlay(speed, from)` starts the cursor, `replayStep(delta)` walks whole bars, `replayPause()` holds it and `replayExit()` draws the full history again. `replay:progress` reports the index, progress, playing flag and speed. ## Desk frame effects The frame effects of the desk share the same engine and stay opt-in as well. The profile gradient, the area glow and the parallax depth layer are painted by the render subpath of the core, and the three desk presets merge one look over the host look without touching the host object. | Effect | What it draws | Switch | | --- | --- | --- | | Profile gradient | the value area ramp between VAH and VAL plus the POC, VAH and VAL pills | `paintProfileGradient` with the frame registry | | Area glow | three halo passes under the line fill, fading with the line | `polish.glow` on the series | | Depth layer | the candles shifted into the distance by the parallax shape | `paintDepthLayer` above a minimum plot width | | Desk presets | one of three desk looks: terminal dark, corporate light, white label | `DeskPresets` / `applyDeskPreset` | The depth layer fades out below the fade spacing and switches off entirely on a dense zoom, in the mini mode or on a plot narrower than 400 px: a refused layer paints nothing, so switching it off leaves the base frame byte for byte. Each gradient ask resolves through the frame registry, which keeps at most one ramp per colour and frame and drops the ramp when the theme or the canvas size changes. ## Motion policy While the system prefers reduced motion, enabling a preset returns `false` and nothing is drawn. The same policy gates the scene crossfade and the view animations, so a host never special-cases effects. ## See also - Order book chart (/docs/pro/orderbook) - the five variants and their models. - Terminal panels (/docs/pro/panels) - the panels of the Pro entry point. - Analytic figures (/docs/pro/charts) - the figure family and the shared heatmap painter. - Live effects (/docs/standard/effects) - the Standard scene built on the same engine. - Editions (/docs/editions) - what each entry point ships and its budget. --- # Live gallery Pro (Pro edition) Source: /docs/pro/gallery import { LiveKits } from '@/components/live-kits'; import { LiveProGallery } from '@/components/live-gallery-pro'; import { LiveOrderbook } from '@/components/live-orderbook'; import { LiveProFigures } from '@/components/live-pro-figures'; import { LiveRisk } from '@/components/live-risk'; import { ShowcaseGrid } from '@/components/showcase'; This page collects the Pro surfaces: everything below renders on this page with the published packages, through the same public API a host uses. The standard surfaces (series explorer, themes, profiles) are on the Standard gallery (/docs/standard/gallery). ## Live workbench Every look option of the desk in one place: the live chart below carries the compact chips of the whole look pack - the series, the backdrop, the bar palette, the volume tone, the readout skin, the font, the sparks, the price scale and the four gradients - next to the frame toggles. Every chip writes a public prop of the React entry point, so the chart repaints in place while the history keeps streaming. This is the fastest way to feel what each option does before opening the deeper pages. ## Analytics kits The four domain kits and the table kit: the yield curve with spreads, the swap ladder and its cumulative PV, the portfolio risk view and the option surface. ## Order book chart The five Pro order book variants over a live two-sided book. The chips switch the variant; the selects drive the palette, the font, the aggregation step and the depth. ## Terminal panels Liquidity ribbon, delta candles, pace of the tape, auction landscape and the efficient frontier - the panel painters of the Pro entry point. ## Risk figures Correlogram, risk decomposition, scenario cone and the attribution table, drawn by the risk kit. ## Product surfaces Curated frames of the shipped Pro surfaces (captured with the English interface): ## See also - Pro edition (/docs/pro) - what the entry point adds and where each surface is documented. - Analytic figures (/docs/pro/charts) - the waterfall, bullet, box plot, fan chart and heatmap. - Analytics kits (/docs/kits) - the four kits and the table kit with their documented models. - Standard gallery (/docs/standard/gallery) - the same engine on the standard surfaces. --- # Analytics kits (Shared edition) Source: /docs/kits import { LiveKits } from '@/components/live-kits'; The kits add the maths and the ready-made analytic views that fixed income, portfolio, swaps and option workflows need on top of the chart engine. Every kit is a separate package with no runtime dependencies: install only what you use. The table kit is the table layer of the core and the React binding, so it needs no extra package. | Kit | Package | Highlights | Page | | --- | --- | --- | --- | | Fixed income | `@unifin/chart-kit-bonds` | Yield and price maths, duration and convexity, accrual, yield curve with spreads, maturity ladder, coupon timeline | Fixed income kit (/docs/kits/bonds) | | Portfolio | `@unifin/chart-kit-portfolio` | Returns, drawdown, volatility, Sharpe, Sortino, beta, benchmark curve, underwater chart, allocation views, monthly heatmap, risk figures | Portfolio kit (/docs/kits/portfolio) | | Swaps | `@unifin/chart-kit-swaps` | Accrual schedule of both legs (ACT/365 and 30/360), forward rates from a discount curve, present value, par swap rate, cumulative PV curve, ladder and net-flow painters | Swaps kit (/docs/kits/swaps) | | Options | `@unifin/chart-kit-options` | Black-Scholes price and greeks, implied volatility, multi-leg payoff at expiry and now, greeks profiles, smile and surface, open interest by strike | Options kit (/docs/kits/options) | | Table | `@unifin/chart-core` + `@unifin/chart-react` | Figure columns, histogram and brush cells, group totals, row journal, export, and a table that drives the chart next to it | Table kit (/docs/kits/table) | All kits render through the same analytic axis of the core: a numeric scale (yield, price, percent) or a categorical scale (strikes, sectors, months) with no time dependency. ## Try the kits live Four live panels below paint the real kit output - the sliders and checkboxes call the same public painters and maths functions you would: ## How a kit is built A kit is a headless model plus painters. The model turns input rows into numbers a panel can print (a price, a duration, a set of risk contributions, a schedule, a payoff curve), and the painters draw those numbers on the analytic axis of the core. Nothing in a kit touches the DOM, so the same model feeds a React panel, a terminal, an export or a test. | Layer | Owns | | --- | --- | | `@unifin/chart-core` | The analytic axis, the analytic painters (curve, band, points, markers, bars, heatmap), the table model, the theming tokens | | A kit | The domain maths, the row builders and the kit-specific painters | | `@unifin/chart-react` | The table widget, the UI kit and the PRO panels that host a kit model | | The host | Pointer state, windows, live data and the layout of the surface | ## Editions and bundles The kits are optional bundles on top of the core: they reuse the same theme tokens, the same accessibility rules and the same rendering pipeline. A page that never imports a kit does not pay for it - bundlers keep the unused packages out of the build. Kit versions move in lockstep with the library and are listed on Versions (/docs/versions). ## See also - Fixed income (/docs/kits/bonds), portfolio (/docs/kits/portfolio) and options (/docs/kits/options) kit pages - the three live screeners. - Analytic figures (/docs/pro/charts) - the painters the kits feed. - API reference (/docs/api) - every exported symbol of every kit. --- # Fixed income kit (Shared edition) Source: /docs/kits/bonds import { LiveKits } from '@/components/live-kits'; import { LiveTables } from '@/components/live-tables'; import { LiveBondsMap } from '@/components/live-bonds-map'; import { LiveBondsS101 } from '@/components/live-bonds-s101'; import { LiveBondsS101B } from '@/components/live-bonds-s101b'; import { LiveBondsConstellation } from '@/components/live-bonds-constellation'; import { LiveBondsFan3d } from '@/components/live-bonds-fan3d'; import { LiveWaterfall3d } from '@/components/live-waterfall3d'; `@unifin/chart-kit-bonds` owns the fixed income maths and the painters a fixed income surface needs. It has no runtime dependencies beyond the core peer. ```ts import { bondPrice, bondYtm, macaulayDuration, modifiedDuration, accruedInterest } from '@unifin/chart-kit-bonds'; const terms = { face: 1000, couponRate: 0.06, frequency: 2, yearsToMaturity: 10 }; bondPrice(terms, 0.055); // clean price at a yield bondYtm(terms, 1042.5); // yield to maturity at a price macaulayDuration(terms, 0.055); // weighted average time of the cash flows modifiedDuration(terms, 0.055); // rate sensitivity in years ``` ## What the kit renders | Figure | Function | Reads | | --- | --- | --- | | Yield curve | `yieldCurvePoints` + `paintYieldCurve` | quoted points in years and percent; the curve is drawn on the numeric axis | | Curve spread | `curveSpread` + `paintCurveSpread` | a base curve and a peer curve; the spread comes back in basis points with minimum, maximum and average | | Maturity ladder | `buildLadder` + `paintBondLadder` | one bar per maturity bucket, with the weighted yield of the bucket | | Coupon timeline | `couponEvents` + `paintCouponTimeline` | every coupon and the redemption on a year scale | | Yield map | `yieldMapModel` + `yieldMapIsolines` + `paintYieldMap` | dated curves; cells are toned against the percentile domain inside every row, the isolines cross the equal levels | | Shape formats | `curveRidgelineModel`, `curveCompassModel`, `curveSurfaceModel`, `spreadRiverModel` | the ridge of the history, the shapes of several curves, the dated 2.5D stack and parallel spread channels | | Curve snapshot and fan | `curveSnapshotModel`, `curveFanHistory` | the muted dated curves behind the labelled hero line, and the quarterly fan with the alpha ramp of age | | Spread strip and credit panel | `spreadStripModel`, `creditSpreadPanel` | the 10Y-2Y reading by month with the inversion zone, and the IG/HY corridors with the stress runs | | Split and tone | `yieldDecomposition`, `countryHeatmapModel`, `tenorPulseChips` | the nominal split into real yield and breakeven, country values over a shared centre, key tenors with signed change | Yield, price and spread labels are rounded by the caller: the kit returns numbers, the axis formats them. ## Live curve, spread and ladder (image: /shots/bonds-dark-en.png) ## The premium curve readings The kit reads the history in four premium formats besides the curve itself: the snapshot puts the muted dated curves behind the labelled heroic line, the fan spreads the quarterly curves with the alpha ramp of age, the spread strip turns the 10Y-2Y reading into a monthly bar row with the inversion zone under zero and the pulse of the last print, and the credit panel follows the IG and HY corridors with the stress runs of HY marked and labelled in basis points. Every format is again a pure model plus a painter: the host owns the scale, the axes stay outside the kit. Each reading takes its own row at the full width of the section, and the pointer over a pane turns it live: a guide, a dot and a value capsule marking the nearest point of the model, with the same values in the caption line. (image: /shots/bonds-s101-section-dark-en.png) ```ts import { curveSnapshotModel, paintCurveSnapshot, paintSpreadStrip, spreadStripModel, } from '@unifin/chart-kit-bonds'; const snapshot = curveSnapshotModel(series, { heroIndex: 5 }); // hero = the newest by default paintCurveSnapshot(ctx, snapshot, input); // the muted history and the hero const strip = spreadStripModel(history, { longYears: 10, shortYears: 2, label: '10Y-2Y' }); paintSpreadStrip(ctx, strip, input); // bars, the inversion zone and the last print ``` ## The morph race and the idea mode Two dates of one window blended by the canon timing: the race steps the frames by 480 ms and a single morph covers the gap in 320 ms, while `prefers-reduced-motion` lands on the target frame at once. The idea mode freezes the last curve, aims a forecast ray from its final slope and pins a note onto it - the freeze stops the clock, so the picture holds still while the desk argues. The panes take one row each at the full width of the section, and the pointer reads the models live: the morph pane marks the start and the target level with the current blend share, the idea pane reports the curve and the ray end, the price pane returns both the yield and the clean price of the month under the cursor. (image: /shots/bonds-s101b-section-dark-en.png) ```ts import { BOND_MORPH_DURATION_MS, morphCurveSeries } from '@unifin/chart-kit-bonds'; const frame = morphCurveSeries(january, december, 0.35); // one blended curve paintAnalyticCurve(ctx, framePoints, input); // the hero of the frame ``` ## Price, yield and the market map The price mode reads the same dated series as a clean price to par (`priceFromYieldSeries`), and the dual view keeps both readings honest on their own axes. The market map returns to the issues: pick two bubbles and the kit joins them with the spread connector and its bp chip, while a hover card reports the tenor, the yield and the verdict of every issue under the pointer. ```ts import { marketMapModel, marketMapSpread, paintMarketMap } from '@unifin/chart-kit-bonds'; const map = marketMapModel(curve, issues, { fairBps: 8 }); // spread and verdict per issue paintMarketMap(ctx, map, input, {}, { selected: ['BND-03', 'BND-11'] }); const spread = marketMapSpread(map.rows, 'BND-03', 'BND-11'); // bp between the two ``` ## The yield map and the sibling formats The S102 wave reads a whole history at once: the topo map of rates with equal-level isolines, the ridgeline echo of the curves, the shape compass, the dated surface with the depth fog and the year chips, the inversion river of spread channels, the split of the nominal into the real yield and the breakeven, the globe of country spreads and the tenor pulse. Every format is a pure model plus a painter, so the host owns the scale and the kit never touches the frame budget of the scene. The formats take one row each, and the pointer reads every one of them like a live chart: the cell of the topo map with its percentile, the band of the echo, the spoke of the compass, the dated row of the surface, the spread of a channel, the blocks of the split, the country tile and the day change of a tenor chip. (image: /shots/bonds-map-dark-en.png) ```ts import { yieldMapIsolines, yieldMapModel, paintYieldMap } from '@unifin/chart-kit-bonds'; const map = yieldMapModel(history); // dates x tenors, deduped and thinned const lines = yieldMapIsolines(map, [0.03, 0.04]); // strict crossings of the equal levels paintYieldMap(ctx, map, input); // cells, isolines and the level chips ``` ## The yield constellation The decorated sibling of the market map (#price-yield-and-the-market-map) lives in the `@unifin/chart-kit-bonds/formats` subpath: the benchmark curve is the floor of the frame with a double-gradient sea under it, and every traded issue floats above as a star - a multi-layer radial aura toned by its rich/cheap verdict, a warn ring on the extremes, a gradient yield label and a hover card with the details. The auras are radial washes, not shadows, so a frame full of stars keeps the frame budget; breathing, hover and capture states stay on the host side. The view reads any slice of the tenor/spread plane: the wheel zooms around the pointer, a drag pans, the reset chip returns the full domain and a click focuses an issue with a short tween (instant under `prefers-reduced-motion`). Painting and the pick share the window through `constellationWindowInput`, so a reader after a zoom finds the same issue as before. (image: /shots/bonds-constellation-dark-en.png) ```ts import { clampConstellationWindow, constellationWindowInput, pickYieldConstellationPoint, paintYieldConstellation, yieldConstellationModel, } from '@unifin/chart-kit-bonds/formats'; const stars = yieldConstellationModel(curve, issues, { fairBps: 5 }); const window = clampConstellationWindow(stars, { tenorFrom: 4, tenorTo: 14, spreadFrom: 0.03, spreadTo: 0.05 }); const view = constellationWindowInput(stars, input, window); // the visible slice on both axes paintYieldConstellation(ctx, stars, view); // the sea, the auras and the labels const hit = pickYieldConstellationPoint(stars, view, mouseX, mouseY); // the hover card row ``` ## The benchmark fan in 3D The credit fan lifts the market map (#price-yield-and-the-market-map) into the scene engine through the `@unifin/chart-kit-bonds/fan3d` subpath: the rating benchmarks step away from the viewer in depth, every curve trails a gradient skirt down to the base plane, and each traded issue floats above its own benchmark as a marker with a radial halo, a stem and the rich/cheap tone of the market map, lifted by the size of its spread. The camera works as everywhere on this page: drag, the wheel, the arrow keys, the two angle presets and the reset chip. Hover reads the code, the benchmark, the spread in basis points and the verdict; a tap pins the benchmark and lights its curve. (image: /shots/bonds-fan3d-dark-en.png) ```ts import { benchmarkFan3dModel, paintBenchmarkFan3d } from '@unifin/chart-kit-bonds/fan3d'; import { createProjection, scene3dCamera } from '@unifin/chart-core/scene3d'; const fan = benchmarkFan3dModel(benchmarks, issues, { fairBps: 10 }); const projection = createProjection(scene3dCamera(), { width, height }); paintBenchmarkFan3d(ctx, fan, projection, { theme }, { highlight: 'aa' }); // the pinned benchmark ``` The fan is listed in the Bonds kit API (/docs/api/chart-kit-bonds) entry; the curve and marker painters are part of the core API (/docs/api/chart-core). ## The screener The fixed income screener is the kit rows in a working surface: sortable columns, heat toned yields, a row filter and the tranches behind every issue. The number locale switch reformats the cells the way a trading desk expects - grouping and the decimal separator follow the locale, while the precision of every column stays as the kit declares it. ```ts import { BOND_SCREENER_COLUMNS, buildBondScreenerRows } from '@unifin/chart-kit-bonds'; import { formatTableCell, sortTableRows } from '@unifin/chart-core'; const rows = buildBondScreenerRows(entries, '2026-10-04'); // years to maturity included const sorted = sortTableRows(rows, BOND_SCREENER_COLUMNS, { key: 'ytw', direction: 'desc' }); const cell = formatTableCell(sorted[0]!.ytw, BOND_SCREENER_COLUMNS[2]!, 'de-DE'); // '7,93%' ``` ## The coupon flows as a 3D waterfall The coupon schedule of a bond also reads as a waterfall: the payment dates walk one axis, the rate scenarios of the DV01 step the other, and every bar is the present value of one flow under the kit discount maths. Drag, the wheel and the arrow keys steer the camera; the reset button and the two angle presets restore the canonical views, and the base scenario stays highlighted. (image: /shots/portal-waterfall3d-dark-en.png) ```ts import { couponFlows, paintPvWaterfall3d, pvWaterfall3dModel } from '@unifin/chart-kit-bonds'; import { scene3dCamera } from '@unifin/chart-core/scene3d'; const flows = couponFlows({ face: 1000, couponRate: 0.0625, frequency: 2, yearsToMaturity: 5 }); const waterfall = pvWaterfall3dModel({ flows, ytm: 0.055, frequency: 2, rateShiftsBp: [-25, 0, 25] }); paintPvWaterfall3d(ctx, waterfall, { width, height, theme, camera: scene3dCamera() }); ``` The waterfall is listed in the Bonds kit API (/docs/api/chart-kit-bonds) entry; the camera is part of the core API (/docs/api/chart-core). ## See also - Bonds kit API (/docs/api/chart-kit-bonds) - every exported symbol. - Table kit (/docs/kits/table) - the widget and the figure cells a screener row can carry. - Analytics kits (/docs/kits) - all four kits and the table kit. --- # Portfolio kit (Shared edition) Source: /docs/kits/portfolio import { LiveKits } from '@/components/live-kits'; import { LiveRisk } from '@/components/live-risk'; import { LiveTables } from '@/components/live-tables'; import { LiveTerrain3d } from '@/components/live-terrain3d'; `@unifin/chart-kit-portfolio` owns the performance and risk maths of a portfolio and the painters of the views a portfolio surface shows. ```ts import { periodReturns, maxDrawdown, sharpeRatio, sortinoRatio, beta } from '@unifin/chart-kit-portfolio'; const daily = periodReturns(portfolioValues); maxDrawdown(portfolioValues); // worst peak-to-trough decline sharpeRatio(daily); // annualised, 252 periods sortinoRatio(daily); // the same on downside deviation beta(daily, benchmarkReturns); // sensitivity to the benchmark ``` ## What the kit renders | View | Function | Reads | | --- | --- | --- | | Benchmark curves | `benchmarkCurves` + `paintBenchmarkCurves` | portfolio and benchmark values; the curve is indexed to 100 at the first point | | Underwater | `drawdownSeries` + `paintUnderwater` | the same values; every point is a percent below the running peak | | Allocation | `allocationShares` + `treemapRects` / `paintTreemap`, `paintAllocationDonut`, `paintStackedBar` | weights per instrument; the treemap is drawn by the kit, the donut and the stacked bar are alternatives | | Monthly heatmap | `monthlyGrid` + `paintReturnsHeatmap` | monthly returns; rows are years, columns are months, growth and fall tones come from the theme | | Positions table | `buildPositionRows` + `POSITION_COLUMNS` | quantity, value, weight, profit and profit percent per position | ## Live curves, allocation and heatmap (image: /shots/portfolio-dark-en.png) The S105 wave ramps the fills: the underwater band is dense at the zero line and fades into the depth (0.28 -> 0.06), the portfolio curve of the benchmark frame gets a ribbon down to its baseline (0.16 -> 0.02), and every allocation shape - treemap cell, stacked bar slice and donut ring - carries one vertical ramp (0.42 -> 0.25) with a light 1 px edge. The fills are additive options of the kit painters; on a canvas without gradients every shape keeps its flat tone. (image: /shots/portfolio-fills-dark-en.png) ## Risk figures Four figures answer where the risk of a book comes from. They reuse the analytic family of the core - the correlogram is the shared heatmap with the diverging tone, the cone is the fan chart - so no figure ships its own painter. | Figure | Function | Reads | | --- | --- | --- | | Correlogram | `correlationGrid` + `paintCorrelationMatrix` | a labelled correlation matrix; the diagonal is forced to 1, out-of-range values are clamped and the upper triangle wins | | Risk decomposition | `riskContributions` + `paintRiskDecomposition` | weights and a covariance matrix; the contributions are the Euler decomposition of the variance and add up to one | | Scenario cone | `monteCarloCone` + `paintMonteCarloCone` | a spec with a seed; the same seed always yields the same cone and the bands are nested | | Attribution | `attributionRows` | the steps of a performance bridge; the rows share the base arithmetic of the waterfall | ```ts import { correlationGrid, riskContributions, monteCarloCone } from '@unifin/chart-kit-portfolio'; correlationGrid(['AAPL', 'GLD'], correlations); // diverging heatmap grid riskContributions([0.6, 0.4], covariance); // shares that add up to one monteCarloCone({ start: 100, drift: 0.0006, volatility: 0.013, steps: 120, seed: 11 }); ``` The cone also has a worker form: `monteCarloJob` builds a flat payload, `monteCarloJobTransferables` lists the buffers to transfer and `coneFromJob` rebuilds the bands on the receiving side, so a long simulation can leave the main thread without changing the numbers. ## The screener The portfolio monitoring board builds its rows from the same positions: market value, weight and profit, with the lots of every position behind a chevron and the P&L colours coming from the kit tones. The locale switch moves the grouping and the decimal separator, the precision stays declared. ```ts import { POSITION_COLUMNS, buildPositionRows } from '@unifin/chart-kit-portfolio'; import { filterTableRows, sortTableRows } from '@unifin/chart-core'; const rows = buildPositionRows(positions); // market value, cost, P&L, P&L %, weight const sorted = sortTableRows(rows, POSITION_COLUMNS, { key: 'pnl', direction: 'desc' }); const top = filterTableRows(sorted, POSITION_COLUMNS, 'AAPL'); ``` ## The correlation terrain in 3D The correlation matrix behind the correlogram also reads as a terrain: every pair of asset classes lifts a ridge by its coefficient, the pairs above the ridge threshold carry a warn stroke and the deep negatives mark pockets in the down tone. The same drag, wheel and keyboard controls steer the camera, the reset button and the two angle presets restore the canonical views, and `prefers-reduced-motion` keeps the frame static while the controls stay live. The S105 frame sheen washes the whole scene once with a single diagonal pass - never per cell. (image: /shots/portal-terrain3d-dark-en.png) ```ts import { correlationTerrainModel, paintCorrelationTerrain } from '@unifin/chart-kit-portfolio/formats'; import { scene3dCamera } from '@unifin/chart-core/scene3d'; const terrain = correlationTerrainModel({ labels, matrix }); paintCorrelationTerrain(ctx, terrain, { width, height, theme, camera: scene3dCamera() }); ``` The kit reference is the Portfolio kit API (/docs/api/chart-kit-portfolio); the camera is part of the core API (/docs/api/chart-core). ## See also - Portfolio kit API (/docs/api/chart-kit-portfolio) - every exported symbol. - Table kit (/docs/kits/table) - the row journal and the group totals a position table can carry. - Analytics kits (/docs/kits) - all four kits and the table kit. --- # Swaps kit (Shared edition) Source: /docs/kits/swaps import { LiveKits } from '@/components/live-kits'; `@unifin/chart-kit-swaps` values a plain vanilla swap and paints the position: the accrual schedule of both legs, the forward rates the curve implies, the present value of each leg and the par rate. ```ts import { flatCurve, netFlows, parSwapRate, swapNpvFromCurve, swapScheduleOf } from '@unifin/chart-kit-swaps'; const terms = { notional: 100_000_000, fixedRate: 0.05, startIso: '2026-10-06', tenorMonths: 60, stepMonths: 6, direction: 'pay-fixed' as const, }; const curve = flatCurve(0.05); const schedule = swapScheduleOf(terms, curve, '2026-10-06'); // both legs, projected from the curve const npv = swapNpvFromCurve(terms, curve, '2026-10-06'); // fixed, floating and the net const par = parSwapRate(terms, curve, '2026-10-06'); // the fixed rate that prices it at par const flows = netFlows(schedule); // what is paid or received on each date ``` ## What the kit renders | Figure | Function | Reads | | --- | --- | --- | | Leg ladder | `legPoints` + `paintSwapLadder` | one bar per payment, drawn from the zero line: a negative bar is a payment | | Net flows | `netPoints` + `paintNetArrows` | the net of both legs per payment date, marked on the palette of the chart | | Cumulative PV | `cumulativePvPoints` + `paintCumulativePv` | the running present value of the net flows - the curve that shows when the position has paid for itself | | Schedule | `swapSchedule`, `swapPeriods`, `flowsTotal` | accrual boundaries, the periods of both legs and the totals per leg | The kit signs every amount the same way (positive received, negative paid) and takes its day count conventions from the core, so a swap and a bond quote the same dates to the same accrual. Both ACT/365 and 30/360 are supported. ## Live ladder, net flows and cumulative PV (image: /shots/swaps-dark-en.png) The S105 wave adds the gradient fills and the smooth dynamics: the ladder bars ramp from the tip to the zero line, the cumulative PV curve carries a ribbon down to the plot floor with a bright edge, and the busiest payment date of the net view is emphasised. The two rate sliders set the target while the figure follows a 200 ms ramp - `data-swap-phase` marks the running frames, `?frozen=1` pins a deterministic capture, reduced motion lands at once, and the zoom indicator keeps the wheel and drag readouts honest (`data-swap-scale`). (image: /shots/swaps-dynamics-dark-en.png) ## Where it appears The swap view of the Yields workspace draws these painters: the leg ladder of the schedule, the net arrows of the payment dates and the cumulative PV curve next to the curve builders of the same kit. - Table kit (/docs/kits/table) - the net flow rows as figure cells. - Fixed income kit (/docs/kits/bonds) - the same curve and day count maths for bonds. ## See also - Swaps kit API (/docs/api/chart-kit-swaps) - every exported symbol. - Analytics kits (/docs/kits) - all four kits and the table kit. --- # Options kit (Shared edition) Source: /docs/kits/options import { LiveKits } from '@/components/live-kits'; import { LiveTables } from '@/components/live-tables'; import { LiveIvSurface3d } from '@/components/live-iv-surface3d'; `@unifin/chart-kit-options` prices options, solves implied volatility and paints the views an options surface needs - from the payoff of a multi-leg position to the two-dimensional volatility surface. ```ts import { bsPrice, bsDelta, impliedVol, payoffCurve } from '@unifin/chart-kit-options'; bsPrice('call', { S: 100, K: 100, T: 1, r: 0.05, sigma: 0.2 }); // 10.4506 impliedVol('call', marketPrice, { S: 100, K: 100, T: 1, r: 0.05, sigma: 0.2 }); ``` ## What the kit renders | View | Function | Reads | | --- | --- | --- | | Payoff | `payoffCurve` + `paintPayoff` / `paintPayoffZones` / `paintPayoffPair` | one or more legs, valued at expiry or at the current time; profit zones, breakevens and the now curve | | Greeks | `greekProfile` + `paintGreekProfile`, `bsDelta`, `bsGamma`, `bsVega`, `bsTheta`, `bsRho` | a greek across strikes or spot prices for one expiry | | Smile and term structure | `smileCurve` + `paintIvSmile`, `termStructure` + `paintIvTerm` | implied volatilities solved from quotes; a smile per expiry, a term structure per strike | | Surface | `ivSurface` + `paintIvSurface` | a grid of expiries and strikes; the kit paints the heat grid, the caller adds the axis labels | | Open interest | `oiPoints`, `oiTotals` + `paintOpenInterest` | contracts per strike; calls above the zero line, puts below, in contracts or in notional | | Option chain | `buildOptionChainRows` + `CHAIN_COLUMNS` | quotes per strike; mids, greeks from the quoted volatility and open interest in one row | The payoff builder supports multi-leg positions, so a spread, a straddle or a condor is a leg list. Greeks come from the same price function, and the implied volatility solver rejects quotes below the no-arbitrage bound instead of returning a meaningless number. The S105 wave settles the fills: the payoff zones ramp towards the zero line, the open-interest bars fade from a dense tip to the baseline, the smile and the term structure carry an accent underlay, and the heat grid keeps flat cells but gains a diagonal frame wash with a light edge on the picked row. On the live sections the volatility slider and a strike click move the figure with a 200 ms ramp (instant under `prefers-reduced-motion`), so the readouts change together with the frame. ## Live payoff, smile and chain (image: /shots/options-dark-en.png) ## The screener The option chain analytics board builds its rows with the chain builder: mids, deltas from the quoted implied volatilities and open interest per side, with the legs of every strike behind a chevron. The locale switch moves the digits; the moneyness and the greeks keep their kit precision. The product-level view of the same data lives on the Options desk (/docs/pro/options): the full chain with sorting, locale and ITM shading, and the gallery of every strategy with its payoff, risk summary and legs. ```ts import { buildOptionChainRows, CHAIN_COLUMNS } from '@unifin/chart-kit-options'; import { sortTableRows } from '@unifin/chart-core'; const rows = buildOptionChainRows(strikes, { spot: 100, T: 0.25, r: 0.05 }); const byOi = sortTableRows(rows, CHAIN_COLUMNS, { key: 'putOi', direction: 'desc' }); ``` ## The implied volatility surface in 3D The surface grid also reads as a 3D mesh: strikes walk one axis, expiries the other, and the solved implied volatility sets the height. Drag rotates the scene, the wheel and a two-pointer pinch zoom the scale, the arrow keys rotate the focused canvas, and the reset button plus the two angle presets return to the canonical views. The mesh model and the painter ship on the `/formats` subpath, so a host canvas reuses the same geometry. (image: /shots/portal-iv3d-dark-en.png) ```ts import { ivSurface } from '@unifin/chart-kit-options'; import { ivSurface3dModel, paintIvSurface3d } from '@unifin/chart-kit-options/formats'; import { scene3dCamera } from '@unifin/chart-core/scene3d'; const surface = ivSurface(strikes, expiries, 100, 0.24, -0.35, 1.6, 0.012); const model = ivSurface3dModel(surface); paintIvSurface3d(ctx, model, { width, height, theme, camera: scene3dCamera() }); ``` The surface builder sits in the Options kit API (/docs/api/chart-kit-options) entry; the camera is part of the core API (/docs/api/chart-core). ## See also - Options kit API (/docs/api/chart-kit-options) - every exported symbol. - Table kit (/docs/kits/table) - strikes, moneyness and the greek columns as cells. - Analytics kits (/docs/kits) - all four kits and the table kit. --- # Table kit (Shared edition) Source: /docs/kits/table import { BasketBoard, ColumnKindsBoard, ComplianceBoard, DerivativesBoard, FigureColumnsBoard, HierarchyBoard, HistogramBoard, LinkedRowsBoard, LinkedTable, LiveTableFigures, MoneyBoard, PortfolioBoard, ReconciliationBoard } from '@/components/live-table-figures'; The table kit is the table layer of the library: `@unifin/chart-core` owns the column model, the sorting, the figure cells and the export, and `@unifin/chart-react` owns the table widget. There is no extra package to install - a host that already uses the core and the binding has the whole layer, and the domain kits feed it their rows. For a worked book with the whole chain - SID, accounts, sub-balances, settlement agent and broker - see Balances table layouts (/docs/kits/balances). Mini figures of the table layer, drawn live by `@unifin/chart-core` - nothing here is an image. A table answers "how much"; an instrument row also has to answer "where the value came from", "how large it is against the rest", "is the row trustworthy" and "what happens if". Mini figures carry that second half inside the cell, so the reader never leaves the row. ## Figure columns of the data table A column declares its figure, and every visible row draws it next to the number: ```tsx const columns: TableColumn[] = [ { id: 'trend', title: 'Trend', kind: 'number', digits: 2, value: (row) => row.closes.at(-1) ?? null, figure: { kind: 'sparkline', values: (row) => row.closes, label: (row) => `${row.symbol} trend, last sixteen closes`, }, }, ]; row.symbol} />; ``` The figure repeats the number, it never replaces it: the column keeps `value`, so sorting, filtering and copying work unchanged. A cell whose figure has nothing to draw - an empty window, a non-finite value, a column without a figure spec - renders the number alone, without an exception. A host that renders for a locale passes it down: `` reformats every numeric cell through the table model - grouping and the decimal separator follow the locale, while the digits and the unit of each column stay as the kit declares them. The live boards on the bonds (/docs/kits/bonds), portfolio (/docs/kits/portfolio) and options (/docs/kits/options) kit pages carry a switch that shows the same rows in `en-US`, `de-DE` and `ru-RU`. The board below runs five figure columns off one shared canvas pool. The counters come from the pool itself, and a virtualised board holds canvases for the visible rows only, so a long table keeps the same bound: Two rules keep the pool honest: a canvas is borrowed for a cell and returned when the row leaves, and a cell that cannot get one degrades to its number - the pool never grows past its limit to hide a leak. ## Column kinds and signed scales A financial board needs five kinds the plain model does not have: basis points, money with a currency code, tenor, rating and boolean. They are declared in the column, so alignment, sorting, filtering and copying keep working: ```ts const columns: TableColumn[] = [ { id: 'coupon', title: 'Coupon', kind: 'bp', digits: 1, signed: true, value: (row) => row.couponBp }, { id: 'notional', title: 'Notional', kind: 'money', currency: 'USD', value: (row) => row.notional }, { id: 'tenor', title: 'Tenor', kind: 'tenor', value: (row) => row.tenorMonths, inlineBar: true }, { id: 'rating', title: 'Rating', kind: 'rating', value: (row) => row.rating, pills: (row) => [{ text: row.rating, tone: 'warn' }], }, ]; ``` Three rules keep the cells honest: - `signed` tones the cell by the sign of the value, while `tone` stays the function form for rules that are not about the sign; - `inlineBar` draws a thin bar under the number against the column maximum, so the reader sees the size before reading the figure; - a pill carries text and a tone, never an icon font or an emoji, and the vocabulary of statuses comes from the platform, not from the library. ## Column histogram, brush and sort chain The head of a numeric column is the cheapest place to answer "what is in this column": ```tsx row.symbol} histogram={{ buckets: 18, brush: true }} onRangeFilter={(columnId, range) => setRange(range === null ? null : { columnId, ...range })} rangeFilter={range} loadingProgress={loading} initialSorts={[{ key: 'ytw', direction: 'desc' }]} />; ``` - the histogram is drawn from the column values, marks the median and shows the applied range as a band; - the brush needs `Shift` on purpose: a plain drag keeps selecting text, which is what a reader expects in a table of numbers, and a range that was set can always be cleared; - a header click replaces the sort, `Shift`-click appends a key (up to three, each with its priority number), and the same key cycles its direction; - `loadingProgress` draws the load strip over the numeric headers while history is fetched. ## Sharing one selection with the chart The link is a public contract of the core, `createTableChartLink`, and it carries one reference: the row key, the series the row points at and the time the row is about. ```ts import { createTableChartLink } from '@unifin/chart-core'; const link = createTableChartLink({ group: 'board' }); // crosshair group of the host, optional link.onRow((event) => { // event.ref: { key, seriesId, at }; event.from: 'table' | 'chart' setRow(event.ref); }); ``` ```tsx row.symbol} link={link} rowRefOf={(row) => ({ key: row.symbol, seriesId: row.symbol, at: row.sessionDate })} /> ``` Four rules keep the link predictable: - the row key is the one the host already uses, never a position in the current sort, so sorting does not move the selection; - the same row published twice raises one event, so a pointer resting on a row does not repaint the chart; - the row is the single source of the selection: the chart puts its crosshair on the row time and keeps no idea of "current" of its own; - rows are reachable from the keyboard (`Tab`, then `Enter`) and the linked row carries `aria-current`. ## Hierarchy, group totals and export An issue is not a leaf: it has tranches, a position has lots, a strike has a call and a put. The board carries the tree and the totals of a group, and the columns declare what a total means: ```ts // The model flattens what is visible and totals the children of a group. const tree = { childrenOf: (row: Issue) => tranchesOf(row.isin) }; const columns: TableColumn[] = [ { id: 'nominal', title: 'Nominal', kind: 'money', value: (row) => row.nominal, aggregate: sumAggregate((row) => row.nominal), // a book adds up }, { id: 'ytw', title: 'YTW', kind: 'percent', value: (row) => row.ytw, aggregate: weightedAverageAggregate((row) => row.ytw, (row) => row.nominal), // a yield does not }, ]; row.isin} tree={tree} stickyFirst onCopy={(text, format) => log(format, text)} />; ``` - a column without an aggregate shows nothing in a group line, because a sum of yields is not a yield; - the first column can stay put while the board scrolls sideways (`stickyFirst`), which is what makes a wide financial board readable; - the caption copies the board as TSV or CSV: the table builds the text itself, the host receives it and can write a file (the PDF path stays in `buildChartPdf`, where the chart frame is added). ## Basket of rows, actions and edits A reader rarely wants one row: a book is a basket of holdings, and the numbers that matter belong to the basket, not to a row. Three pieces of the layer turn a selection into one thing: ```ts import { basketMetrics, basketSeries, timeFilterFromCursor } from '@unifin/chart-core'; // One weighted figure over the ticked rows. const metrics = basketMetrics({ members: keys.map((key) => ({ key, weight: nominalOf(key) })), valueOf: (key) => yieldOf(key), sumOf: (key) => nominalOf(key), }); // Their composite, aligned by time and normalised, so a basket of ten draws like a basket of two. const composite = basketSeries(seriesOf(keys), { mode: 'normalised' }); // The cursor of the chart, read the other way round: the rows of one bucket. const filter = timeFilterFromCursor(rows, cursor, (row) => row.tradedAt); ``` ```tsx row.isin} selectable initialSelectedKeys={['KZ2C0000719', 'KZ2C0000941']} onSelectionChange={setKeys} rowActions={(row) => [{ id: 'watch', label: 'Watch', onSelect: () => watch(row) }]} editable={(column, row) => column.id === 'nominal' ? { value: row.nominal, min: 0, max: 2_000_000_000, onCommit: (value) => commit(row, value) } : null } />; ``` Four rules keep the basket honest: - the selection is a set of row keys, so sorting and filtering never move it, and the keys leave the table as the host's own identifiers - the basket survives a re-sort because it never referred to a position; - the arithmetic lives in the core, not in the board: the same `basketMetrics` answers a React table, a custom element and an export, and a member with a missing weight stays in the count but leaves the mean; - a row action is a button with a label from the host (watch, add to a portfolio, open in the chart); the library ships no icons and no menu of its own; - an editable cell only opens on a deliberate gesture, commits through the host callback - which is the only party that knows the rules - and shows the range it may take, so an out-of-range entry is visible before it is written back. ## Derivatives: the surface, the payoff and the greeks A derivative row has no single number: an option is a surface plus a payoff, a future is a curve, a book is a correlation table. The family carries six more primitives for that: ```ts import { paintIvMatrix, paintPayoffCurve, paintGreekBars, paintTermCurve, paintCorrelationHeat, paintScenarioCone } from '@unifin/chart-core'; // One cell per strike and expiry; the smile of every row is drawn through the // cheapest strike of that row. paintIvMatrix(ctx, { strikes, expiries, vols }, box); // The payoff against the underlying, with a mark on every break-even. paintPayoffCurve(ctx, payoff, box); // Delta, gamma, vega and theta in one signed row: a negative theta has to be visible. paintGreekBars(ctx, [delta, gamma, vega, theta], box); // The futures curve with the open interest under it - a flat curve without interest // is not a signal. paintTermCurve(ctx, settlePrices, box); // The correlation of the book: the diagonal stays empty, because a name is always // correlated with itself. paintCorrelationHeat(ctx, { labels, values }, box); // The band a shock spreads over the horizon, with the value of today marked. paintScenarioCone(ctx, { base, lower, upper }, box); ``` ```tsx row.id} onRowSelect={(row) => setFocus(row.id)} />; ``` Four rules of the derivative figures: - a surface, a correlation table and a cone are passed as structures, not as flat samples: flattening them would be ambiguous, and the painter is the one place that validates the shape; - the smile, the break-even and the open-interest bars are part of the primitive: a reader should not have to reconstruct them from numbers beside the cell; - the greeks are signed bars around the middle line, and a greek that is not a number is dropped instead of being drawn as zero; - the board composes the cell figures with the same painters on a larger canvas, so one implementation serves both the cell and the side panel. ## Portfolio, depository and money A position row carries the heat of its months, and the questions of a book - what is the allocation, how deep was the drawdown, does the account survive the month - are answered next to it, not in another screen: ```ts import { paintBalanceTimeline, paintCashflowLadder } from '@unifin/chart-core'; // Money does not move between two settlements: the line steps, the part below zero is // tinted as a violation and the lowest point of the window carries a mark. paintBalanceTimeline(ctx, dailyBalances, box); // One column per period, inflows above the line and outflows below, with the running // total over them - the question is whether the account survives the month. paintCashflowLadder(ctx, periodFlows, box); ``` ```tsx row.symbol} onRowSelect={setFocus} />; ``` Three rules of the money figures: - the balance steps and never slopes: a sloping line would claim a continuous change the ledger does not have, and an account below zero has to be visible without reading the number; - the running total of the cash-flow ladder is the point of the figure, so the columns share one scale and the total keeps its own; - an instruction carries its stage in the row (a funnel of the stages and a status pill), because the stage is what the reader acts on. ## Compliance, limits and the journal of a row A compliance reader asks four things about a row: how much of the limit is used, where the breach starts, who changed the row and whether its sources are fresh. All four fit in the row: ```ts import { paintLimitBar } from '@unifin/chart-core'; // Utilisation against the ceiling with the threshold marked on the track; the part // above the threshold takes the violation colour. paintLimitBar(ctx, { used: 1420, limit: 1500, warnAt: 1200 }, box); ``` ```tsx row.id} />; ``` Three rules of the compliance figures: - the breach is drawn, not described: the excess over the threshold has its own colour, so the state of a row is visible before the number is read; - the journal of a row is a timeline strip of its changes plus a pill with the author: the figure answers when, the text answers who, and neither pretends to do the other's job; - freshness is a strip of the sources with the stale one flagged (`qualityStrip`), because a limit computed from a stale source is a different statement about the same row. ## Reconciliation: expected against actual Two books of the same thing - a clearing statement and the ledger, a portfolio and its custodian - are compared row by row, and the difference is the answer the reader needs: ```ts import { asOfGap, asOfVersion, reconcile, reasonWaterfall, reconciliationSummary, reconciliationToText } from '@unifin/chart-core'; const entries = reconcile(rows, { tolerance: 1, // absolute, in the currency of the books pairOf: (row) => ({ key: row.key, expected: row.expected, actual: row.actual, reason: row.reason }), }); const summary = reconciliationSummary(entries); // matched, broken, net and gross difference const steps = reasonWaterfall(entries); // what caused the difference, largest first const report = reconciliationToText(entries); // text the host can export const before = asOfVersion(history, '2026-10-06'); // the last version of every key as of a date const after = asOfVersion(history, '2026-10-08'); const gap = asOfGap(before, after); // changed, added and removed rows ``` A saved view keeps the arrangement of the board, not the data: ```ts import { applyTableViewColumns, parseTableView, serializeTableView } from '@unifin/chart-core'; const payload = serializeTableView(view); // stable key order, comparable text const restored = parseTableView(payload); // null on a broken or foreign payload const columns = applyTableViewColumns(restored ?? view, columns); // view order wins, new columns appended ``` Four rules of a reconciliation: - the tolerance is absolute by default: a relative one hides a small break inside a large number, and the reader of a clearing statement wants the currency amount; - a pair the host cannot express as two finite numbers is reported as broken, not skipped: silence about a missing number is the one answer a reconciliation must never give; - a row is read as of a date, and the gap names what changed, appeared and disappeared - the versions are compared by the host object, so a stale flag moving is a change; - the report leaves the screen as text (TSV or CSV), because a break has to be signed off by someone who is not looking at the board. ## The linking pattern A figure cell is useful on its own, but the reason a financial table belongs to a charting library is the link: the row and the chart share one selection. Hovering a row moves the chart, the keyboard does the same with `Tab` and `Enter`, and a click pins the choice so the pointer can move away. Three rules make the link predictable: - the row is the single source of selection - the chart never holds its own idea of "current"; - the link uses the row key the host already has (`getRowKey`), not a position in the current sort; - hiding a row (filter, collapse) clears the selection instead of leaving the chart on a hidden row. ## Using a figure cell ```ts import { paintMiniFigure, resolveThemeByName } from '@unifin/chart-core'; const theme = resolveThemeByName('dark'); // 208 x 30 CSS pixels inside the cell, device pixel ratio applied by the host. paintMiniFigure(context, 'sparkline', closes, { width: 208, height: 30, theme }); ``` ```tsx ``` The painter draws into any canvas-like context, so a cell, a tooltip row or a printed report share one implementation. A figure keeps its numbers in the host: the cell paints, it never computes. ## The primitives | Figure | Answers | Typical column | | --- | --- | --- | | `sparkline` | Where the value came from over the window | Price, yield, position | | `deltaBar` | How far and which way a signed value moved | Day change, P&L, spread | | `inlineBar` | How large the value is against the column maximum | Coupon, volume, exposure | | `microBars` | The shape of a small series | Prints, intraday volume | | `heatStrip` | Monthly or bucket returns at a glance | Returns, cash flow calendar | | `miniStack` | What the group is made of | Rating buckets, sector mix | | `scaleMark` | Where a rating or tenor sits on its scale | Rating, maturity, percentile | | `qualityStrip` | Which fields are filled and which are stale | Data coverage | | `timelineStrip` | When the events of the row happen | Coupons, settlements, audit | | `miniDistribution` | The spread of the column around its median | Universe screening | | `miniGauge` | Utilisation of a limit as one arc | Limits, margin | | `miniWaterfall` | How the pieces build the total | Attribution, reconciliation | | `miniLadder` | Bid and ask depth around the mid | Order book, liquidity | | `statusFunnel` | How many items reached each stage | Payments, onboarding | ## What to keep in mind - **One canvas per cell is not free.** A hundred thousand rows must not hold a hundred thousand contexts: paint only visible rows and reuse contexts through a pool, and measure before shipping a busy column. - **The figure repeats the number, it does not replace it.** Keep the value as text in the neighbouring cell - a colour or a shape alone is not readable for everyone, and it is not searchable. - **Every figure needs a text equivalent.** The canvas carries `role="img"` and an `aria-label` with the value and its direction; the same sentence belongs in the accessible description of the row. - **Colours come from the theme.** A figure never hardcodes a palette: the cell stays correct in all six palettes and in a white-label shell. ## See also - Analytic figures (/docs/pro/charts) - the larger analytic painters these cells borrow from. - Bonds (/docs/kits/bonds), portfolio (/docs/kits/portfolio) and options (/docs/kits/options) kit pages - tables that use the figures in a working surface, with the number locale switch. - Theming (/docs/standard/features) - palettes, tokens and what a host can restyle. --- # Balances table layouts (Shared edition) Source: /docs/kits/balances The balances section puts the table layer on a worked book: a single investor id (SID), its depository accounts and the sub-balances inside an account. Every account names a settlement agent and a broker, and the `TRAD` sub-balance is the part a broker holds for trading. The book is generated and deterministic: 1 000 owners (companies, funds and individuals), 1 450 accounts, 3 950 sub-balances and 500 US instruments - 240 stocks, 60 ETFs and 200 corporate bonds - with amounts in USD. The pages below are live: the theme switch, paging, search and the aggregation table all work inside the frame. ## The book | Level | What it holds | | --- | --- | | Owner | SID, legal form, tax id, total quantity, nominal and market value, trading value | | Account | Account number, type (owner, nominee, trust manager), settlement agent, broker, open date | | Sub-balance | `AVAI` available, `TRAD` trading with the broker, `BLOK` blocked, `PLED` pledged, `TRUS` trust, `REPO` repo, `NAVL` encumbered | | Position | Ticker, ISIN, issuer, quantity, nominal value, market value | Amounts are in USD; shares carry a nominal of 0.01, bonds and T-bills a nominal of 1 000. Owners, accounts, instruments, settlement agents and brokers carry a status: `active`, `suspended` or `archive`. The sub-balance status follows its type (available and trading are active, blocked, pledged and repo are suspended, encumbered is archived). Quantity, opening quantity, closing quantity and the three face amounts of fixed income are separate columns, never one cell; exports carry the same fields. ## Layouts | Layout | What it answers | | --- | --- | | Spine | The statement shape: owner group, accounts and sub-balances on one coloured spine | | Lane | What an account is made of, one row per account, with a filter by sub-balance | | Matrix | How much of an instrument is free, trading, blocked or pledged | | Cards | The investor whole: accounts, sub-balances and positions in one card | | Ledger | The balance of a settlement agent, a broker or an owner as a subtotal | | Agent matrix | The settlement agent as a column, with the trading part inside the column | | Board | Agents, accounts and the account detail in three linked panes | | Statement | One printable account statement per page | | Tree | One workplace over the book: a four-level tree, a pivot of instruments by sub-balance, a flat list and a split view, with the aggregation table as the left navigator | | Insight | Not a table: sparklines, share bars, a composition strip, a baseline, a heat pivot and an instrument card over the same book | The aggregation table also acts as a filter on every layout, not only on the tree: a row picked there narrows the page to one owner, to the accounts that hold one ISIN, to the accounts of one settlement agent or broker, or to one sub-balance, and a `Clear filter` button next to the table brings the whole book back. ## The ISIN cut The instrument itself is present in every layout: a position line in the spine and card layouts, the ISIN column of the lane detail, the board detail and the statement, the row identity of the matrix layouts, an account expansion in the ledger and the fourth level of the tree. The aggregation table adds a separate `Instrument (ISIN)` cut with the quantity, market value, trading value and owner count of each of the 500 instruments; its search matches ISIN, ticker and issuer. ## One workspace, four views The tree layout is a workspace: the same book can be read as a four-level tree, as a pivot (instruments as rows, sub-balances as columns, switched between quantity and market value), as a flat list (instrument + account + status with a share of the instrument) and as a split view (instrument list on the left, its book on the right). `Qty | Value` selects the measure. `Value` is the market value in USD. `Qty` is the quantity in pieces, and for fixed income it adds the face amount: nominal times quantity. Every value owns a column - `Quantity`, `Open Qty`, `Close Qty` always, and `Face Amnt`, `Open Face`, `Close Face` in the `Qty` measure for fixed income (other asset classes show `-`). Nothing is stacked inside one cell. `Nominal` is dropped in the `Qty` measure because it repeats the face amount of a bond and is a few cents for a share. The pivot keeps one amount per sub-balance cell and carries `Curr Face Amnt`, `Open Face Amnt` and `Close Face Amnt` in the cell tooltip; the CSV always writes the separate columns `quantity`, `open_quantity`, `close_quantity`, `face_amount`, `open_face` and `close_face`. The aggregation table is moved to the left as a navigator: a row picked there narrows every view, and the filters, sorting and view state are shared. Under the tabs the navigator shows the statuses of the active cut (`active`, `suspended`, `archive`) and filters every view by them; the whole column can be hidden and brought back. Each view stays a single table, `Pivot` rows open `Split` on that instrument, the split list works with the arrow keys, and `Export CSV` follows the active view. `Pivot` keeps a dedicated `ISIN` column on the right of the sub-balances. `Fields` opens a chooser with every column of the current measure: quantity, opening and closing quantity, the three face columns of fixed income, nominal, trading, market value and share. Unticking a column removes it from the tree, the flat list and the split detail at once - header, rows and footer stay aligned - and `Show all` brings the full set back. The choice is kept with the rest of the view and survives a reload. The pivot has no optional columns, because its columns are the sub-balances. `Pivot` shades each cell with the colour of its sub-balance and an intensity that follows the displayed amount (market value in `Value`, quantity or face amount in `Qty`), against the largest cell of the column. The flat list draws the share of the instrument as a bar inside its cell, and `Split` opens the instrument card: territory fields (ticker, ISIN, issuer, asset class, type, sector, rating, maturity, price, positions, face amount), a 90-day candle history with the last price line, the market profile of the price at its right and the delta of every day under the candles; hovering the price turns the readout into that day. ## Charts on top of the book The tenth card, `J - Book insight`, is an add-on rather than a table layout: it shows every place of the workspace that can carry a picture. - a 30-day sparkline and a share bar inside an owner row, with a hover reading of the window; - the composition strip of the sub-balances as a stacked area, one band per code, last day equal to today; - the net change of the book against the first day of the window, drawn as a baseline with gains above zero and losses below; - a pivot with heat: instruments as rows, sub-balances as columns, the intensity of each cell follows market value; - an instrument card with a 90-day candle history, its market profile at the right of the price and the delta of every day underneath, plus a list of instruments with sparklines; - a flat list where the share of the instrument is a bar in the cell. Charts read the design tokens of the kit and repaint on a theme switch without rebuilding the page; the demo series are generated from the same seeded book, so a reload gives the same picture. ## Filters, sorting and grouping Every layout carries the same filter bar: asset class, currency, instrument type, sector, rating, a row of sub-balance status chips and a `Show zero balances` switch. A filter narrows the positions first, so the owner, account and section totals always add up to what is visible on the page. `Sort` orders the rows by market value, quantity, nominal or name. `Group by` exists on the tree and swaps its third level between sub-balances, asset class, issuer, sector, instrument type, rating and maturity. It stays one table: the third column header and the panel title follow the chosen level, and nothing splits into a second table. The view - filters, sort, grouping, expanded branches, measure, hidden columns, page and page size - is kept per layout in the browser, so a reload returns to the same picture and `Reset view` brings the defaults back. The workspace always opens on the tree table: the four representations answer different questions, so the opening screen stays the book itself, and `Pivot`, `Flat list` and `Split` are one click away. `Export CSV` writes the current view with the expanded branches of the visible page: a collapsed node is one summed row, an open node is its children. ## Controls - Paging on every layout, with a page list and a jump box; the tree and the aggregation tables offer 10, 20, 50 or 100 rows per page. - Search by SID, owner name, account number or instrument, depending on the layout. - Dark and light palettes; colours and metrics come from the design tokens of the kit. - The aggregation table groups by owner, instrument (ISIN), settlement agent, broker and sub-balance. - Zero balances are hidden until switched on; fractional quantities keep their decimals, negative amounts show in parentheses and a missing rating or maturity is shown as `-`. - Quantity, opening quantity and closing quantity are separate columns, and the `Qty` measure adds the face amount, the open face amount and the close face amount of fixed income as their own columns. - `Fields` hides or shows any column of the tree, the flat list and the split detail; `Show all` restores the defaults and the choice is remembered in the browser. - The pivot shades its cells by amount, the flat list shows the share as a bar and the split view carries the instrument card with price, market profile and delta. - The statement layout prints one account per page. The widget behind the layouts is documented in the Table kit (/docs/kits/table). --- # Editions (Shared edition) Source: /docs/editions An edition is an entry point of one package, not a separate build: nothing is duplicated, and the import decides how much surface you get. ## Entry points | Entry point | Import | Surface | Ceiling / fact (gzip) | | --- | --- | --- | --- | | Standard | `@unifin/chart-react/standard` | 24 series types, scales, panes, sparkline and mini profiles, chart grid, sync groups, React hook, attribution mark | 14 / 13.32 KB | | Pro | `@unifin/chart-react/pro` | Standard plus the workspace layer: layouts, replay, order flow, profiles, alerts, trading UI, LINK | 500 / 77.11 KB | | Root (compatibility) | `@unifin/chart-react` | The Standard surface plus the palette registry (`DARK_THEME`, `resolveThemeByName`), which the editions do not export: the entry stays for hosts of earlier majors and for samples that take the theme constants with the component. Pro lives in `/pro`; new hosts pick an edition | 14 / 13.38 KB | | Core | `@unifin/chart-core` | Renderer, scales, data, indicators, drawings, profiles, trading models - framework-free | 148 / 147.24 KB | | Kits | `@unifin/chart-kit-bonds`, `-portfolio`, `-options`, `-swaps` | Domain models and their painters | 10 / 8 / 12 / 10 KB (2.45 / 3.98 / 3.88 / 2.13) | Standard publishes under two names of one entry: `@unifin/chart-react/standard` and the original `@unifin/chart-react/light` - both build from one source. Pick one name per project. ## Attribution Standard charts carry the Unifin mark in the bottom-left corner of the frame - the sign plus the name of the library, clickable to the site, the way charting vendors mark their charts. `attribution={false}` removes it, `attribution={{ href, label }}` points it at your own address and name; the mini and sparkline widgets never draw it. Pro is white-label: the Pro entry point, the terminal panels, the analytics kits and the order book chart ship no Unifin mark. A Pro chart removes the Standard mark with `attribution={false}`, so a broker terminal renders without any vendor branding. ## What Pro adds | Area | Included in Pro | | --- | --- | | UI kit | Toolbar, buttons, inputs, selects, dialogs, menus and toasts on one control language | | Workspace | Multi-chart layouts, panels, command palette, layout persistence | | Market replay | Playback engine with speeds, seeking, tick and book recordings | | Order flow | Footprint clusters, ladder and tape, cumulative delta, book heatmap, order book chart with five variants | | Analysis | Volume profile, POC and value area, composite profiles, risk figures | | Alerts | Rule builder, group editor, templates, retry policy | | Trading UI | Order ticket with six order types, risk ruler, draggable stop, take and order lines, paper broker, session report | | LINK | Crosshair and selection synchronization between charts | ## Entry point per product - **Embedded widget, tile or dashboard** - Standard. - **Trading screen** - Pro. - **Framework-free host** - the core only, drive the renderer yourself. ## Budgets and versions | Fact | Value | | --- | --- | | Versioning | One version for all packages and editions, released in lockstep | | Breaking changes | Major versions only | | Budgets | Contract ceilings above; the measured size of every entry is checked on each build, and a ceiling moves only in a measured step with a raw log. The largest move: the Pro ceiling went from 53 KB to 500 KB (owner decision of 08.10.2026) so the Pro Desk programme was not blocked by weight | > **Note** Every entry point carries one version number, so mixing them cannot produce a mismatch. > Current numbers: Versions (/docs/versions). ## See also - Versions (/docs/versions) - package versions and how they map to editions. - Features (/docs/standard/features) - what the layers described above look like on screen. - Getting started (/docs/standard/getting-started) - install and first chart. --- # Product comparison (Shared edition) Source: /docs/product-comparison The table compares Standard and Pro against a **typical general-purpose charting library**. That column stays generic: third-party libraries are assembled from plugins and differ version to version. Legend: `✓` included, `-` not part of the edition, `±` partial or plugin-dependent. | Capability | Standard | Pro | Typical charting library | Docs | | --- | :---: | :---: | :---: | --- | | **Rendering** | | | | | | Canvas2D renderer with dirty regions and DPR-aware text | ✓ | ✓ | ✓ | Features (/docs/standard/features) | | Optional WebGL2 backend for heavy series types | ✓ | ✓ | ± (many render SVG only) | Features (/docs/standard/features) | | Six token palettes, white-label hosts, reduced-motion policy | ✓ | ✓ | ✓ | Features (/docs/standard/features) | | Gradients: series bodies, volume columns, chart background, brand shimmer | ✓ | ✓ | ± | Live effects (/docs/standard/effects) | | **Series and data** | | | | | | 23 financial series types (candles, renko, kagi, point-and-figure, line break) | ✓ | ✓ | - (mostly line, bar, area, scatter) | Series types (/docs/standard/series-types) | | Footprint clusters with imbalance and absorption | ✓ | ✓ | - | Series types (/docs/standard/series-types) | | Bars and ticks, 22 timeframes with resampling, pageable feeds | ✓ | ✓ | ± | Features (/docs/standard/features) | | **Indicators and drawings** | | | | | | 128-study indicator engine with incremental recalculation | ✓ | ✓ | - (plugins vary) | Indicators (/docs/standard/indicators) | | 96 drawing tools with undo and redo, templates, share links | ✓ | ✓ | - | Features (/docs/standard/features) | | **Analytics** | | | | | | Volume profile, POC, value area, composite profiles | ✓ | ✓ | - | Features (/docs/standard/features) | | Analytic figures: waterfall, bullet, box plot, fan chart, heatmap grid | - | ✓ | - | Analytic figures (/docs/pro/charts) | | Domain kits: fixed income, portfolio, swaps and options models | - | ✓ | - | Analytics kits (/docs/kits) | | Screeners: fixed income screening, portfolio monitoring, option chain analytics | - | ✓ | - | Kits (/docs/kits) | | **Order flow and trading** | | | | | | Order flow: ladder, tape, cumulative delta, book heatmap | ✓ | ✓ | - | Features (/docs/standard/features) | | Order book chart with five canvas variants | - | ✓ | - | Order book chart (/docs/pro/orderbook) | | Terminal panels: liquidity ribbon, delta candles, pace of the tape, auction landscape, frontier | - | ✓ | - | Terminal panels (/docs/pro/panels) | | Trading UI: six order types, risk ruler, draggable stop and take | ✓ | ✓ | - | Features (/docs/standard/features) | | Alerts: rule builder, templates, retry policy, platform channels | ✓ | ✓ | - | Features (/docs/standard/features) | | **Workspace** | | | | | | Multi-chart workspace, layouts, saved state, command palette | - | ✓ | - | Terminal panels (/docs/pro/panels) | | Market replay with recording serialization | - | ✓ | - | Terminal panels (/docs/pro/panels) | | LINK crosshair and selection synchronization | ✓ | ✓ | - | Features (/docs/standard/features) | | **Embedding and quality** | | | | | | Unifin attribution mark in the chart corner, linked to the site | ✓ | - (Pro ships white-label) | ± (vendor marks are usually mandatory) | Editions (/docs/editions) | | White-label: no vendor mark on any surface | - (mark on by default, `attribution={false}` removes it) | ✓ | ± (most vendors require the mark) | Editions (/docs/editions) | | React components and a `` custom element | ✓ | ✓ | ✓ | Getting started (/docs/standard/getting-started) | | Server-side rendering safe import | ✓ | ✓ | ± | API overview (/docs/api) | | Framework-free core (no React or Vue required) | ✓ | ✓ | ± | API overview (/docs/api) | | Keyboard and screen-reader support on every surface | ✓ | ✓ | ± | Features (/docs/standard/features) | | Frame budget targets for million-bar histories | ✓ | ✓ | - | Features (/docs/standard/features) | ## Costs | Entry point | Import | Ceiling / fact (gzip) | | --- | --- | --- | | Standard | `@unifin/chart-react/standard` (originally `/light`) | 14 / 13.32 KB | | Pro | `@unifin/chart-react/pro` | 500 / 77.11 KB | | Root | `@unifin/chart-react` | 14 / 13.38 KB | | Core | `@unifin/chart-core` | 148 / 147.24 KB | A price chart with indicators needs Standard only; a trading desk adds Pro on the same engine. Package map and rules: Editions (/docs/editions). ## When another library may fit better - Simple business dashboards with bar and line charts - a general-purpose library is lighter. - Scientific plotting and 3D surfaces - specialized visualization stacks are a better match. - Maps and geo-analytics - out of scope for a financial chart engine. ## Where Unifin Charts is the fit - Trading terminals, broker dashboards and market widgets. - Products that need drawings, indicators, profiles and order flow in one engine. - Hosts that embed charts into existing React or plain-HTML applications with strict bundle budgets. ## See also - Editions (/docs/editions) - entry points and bundle budgets. - Documentation (/docs) - the two documentation trees. - Features (/docs/standard/features) - the capability map behind the table. - Getting started (/docs/standard/getting-started) - install and first chart. --- # API overview (Shared edition) Source: /docs/api import { LiveChart } from '@/components/live-chart'; This page covers the shape of the public API: which objects most integrations touch, what the frame object carries and where the generated reference lives. The public surface is intentionally small. Most integrations touch only `UnifinChart` (React) or `` (HTML); direct core usage drives the renderer with a frame object. Generated references: Core (/docs/api/chart-core), Indicators (/docs/api/chart-indicators), React (/docs/api/chart-react), Element (/docs/api/chart-element), Bonds kit (/docs/api/chart-kit-bonds), Portfolio kit (/docs/api/chart-kit-portfolio), Options kit (/docs/api/chart-kit-options), Swaps kit (/docs/api/chart-kit-swaps). ## Core objects (`@unifin/chart-core`) | Object | Purpose | Key members | | --- | --- | --- | | `Canvas2DRenderer` | Paints one frame | `render(context, frame)` | | `Series` | Bar storage for one symbol and timeframe | `setHistory`, `toArray`, `length` | | `TimeScale` | Horizontal mapping and visible range | `setBarCount`, `setVisibleRange`, `scrollToLastBar` | | `PriceScale` | Vertical mapping and price modes | `setHeight`, `fitContent` | | `SERIES_RENDER_TYPES` | Runtime list of the 23 series identifiers | - | ### Frame object ```ts renderer.render(context, { bars, // readonly Bar[] width, height, // canvas size in CSS pixels timeScale, priceScale, theme, // DARK_THEME | LIGHT_THEME | ORANGE_THEME | systemTheme(prefersLight) priceAxisWidth, // 0 hides the axis renderProfile, // 'sparkline' | 'mini' | 'standard' | 'terminal' seriesType, // one of SERIES_RENDER_TYPES instrument, timeframe, locale, crosshair, // optional { index, price } overlays, // optional host-computed indicator lines footprint, // optional cluster data for the footprint series }); ``` ## React (`@unifin/chart-react`) `UnifinChart` props: | Prop | Type | Notes | | --- | --- | --- | | `symbol`, `timeframe`, `bars` | required | `Bar[]` with `time`, OHLC and `volume` | | `instrument` | `Instrument` | Tick step, digits, currency | | `theme`, `locale` | theme object / `'en' \| 'ru'` | Dark theme and `'en'` are typical | | `seriesType` | `SeriesRenderType` | Defaults to candles | | `height`, `priceAxisWidth`, `showGrid` | numbers / boolean | Layout knobs | | `mode` | `'chart' \| 'mini' \| 'sparkline'` | Presentation role | | `overlays` | `LineOverlay[]` | Indicator curves and level lines | | `tooltip`, `tooltipHold` | boolean / milliseconds | Hover card and its hold window (default 5000 ms) | | `ariaLabel`, `className`, `onReady` | - | Accessibility and lifecycle | Also exported: `Sparkline`, `MiniChart`, `ChartGrid`, `createSyncGroup`, `useChart`, and the UI kit (`UiButton`, `UiInput`, `UiSelect`, `UiDialog`, `UiMenu`, `UiTooltip`, `ensureUiStyles`). ## Custom element (`@unifin/chart-element`) Attributes: `symbol`, `timeframe`, `theme` (`dark` | `light` | `corporate` | `capitalMarkets` | `orange` | `unifin` | `system`), `series-type`, `scene`, `mini`, `renko-brick`, `show-grid`, `price-axis-width`, `tick-step`, `crosshair`, `readout-mode`, `crosshair-time`, `tooltip`, `tooltip-hold` (hover-card hold in ms, default 5000). Methods: `setScene`, `replayPlay`/`replayPause`/`replaySeek`/`replayExit`, `fibonacciEnable`, `setBarSpacing`/`zoomBy`/`resetView`, `setStop`/`setTake`/`setOrderLine` (draggable trading lines with a version journal), `yForPrice`. Events: `unifin-ready`, `scene:change`, `replay:progress`, `view:change`, `crosshair-move`, `crosshair-leave`, `bar-click`, `stop:dragstart`/`stop:drag`/`stop:change`, `order:dragstart`/`order:drag`/`order:change`. Properties: `bars`, `chart` (binding), `canvasElement`. Register with `defineUnifinChart()`. ## Interactive chart The same configuration rendered on this page: > This page is a curated overview. A fully generated reference for every exported symbol follows > below; llms-full.txt (/llms-full.txt) contains the complete documentation text for > assistant-assisted lookups. ## Generated reference The four pages below are generated from the package entries themselves (TypeScript compiler API, JSDoc first paragraphs, source order). They are rebuilt on every portal build, so they always match the shipped code. | Page | Package | Contents | | --- | --- | --- | | Core (/docs/api/chart-core) | `@unifin/chart-core` | Renderer, data layer, scales, drawing, profiles, alerts, trading models | | Indicators (/docs/api/chart-indicators) | `@unifin/chart-indicators` | The 128-indicator catalogue and the study engines | | React (/docs/api/chart-react) | `@unifin/chart-react` | Components, hooks, binding, editions (`light`, `standard`, `pro`) | | Element (/docs/api/chart-element) | `@unifin/chart-element` | The `` custom element and its registration | ## See also - Getting started (/docs/standard/getting-started) - the same objects in a working example. - Series types (/docs/standard/series-types) - the identifiers behind `SERIES_RENDER_TYPES`. - Editions (/docs/editions) - which entry point exports what. --- # "Core API (@unifin/chart-core)" (Shared edition) Source: /docs/api/chart-core Generated from the package entry `packages/chart-core/src/index.ts`. Names are reachable through `@unifin/chart-core`; use your editor for full signatures - this page carries the map. ## Classes (65) | Symbol | What it does | | --- | --- | | `AlertEngine` | - | | `AlertJournal` | - | | `TimelineModel` | - | | `MarketDataAdapter` | market-data-ms adapter via the portal BFF (§4): REST pages for history, SSE for the live stream, STOMP frames for quotes and trades. Payloads are validated before they reach the series. | | `MemoryAdapter` | Deterministic in-memory feed (§4). Used by unit tests, visual fixtures and the CI mock stand; supports the same paging rules as the real adapter so tests exercise the contract, not a shortcut. | | `BarAggregator` | Builds bars from a tick stream and keeps an idempotency window so a duplicated source event cannot double the volume (NFR-RELY-03). | | `BarCache` | LRU cache of loaded series (default 12) with freshness rules: an entry is dropped when the source, its contract version or the trading day differ. The cache keeps references only - no copies of bar arrays. | | `ConnectionController` | Tracks one stream link: idle -> connecting -> live, a silent source moves the view to snapshot, a break moves it to offline and gives the retry delay back. State events are emitted only on real transitions (idempotent by design). | | `DataController` | Wires a datafeed into series, cache and storage (§3): pages are loaded backwards, a failed load keeps the history that is already on screen, and a lost connection triggers a snapshot refill from the source. | | `DatafeedError` | - | | `GapMonitor` | - | | `OrderbookModel` | - | | `TickPipeline` | Writes a tick stream into a series ( §5): one series write per bar per batch, duplicates and late ticks are counted, not applied, and the invariant applied + duplicates + late + rejected === pushed always holds. | | `MemoryStore` | In-memory storage for tests and hosts without persistence. | | `MemoryKeyValue` | Plain map behind AsyncKeyValueStore: lets IndexedDbStore run in tests. | | `IndexedDbStore` | PersistentStore over any AsyncKeyValueStore. Malformed records are treated as a miss and storage failures never escape: a broken storage must not take the chart down (NFR-RELY-04). | | `DrawingHistory` | - | | `DrawingToolRegistry` | Registry of custom tools; built-in ids are reserved. | | `SpatialGrid` | Uniform grid over drawing bounding boxes ( §3: index for hit tests). | | `GeometryCache` | Memo of the per-drawing geometry (and its mapped draw ops) keyed by the caller scale version. Lookups use nested dictionaries (scale -> id) so a steady frame never builds key strings. Objects are immutable, so a changed object is a new reference and rebuilds itself; the host bumps `scaleKey` when bars or the scale change the projected coordinates. | | `DrawingStore` | - | | `DrawingStyleLibrary` | - | | `TemplateLibrary` | - | | `InteractionController` | - | | `KineticScroller` | - | | `BarSelection` | - | | `Series` | Ordered bar series for one instrument and timeframe. Index access is O(1); time lookup is O(log n) ( §1). | | `BookHeatmap` | - | | `IncrementalReplayHeatmap` | Incremental replay heatmap: keeps the BookHeatmap and scans every snapshot once while the cursor moves forward; a backward seek or an explicit reset rebuilds from scratch, so the incremental picture always equals the full `collectReplayHeatmap` result (property test). Single forward steps touch only the new columns. | | `ProfileCache` | - | | `FootprintAccumulator` | - | | `WindowProfileCache` | - | | `ChartRenderer` | Backend controller: picks the backend once, degrades to canvas2d on context loss and guarantees the frame statistics event ( §7.3, §8). The economy flag from the performance guard is applied to every frame automatically. | | `Canvas2DRenderer` | Layer order is fixed by §4 and implemented with the scene registry. S1 paints background, grid, series and crosshair; overlays, drawings, markers, axes, interaction and ui layers arrive in later. | | `DirtyTracker` | - | | `PerformanceGuard` | - | | `TextCache` | - | | `WebGL2Backend` | WebGL2 backend. Draws the series layer only: the grid, axes, crosshair and tooltips stay on the canvas2d overlay (hybrid mode, ). Every batch is exactly one draw call with a flat uniform color. | | `ReplayEngine` | Index of the last visible bar. `index` is always clamped into `[0, length)` for non-empty histories; an empty series keeps index -1. | | `MarketReplay` | - | | `NumericAxis` | Linear numeric axis: even spacing over a finite domain. | | `CategoryAxis` | Categorical axis: one centred slot per label (strikes, sectors, months). | | `PriceScale` | Maps prices to pixels for one mode. Non-positive prices fall back to linear scaling for log mode, so broken data cannot produce Infinity ( §2). | | `TimeScale` | Index based time scale: every bar occupies an equal slot, so empty sessions never create holes in the chart ( §1). | | `Scene` | Ordered layer registry. The scene never computes geometry itself: it only owns the order, the enabled flags and the profile (invariants I-1..I-3 of ). A layer registered twice replaces the earlier one. | | `InteractionEventQueue` | Pending count of the queue (hosts may assert the throttling in tests). | | `WorkspaceLibrary` | In-memory collection of named workspaces with export/import. Names are unique and case-sensitive; saving an existing name overwrites the record and refreshes its timestamp. | | `CatalogModel` | - | | `IndicatorDefinitionError` | Thrown when a definition breaks the contract; keeps the message actionable. | | `IndicatorRegistry` | - | | `IndicatorEngine` | Runs indicator definitions over a bar history ( §2). Incremental definitions step one bar through `update`; updates of a forming bar replay from the state captured before it, so history is never rebuilt. A broken definition is isolated: its instance reports the error, others live. | | `FrameScheduler` | Cooperative frame scheduler: tasks are generators, every `runFrame` spends at most `budgetMs` and keeps the remainder for the next frame. Priorities follow the visible buffer first rule ( §2). | | `CancelledTaskError` | - | | `WorkerPool` | Round robin worker pool with a waiting queue and cancellation. Results with an unknown or cancelled id are ignored; a worker error rejects only its task and frees the worker for the next one (NFR-RELY-05). | | `BracketLayer` | - | | `BracketSeam` | - | | `TradingJournal` | - | | `TradingException` | Typed transport/business error of the trading contour ( §6). | | `OrderLineManager` | - | | `PaperBroker` | Deterministic paper broker. Orders are identified by the host-provided id; `onTick` processes working limit orders in id order, so replays are reproducible. | | `PositionTracker` | - | | `StopManager` | - | | `OrderTicket` | - | | `Pane` | One chart pane. The time scale is always pane owned; the price scale is shared when `sharePriceScale` is set (invariant I-3 of ). | | `LayoutModel` | Vertical pane stack (S1 scope). Layout is computed on demand from weights so the model carries no pixel state; separators are subtracted before the weights are applied (invariant I-1). | ## Functions (693) | Symbol | What it does | | --- | --- | | `channelsForSeverity` | Channels of the escalation policy for a severity. | | `alertChannelTitle` | - | | `planAlertActions` | Builds the action plan of an event. `channels` narrows the policy (for example, a user preference list); channels outside the platform catalogue are reported as problems and never make it into the plan. | | `changePercent` | ALT-04: percent change of the close over `period` bars. | | `volumeSpike` | ALT-05: volume spike against the average of the window WITHOUT the last bar. | | `indicatorCross` | ALT-06: fast crosses slow on the last closed bar. | | `indicatorLevel` | ALT-07: indicator crosses its level (edge, not state). | | `deliverAlertPlan` | Walks the plan in the delivery order the core built (IN_APP, PUSH, EMAIL, SMS), plays the sound once for warning and above, and skips channels the host cannot serve. Problems of the plan itself are not repeated here - they belong to `planAlertActions`. | | `drawingConditionKind` | - | | `evaluateDrawingCondition` | - | | `formulaTrigger` | - | | `validateAlertGroup` | Problems list; an empty list means the group may be evaluated. | | `evaluateAlertGroup` | AND: every condition true. OR: at least one true. An empty condition list never triggers (validation reports it separately). | | `describeAlertGroup` | Human title of the group: explicit title or the joined condition titles. | | `createAlertLine` | - | | `moveAlertLine` | Drag result: the price snaps to the step and never crosses below one step. | | `alertLineAt` | Nearest enabled line within the tolerance, or null. | | `platformMetric` | - | | `toPlatformRules` | - | | `validateAlertRule` | Problems do not throw (I-4): an empty list means the rule may be created. | | `describeCondition` | Human description for the journal and messages (user-facing; locale-aware). | | `alertConditionTitle` | Title of a condition in the requested locale ( follow-up): KZ has its own column; `uz` falls back to EN until its pack lands. | | `alertConditionMeta` | - | | `createAlertCondition` | - | | `buildAlertPanel` | Builds panel rows: triggered rules first (newest first), then by severity, then by id, so the list is stable between frames. | | `filterAlertRows` | Filters rows for the panel search box; an empty filter returns the input. | | `matchCandlePatternAt` | - | | `matchCandlePattern` | Matches the pattern at the last bar of the window. | | `renderAlertMessage` | Substitutes the known placeholders; unknown ones stay untouched. | | `computeRetryDelay` | Delay before the given attempt (1-based) or null when there is no retry: invalid attempt/policy, attempts exhausted or a non-retryable case handled by the caller. The jitter is deterministic for the same (attempt, seed). | | `isRetryable` | network and throttling are retried; business rejections are not. | | `crossedUp` | Strict edge up: previous at or below the level, current strictly above. | | `crossedDown` | Strict edge down: previous at or above the level, current strictly below. | | `priceCrossed` | - | | `priceThreshold` | - | | `rangeExitTick` | First tick leaving the range; a tick on the border is still inside. | | `rangeExitClose` | Close-based confirmation: the closed bar must end beyond a border. | | `timelinePriority` | - | | `alertTimelineEntry` | Timeline entry of an engine event (alert marker + journal link). | | `autoFibonacci` | Levels of the last impulse, lowest price first. Both ends of the impulse are covered (0 and 1), the interior ratios sit between them, so a host can read the retracement without any further maths. | | `basketMetrics` | Metrics of a basket: the count and the total weight are always there, the average and the sum only when the host can produce them. A member with a non-positive or non-finite weight drops out of the average but stays in the count, because it is still selected. | | `basketSeries` | Weighted composite of the selected series (TAB-I3): the result is aligned by time, and a time missing from one member simply does not contribute there. The weights are normalised, so a basket of two and a basket of ten are drawn on the same scale. | | `cursorBucket` | Bucket under a cursor (TAB-I8): the day by default, the week on request. The bucket of a cursor outside every row is still a bucket, and an empty bucket is a legitimate answer - «this day has no trades» is information, not an error. | | `timeFilterFromCursor` | Rows inside the bucket of the cursor. A row without a parseable time is kept out of the filter rather than silently kept in: the reader asked for one day. | | `comparisonTable` | - | | `sortComparisonRows` | Sorts table rows by a column; ties keep the label order for determinism. | | `searchDivergences` | Divergences between price and a second series. Aligned by index: the host is responsible for handing both series on the same bar grid, which is the same contract the delta divergences use. Pairs are sorted by strength, strongest first, and cut to `maxPairs`. | | `paintDivergences` | Two segments per pair - one on the price side, one on the indicator side - and a short label of the kind. Nothing is drawn for an empty list, so a host can call the painter unconditionally. | | `parseIsoDate` | Parses `YYYY-MM-DD`; null on any other shape or an impossible month or day. | | `isoDate` | Formats a date, clamping the day to the length of the month. | | `addMonths` | Shifts an ISO date by whole months; the day clamps to the end of the target month. | | `isoDayNumber` | Serial day number of an ISO date (UTC); null on a bad date. | | `yearFraction` | Year fraction between two ISO dates under ACT/365 or 30/360; NaN on a bad date. 30/360 counts whole months as thirty days, which is the convention an accrual period of a swap is usually quoted under. | | `scheduleBackward` | Dates stepped backwards from an end date (a coupon or a swap schedule is built from its final date). Returns ascending dates, an empty list on a bad input. | | `scheduleForward` | Dates stepped forwards from a start date, the first of them the start itself. This is the shape of a payment schedule: `count` periods means `count + 1` dates. | | `instrumentStats` | - | | `buildLeaderboard` | - | | `reconcile` | Compares two books. A pair the host cannot express as two finite numbers is reported as broken with a NaN difference: silence about a missing number would be the one answer a reconciliation must never give. | | `reconciliationSummary` | Totals of a comparison: how many pairs agree, how much the rest differ by. | | `reasonWaterfall` | Reasons of the breaks, summed in the order of their size: the waterfall answers "what caused the difference", which a list of rows cannot. | | `asOfVersion` | Version of a book at a date: the last row of every key that is not newer than the date. A key that only has newer rows is absent, which is what "as of" means. | | `asOfGap` | Gap between two versions: what changed, what appeared and what disappeared. The comparison uses the host's own equality, so a row object that carries a stale flag moving is a change. | | `reconciliationToText` | Report of a comparison as text: the host hands it to the clipboard, a mail or a file, so the reconciliation leaves the screen in a form a reviewer can sign off. | | `relativeStrength` | - | | `rsPanelRows` | One row per instrument, strongest first. A series that cannot be aligned with the benchmark keeps its place with null values rather than disappearing: a missing instrument is information too. | | `rsPanelSummary` | Leader and laggard of a ranked list. | | `rsRowTone` | Tone of a row for the panel: above the benchmark, below it, or unknown. | | `sessionLevels` | Levels of the session before the newest bar, for every requested period. A period with fewer than two buckets (or without a full previous bucket) is skipped - a level of a partial session would compare different things. | | `sessionLevelsMulti` | Levels of several periods at once: each period is measured on its own step, the newest bar decides which period is "current". | | `levelBreakout` | Breakout state of a level against the last price; touching is not a break. | | `levelBroken` | Whether the level has been broken, which depends on what the level means: a previous high is broken upwards (resistance gave way), a previous low downwards (support gave way), and the previous close is broken either way - it has no side of its own. A price that merely sits below the previous high has not broken it, otherwise every level would be highlighted all the time. | | `swingPoints` | Pivots of the series, alternating between highs and lows: two pivots of the same kind in a row collapse to the more extreme one, so an impulse always has a high and a low end. | | `lastImpulse` | Last pair of swings whose span reaches the ATR share. Pairs are walked from the newest one backwards, so a tiny final wobble does not hide the impulse the market is actually trading. | | `flattenTree` | Flattens the tree into the lines a reader sees: a row is followed by its children when it is expanded, and by their children in turn. Keys are visited once, so a cycle in a malformed tree cannot hang the host. | | `groupTotals` | Totals of a group (TAB-A2): the nominal of a book is a sum, the average yield is weighted by nominal, and the DV01 is a sum. The model does not guess - a column without an aggregate simply shows nothing in a group line. | | `sumAggregate` | Sum that ignores non-finite members and keeps an all-empty group empty. | | `weightedAverageAggregate` | Weighted average: `weight` is usually the nominal, the price or the quantity. | | `countAggregate` | Count of non-empty values of a column. | | `tableToText` | - | | `serializeTableView` | Serialises a view with a stable key order: the same view always produces the same text, which is what makes a link comparable and a diff readable. | | `parseTableView` | Reads a saved view; `null` on a broken payload, on a foreign kind or on a version the build does not know. Unknown fields are dropped rather than carried around. | | `applyTableViewColumns` | Applies the column order of a view to the columns a board has today. The order of the view wins for the columns it names, a column the board no longer has is dropped and a new column is appended in its own order - so an old view never hides data. | | `readFigureValues` | Samples of a figure for one row, or `null` when there is nothing to draw. Non-finite numbers are dropped (a gap in the data is not a zero), an empty series and a non-finite scalar both mean "nothing to draw", and a structured payload is passed through when it has at least one sample. | | `formatTableCell` | Cell formatter of the model: percent values arrive as decimal fractions, `bp` values as basis points, `money` as an amount in `column.currency`, `tenor` as months. Without a locale the model stays deterministic: grouping is a plain thousands separator, the currency code is printed as given. | | `sortTableRows` | Stable sort by one or more columns: `null` values always land last regardless of the direction, equal keys keep the input order. Keys are applied in order, so `[{id, 'desc'}, {tenor, 'asc'}]` sorts by yield and breaks ties by tenor. | | `tableHistogram` | Distribution of a column: the host draws it in the header and brushes it for a range filter. `null` returns for an empty, single-valued or non-finite column, so the header simply shows no histogram. | | `filterTableRows` | Case-insensitive substring filter across the formatted cells of the row. | | `tableExtent` | Min/max of a numeric column over the rows; `null` when nothing is finite. | | `heatTone` | Thirds of the extent: top third is `up`, bottom third is `down`. | | `nextTableSort` | Header click cycle: a new key starts ascending, the same key flips. | | `parseInstrument` | - | | `parseBarsPage` | - | | `parseBar` | - | | `parseTick` | - | | `parseMark` | - | | `adjustBars` | Returns adjusted copies of the bars for the chosen mode. Bars at or after an action keep their values; earlier bars receive every action that lies after them (splits multiplicatively, dividends additively, clamped at zero). | | `resample` | Rebuilds bars into a bigger timeframe without re-reading history. open = first, close = last, high/low = extremes, volume/trades = sums. | | `seriesCacheKey` | - | | `loadComparisonFromFeed` | Loads bars for up to ten instruments in parallel and builds the comparison table. The benchmark option is passed through unchanged; bars come back so the host can draw the series without a second round trip. | | `backoffDelay` | Exponential backoff with jitter: 1 s, 2 s, 4 s... capped at 30 s, each delay varies by +-20% so reconnects do not synchronise ( §6). | | `datafeedErrorKindForStatus` | - | | `toDatafeedError` | Maps HTTP statuses and arbitrary failures into one typed error. | | `sanitizeMessage` | Strips credentials and truncates: safe for UI and telemetry. | | `buildEventLane` | - | | `clusterEventMarkers` | Groups markers whose centres sit closer than `minGapPx`: a report season lands dozens of events on a few bars and the lane must show a number instead of a smear. Lone markers keep `count` 1; the order of the lane is preserved. | | `csvCell` | Quotes a CSV cell when it contains the separator, a quote or a newline. | | `barsToCsv` | Serializes bars to CSV with the fixed column order `time,open,high,low,close,volume[,trades]`. The output ends with a newline. | | `barsCsvFilename` | File name of the export, safe for every platform: `AAPL-10m-bars.csv`. | | `resolveLoadState` | Empty data is not an error: a closed trading day must show the empty state while a failed source shows the error state (invariant I-4 of ). | | `heikinAshi` | Heikin-Ashi transformation (AUD-006, §5): display bars computed from the source bars. The same honesty policy as the non-standard types applies: time, volume and the closed flag survive, so cursors, alerts, tooltips and profiles keep working off the original bar identity. | | `mapLegacyBar` | Default mapper of the typical `{time, open, high, low, close, volume}` bar. | | `legacyDatafeedAdapter` | - | | `renkoBars` | Renko bricks (type 10): fixed-size bricks driven by the close. | | `kagiBars` | Kagi segments (type 11): a segment extends with the close until the price retreats by the reversal amount; the closed segment is emitted as one bar. | | `pointAndFigureBars` | Point & Figure columns (type 12): X columns extend on highs, O columns on lows; a counter move of `reversal` boxes starts a new column. Each column is emitted as one bar (X: close above open, O: close below open). | | `rangeBars` | Range bars (type 13): a bar completes as soon as its high-low span reaches the range; intrabar order follows the bar direction heuristic (the extreme matching the bar direction is touched first). | | `lineBreakBars` | Line break (type 14): a new line appears when the close breaks the extreme of the last N lines (default 3); the line keeps the previous close as its open, so the chart reads as a staircase of closes. | | `parseOrderbook` | Parses a transport payload (direct snapshot or `{ data:... }` envelope). Bids/asks must both be present; malformed payloads raise a DatafeedError so hosts can surface the failure instead of rendering an empty ladder. | | `packBars` | Packs bars into typed arrays; output is transferable (no closures). | | `visibleWindow` | Inclusive-exclusive index window of the visible bars with a margin, clamped to the data. Empty data gives an empty window. | | `barAt` | Reads one bar back from a pack (used by tooltips and hit tests). | | `averageRange` | Mean of `high - low` over the last `period` finite bars; 0 without data. | | `roundPriceStep` | Snaps a value to 1/2/2.5/5/10 of its own order of magnitude. | | `pAndFAutoParameters` | Box and reversal for a series: the host ATR wins, the average range stands in for it, and both a zero volatility and an empty history still give a usable box instead of throwing. | | `pointAndFigureAuto` | Point-and-figure bars with the auto parameters applied. | | `baseTimeframeFor` | Smallest timeframe that is cheap to load and honest to aggregate from ( §3). A base is never bigger than the requested timeframe and never below one second. | | `detectGapsDetailed` | Reports holes between bars without inventing anything: only buckets that belong to a session are counted, so weekends and breaks produce no gaps. Input bars are expected in ascending time order (feed contract). | | `detectGaps` | Aggregated report of the holes; delegates to `detectGapsDetailed` so both surfaces always agree. | | `tradeDayStart` | Start of the trading day that contains the moment: the day resets at the first session open, so night hours still belong to the previous trade day (daily aggregates and the day cache key both use this value). | | `parseStompFrames` | - | | `encodeStompFrame` | - | | `openStompSubscription` | Opens one STOMP subscription with reconnects. `CONNECT` carries the accept version plus the host headers (JWT on reconnect included); `SUBSCRIBE` goes out with the configurable destination. A socket close schedules the next attempt with exponential backoff and jitter; `dispose` stops everything. | | `eligibleAlerts` | Reads the alert condition from the object meta. A missing, foreign or unsupported condition yields an empty list instead of an exception. | | `evaluateObjectAlerts` | Evaluates the object alert from `from` (default 0) up to the end of the bars. Edge triggered: one event per crossing, repeated bars stay silent. | | `moveDrawing` | A copy of the drawing with every point shifted by the delta (pure helper for hosts that keep drawings outside the history, e.g. live drag previews and the commit of a move). The id, style and flags are preserved. | | `defineDrawingTool` | Validates a descriptor and returns a normalized copy; junk throws RangeError. | | `withCustomTools` | Adapters that run custom tools through the standard pipelines. Built-in ids fall through to the core implementations untouched. | | `fillPattern` | Registry lookup; an unknown id falls back to the flat fill, never throws. | | `fillShapeBounds` | Bounding box of a shape; null when the shape cannot be shown. | | `fillPatternGeometry` | Geometry of a pattern over integer bounds, memoised by pattern id and the rounded box: one tile set per pattern, colour and frame (the colour travels through `paintFillPattern`, the geometry does not depend on it). | | `resetFillPatternCache` | Test hook: clears the tile-set memo. | | `paintFillPattern` | Paints one pattern fill of one shape: clips to the shape and issues the tile geometry of the pattern. Degradations: a context without clipping or without `arc` (dots) paints the flat alpha fill; `none` paints nothing; invalid geometry paints nothing. Returns the issued primitive count and whether the fallback was used, so a caller can keep an honest counter. | | `measureSummary` | Delta price/percent/bars/time of a measuring tool (values may be NaN). | | `screenPoints` | Screen anchors of a drawing for custom tool builders; null when unplaceable. | | `buildGeometry` | Turns a drawing into renderer and hit test primitives. Hidden objects and objects without a place on screen yield an empty list. | | `primitiveBox` | - | | `primitiveDistance` | Distance from a point to a primitive; Infinity when clearly outside. | | `hitTestAll` | All hits within the tolerance, best first (markers, then top layers). | | `hitTest` | - | | `selectByBox` | Unique drawing ids whose bounding box intersects the selection frame. | | `buildJournal` | Rows of the journal in the drawing order of the store (z, then insertion). The list is derived: nothing is copied into the caller state. | | `focusViewport` | Frame that contains every visible primitive of the given drawings with a margin of at least 16 px; null when nothing can be shown. | | `groupCommand` | Turns a journal group action into the regular atomic command. | | `styleDrawingsOfTool` | Command of "apply to all of this type": the style patch goes to every drawing of one tool id, other types are never touched. Null when the type has no drawings, so a host can skip the journal step. | | `collectCandidates` | Candlestick fields of one bar plus the object anchors passed by the host. | | `applyMagnet` | - | | `atTimePrice` | - | | `atBarPrice` | - | | `atPrice` | - | | `atTime` | - | | `defaultDrawingStyle` | - | | `normalizeStyle` | Normalizes any payload into a full style; unknown fields are ignored. | | `validateDrawing` | Tolerant validator: damaged payloads turn into issues, never into throws. | | `createDrawing` | Programmer-facing factory: invalid anchors are a contract bug, not data. | | `addMeasurePoint` | Adds a point; the caller is told when the set is full instead of losing one. | | `removeMeasurePoint` | - | | `clearMeasurePoints` | - | | `measureSpans` | Differences of every neighbouring pair, in the order the points were added. | | `spreadOf` | Difference between two chosen points: the "level spread" of a terminal ruler. | | `drawingGroups` | Builds the palette tree from the catalogue in its source order: the panel cannot drift from `DRAWING_TOOLS`, and a tool without metadata is skipped here but reported by `paletteMissingTools` (the completeness test fails). | | `drawingPaletteTool` | Palette row of one catalogue tool, or null for an unknown id. | | `paletteMissingTools` | Catalogue tools without palette metadata; empty list is the norm. | | `paletteUnknownTools` | Metadata entries that no longer match the catalogue; empty list is the norm. | | `paletteHotkeyConflicts` | Duplicate hotkeys inside the palette; empty list is the norm. | | `paletteToolByHotkey` | Palette row of a hotkey combo, case-insensitive (`T`, `Shift+R`, `Alt+1`). | | `paletteSearch` | Palette rows matching a search query (title, tool id or catalogue code, case-insensitive); an empty query returns the whole tree in render order, and an unmatched query returns an empty list - the panel never invents a row. | | `palettePickTool` | Picks a tool (null exits the mode); a pick moves the tool to the head of `recent`. | | `paletteToggleFavorite` | Adds or removes a favorite; unknown ids are ignored. | | `paletteSetLocked` | Sets the lock flag (the host store owns the effect of the lock). | | `paletteSetHidden` | Sets the "hide markup" flag; the transition never removes anything, the drawings stay in the store and the host only skips their painting. | | `paletteStateJson` | Snapshot text of the toolbar state (field order stays stable for diffs). | | `parsePaletteState` | Tolerant reader of `paletteStateJson`: junk, unknown ids and extra fields are ignored. | | `buildLayerOps` | Builds the draw ops of the layer. Drawings are consumed in the given order (the store lists them by z), so the result is deterministic for equal input. | | `collectDirtyBoxes` | Dirty boxes between two geometry states of an edit: every changed, added or removed primitive contributes its old and new box (deduplicated). | | `barIndexAtTime` | Last index whose bar opens at or before `time`; null when history is empty. | | `resolveAnchor` | - | | `resolveDrawing` | - | | `serializeDrawings` | - | | `parseDrawings` | - | | `serializeTemplate` | - | | `parseTemplate` | - | | `encodeSharePayload` | - | | `decodeSharePayload` | - | | `styleTemplate` | Builds a template with the style normalised through the model rules. | | `loadStarterStyleTemplates` | Loads the starter sets idempotently (a second call changes nothing). | | `styleLibraryJson` | Versioned JSON envelope with a stable field order (human diffs stay small). | | `importStyleLibrary` | Tolerant reader of `styleLibraryJson`: junk, broken rows and unknown fields are ignored, an unknown fill pattern falls back through the style rules, the version field never throws. Returns the number of stored templates. | | `templatePaletteCommands` | - | | `templateIdFromCommand` | Template id of a palette command; null for every other command. | | `drawingTool` | - | | `drawingFor` | Builds a drawing against the tool contract (anchors, style, meta). | | `togglePinnedTooltip` | Toggles the pin. Same object -> null (unpin); another object -> replace; an empty (blank) id keeps the current state untouched. | | `isTooltipPinned` | True when the tooltip of exactly this object is pinned. | | `clearPinnedTooltip` | Escape path: clears the pin and always returns null. Named so hosts do not re-implement the rule; a missing pin stays a no-op. | | `syncPinnedTooltip` | Drops the pin when its object no longer exists (removed, filtered out). Hosts call it once per frame with the current drawing ids. | | `buildDrawingTree` | Groups drawings by catalogue category; empty categories are dropped. | | `filterDrawingTree` | Filters the tree by a search query (id, tool id, title or object text); groups that lose all rows are removed, so the panel never shows empty sections. | | `drawingTreeStats` | Panel counters shown in the tree header: total, hidden and locked. | | `eventMarkers` | - | | `filterEvents` | - | | `eventHitTest` | Nearest marker under the pointer, or null. The caller maps a marker index to pixels (the time scale is host-owned). | | `contextMenuItems` | - | | `resolveFollow` | Right edge of the series and how far the view is from it. `visibleFrom` is only returned when the view must move, so a host can call this on every data update without fighting the user. | | `windowAtLastBar` | The window that puts the newest bar on the right edge. | | `panReleasedFollow` | A pan is never silent about following: moving the view by hand releases the mode, and only an explicit `resume` (a click on the lag chip) brings it back. | | `resumeFollow` | Click on the "lagging" chip: back to the last bar and follow again. | | `elasticOffset` | Compressed shift of the elastic edge: the further out, the less it moves. | | `resolveElasticPan` | Clamp a pan to the history and answer with the elastic shift: the view keeps moving, but slower than the finger, and `releaseElastic` walks the remainder back to zero. | | `releaseElastic` | One step of the spring return; the host repeats it per frame while it moves. | | `resolveGestureIntent` | Shift zooms the price axis, Alt or the right button draws the marquee. | | `normalizeWheelDelta` | Normalizes a wheel delta to pixels: DOM_DELTA_PIXEL (0) passes through, DOM_DELTA_LINE (1) counts 16 px per line, DOM_DELTA_PAGE (2) - 100 px. | | `longPressFires` | - | | `atRightEdge` | True when the newest bars are in view, so the chart follows new data (invariant I-4). The right edge of the time scale keeps empty slots, the same offset the clamp uses internally. | | `applyWheel` | - | | `applyDrag` | Drag right reveals earlier bars; drag left moves back to the newest ones. | | `applyResetView` | Double click / explicit view reset ( §6): back to the newest bars and auto scroll. The price autofit stays with the host: it calls `priceScale.fitContent(bars, from, to)` for the visible range afterwards. | | `applyKey` | - | | `applyGesture` | - | | `applyPriceScaleDrag` | Dragging the price scale: the span stretches or squeezes around the anchor edge (the bottom one by default), so the opposite edge follows the gesture. | | `applyVerticalZoom` | Vertical zoom of the wheel (Shift+wheel): the span scales around the middle of the window; a negative delta (wheel up) shrinks the span - zoom in. | | `marqueeTooSmall` | - | | `applyMarquee` | Applies the marquee as the new visible window; the selection is clamped to the plot area, a sub-threshold selection or a degenerate window returns null (the host keeps the view - a click, not a zoom). | | `resolveNavDirection` | Direction of a key press, or null when the key is not a navigation key. | | `navOrder` | Navigable items in the order the user sees: by layer/tree order, then id. | | `nextObject` | Next focus target. Walking wraps around, so Tab never dead-ends; `first` and `last` jump to the edges. An empty (or fully hidden) list keeps the caller where it is, and a stale `currentId` starts from the first item. | | `navAnnouncement` | Announcement text for the active object: what it is and where it sits. | | `proShortcutTitle` | Title of a shortcut in the requested locale; `uz` falls back to EN. | | `proKeymapConflicts` | Duplicate combos inside the PRO layer; empty list is the norm. | | `proShortcut` | - | | `resolveProCommand` | Resolves a key event into a PRO command. Letters match either case (`b` and `B` both mean buy - the host suppresses the keymap while a text field has focus), modified combos accept either case of the letter (Ctrl+K and Ctrl+k are the same key press on most layouts). | | `limitOrderFromScale` | Quick limit order from a price-scale click: LIMIT is the only type the click can mean (the catalogue stays untouched), the price is snapped to the instrument digits and the draft passes the same validation as the ticket. | | `commandForKey` | - | | `minimapLayout` | One column per pixel at most: stride grows for long histories. | | `minimapColumns` | Per-column price extent and first/last close for the density stroke. | | `minimapWindow` | Pixel rectangle of the viewport window; indexes are clamped into the range. | | `minimapScrub` | Drag/click scrub: the window centre follows `x`; the result is a from index. | | `buildReadout` | Builds the readout of one bar; null for a missing or broken bar (the shell then hides the strip). The change base is `options.previousClose`, then the `instrument.previousClose` of the data contract, then the previous bar. | | `readoutChanged` | True when the two models differ in anything the strip shows. | | `barSnapTargets` | Targets of one bar for a snap mode; a bar without numbers yields nothing. | | `priceSnapTargets` | Targets of a list of prices: levels, lines, edges and round prices differ only by kind. | | `resolveSnap` | Nearest target inside the pull radius, or null. `off` never snaps, a zero tolerance only accepts an exact hit, and the tie-break uses `SNAP_PRIORITY` before the order of the list. | | `nearestBarTargets` | Targets of the bar nearest to a time, using the host clock of the series. | | `normalizeTooltipHold` | Normalises a host value into a usable hold window in milliseconds. Absent, non-finite and negative values fall back to `TOOLTIP_HOLD_MS`; the result is capped at `TOOLTIP_HOLD_MAX_MS`. `0` is honoured as "hide immediately". | | `hoverHoldExpired` | Whether a card that was left at `leftAtMs` may be released at `nowMs`. Timestamps are host clock readings; a clock that moved backwards keeps the card (never release on a negative elapsed value). | | `linkSelection` | Joins the window to the group and delivers the current snapshot (selection and live drawings) to the late joiner. Returns an idempotent unsubscribe. | | `unlinkSelection` | Leaves the group; works for both channels (one membership per window). | | `broadcastSelection` | Broadcasts the selected object id to the other windows. Repeated identical broadcasts from one source are suppressed inside `echoWindowMs` (0 disables the guard). Returns the number of deliveries. | | `broadcastDrawing` | Broadcasts a drawing edit. Revisions order the edits: an upsert older than the stored revision is dropped, an equal upsert is a duplicate, a remove clears the entry (ties of remove beat an upsert) and also clears the shared selection when it pointed at the removed object. | | `selectionGroupSize` | Windows currently in the group. | | `currentSelection` | Current shared selection (snapshot for hosts and tests). | | `linkedDrawingRevision` | Stored revision of an object, or null when the group never saw it. | | `disposeLinkGroup` | Drops every member and the stored state of the group. | | `auctionPhaseAt` | Phase of the moment; weekends never hold an auction. | | `auctionBands` | Bands of the auction windows intersecting `[from, to)` - the shape the session bands of RenderInput already accept. Band times stay unclipped, so cues keep the real auction start; the renderer clips to the viewport. | | `auctionCues` | Cues for the host: one per band whose real start falls inside `[from, to)`. Sound stays host-side: route cues into the delivery or a custom policy. | | `timeframeToMs` | Duration of a timeframe in milliseconds. Calendar timeframes (1M) return null: their length varies per month. | | `bucketStart` | Start of the bucket that contains the given time. Weeks start on Monday (UTC), months start on the first day of the month. | | `minutesInRange` | Local-minutes membership in a session range; exported for auction windows. | | `localMinutes` | Local minutes since midnight of the exchange clock. | | `localWeekday` | Local weekday of the exchange clock (0 - Sunday). | | `sessionDayStart` | Start (UTC ms) of the local day containing the moment. | | `sessionPhaseAt` | RTH beats ETH beats CLOSED; weekends close everything. | | `isCalendarOpen` | - | | `sessionBreakMarkers` | Moments where the phase changes between consecutive samples - the breaks the chart draws as boundaries. The first sample never opens a break. | | `formatPriceDigits` | Price with the instrument precision. Non-finite input renders as a dash. | | `formatVolume` | Compact volume: 12 400 -> 12,4K, 3 100 000 -> 3,1M. | | `formatCompactVolume` | Compact volume for chart furniture (axis labels, volume tag, readout): 1.2K / 3.4M / 1.1B, plain digits below a thousand. Locale-neutral on purpose: the point separator is a dot and there is no grouping, so a narrow axis never grows a label that does not fit. | | `formatPercent` | Signed percentage, always with an explicit sign for growth. | | `formatTimeLabel` | Axis label for the given timeframe: intraday shows time, higher frames show dates. | | `formatDateTime` | Full date and time for tooltips and journals. | | `usEasternOffsetMinutes` | US Eastern offset for the moment: -240 during DST, -300 otherwise. | | `isUsEasternDst` | True when the moment falls in the US DST window (exposed for tests). | | `minutesOfDay` | Minutes from midnight, UTC. | | `isWeekend` | - | | `isInSession` | True when the moment belongs to a trading session (no session spec means always open). | | `dayStart` | Start of the UTC day that contains the moment. | | `sessionMinutesBetween` | Trading minutes inside the interval [from, to); weekends and breaks are excluded. | | `sessionGapMs` | Milliseconds inside the interval that belong to no session (weekend included). | | `nextSessionOpen` | First moment at or after `time` that belongs to a session. Scans forward day by day; a spec without ranges means the market is always open. | | `percentile` | Linear-interpolated percentile of unsorted finite values; null when none. | | `anomalyThresholds` | Thresholds of the large tail of a tape. Size and money are separate because a cheap instrument prints many shares and an expensive one prints few: the host filters by whichever it means. | | `filterTapeRows` | Applies the filters together and keeps the incoming order of the tape. | | `bookWallEvents` | Walls over time: a level that appears with a dominant size, then either loses its size (pulled) or trades through it (absorbed). The difference matters to a trader - a pulled wall was never real. | | `auctionGrid` | Cells to a price-by-time matrix. Rows run from the highest price down (row 0 paints at the top), columns are the sorted time buckets, and a cell keeps the summed TPO of its price level. A non-positive `step` is derived from the price range, so a profile without a configured tick still paints. | | `buildBarProfile` | Ladder of one bar from its prints; null when there is nothing to bucket. | | `nearestProfileLevel` | Centre price of the profile level nearest to a print ( follow-up "linking a large print to its footprint cell"): the tape and the ladder speak the same grid, so the clicked print maps onto the row to highlight. Null for an empty profile or a non-finite price. | | `runningVwap` | Running VWAP line over bars on the typical price (h+l+c)/3, weighted by bar volume. `window` limits the average to the last N bars (session VWAP when the caller feeds one session); bars without volume change nothing. | | `cumulativeDelta` | Running sum of deltas. Rows with a non-finite time or price are skipped; a non-finite delta counts as zero. `carry` continues the sum across days (session boundary stitching is a host decision). | | `deltaExtremes` | - | | `deltaDivergences` | Classic swing divergences: - bearish: a swing high prints a higher price than the previous swing high, while the cumulative delta prints a lower value; - bullish: a swing low prints a lower price than the previous swing low, while the cumulative delta prints a higher value. Swing points are deterministic local extremes with `swing` points on each side (strict on the left, non-strict on the right). | | `buildLadder` | Merges the two sides of the book into a classic price ladder (descending price), carrying cumulative depth per side. Missing prices on one side stay zero so the host can render a single grid. | | `tapeRows` | Newest-first tape window with a buy/sell split. Ticks without a `side` are counted as `unknown` and do not skew the delta. | | `classifyLargePrints` | Classifies tape prints: a print is large when it reaches any configured threshold. Without options nothing is marked (the report still carries the totals), so the host can flip the policy without rebuilding data. | | `aggregatePrintBuckets` | Aggregates prints into price buckets of the shared profile grid - the bridge to footprint cells: pass the grid used by the bar profile and the rows land on the same bands. | | `tapeWindows` | Folds the tape into `count` windows of `windowMs`, aligned to multiples of `windowMs` on the event clock, so two calls over the same tape agree. Ticks are sorted internally; non-finite times (and non-finite volumes, which count as zero) are handled without throwing. Windows without trades still appear, because the gap itself is the reading. | | `collectReplayHeatmap` | Collects the depth history of a replay up to `replay.time`: only snapshots whose time is already applied reach the heatmap, so the picture follows the cursor on seeks in both directions (the heatmap is rebuilt, not patched). | | `sliceHeatmap` | Time window slice of an intensity grid; intensities are re-normalised. | | `liquidityRibbonGrid` | Samples to a one-row grid (row 0 sits at the top). A non-finite imbalance or a side with no depth leaves the cell out: the painter reads a non-finite value as "nothing to tint", so an empty book shows the price axis only. | | `decimateRange` | Collapses `[from..to]` into at most `columns` buckets: open - first bar, close - last bar, high/low - extremes, volume - sum. Column boundaries are even, so the widest column differs from the narrowest by one bar at most. | | `decimateBars` | Whole packed history decimated to `columns`. | | `tileRanges` | Even tile plan over a bar count; the last tile takes the remainder. | | `visibleTiles` | Tiles intersecting the visible range `[from..to]` (inclusive). | | `smaAbiLayout` | - | | `writeSmaBuffer` | Writes the layout (header, input, zeroed output) into a buffer. | | `pilotSma` | Streaming kernel: one pass with a rolling sum, NaN until the window is full. This is the shape the WASM module will implement - same order of additions, so parity is exact. | | `referenceSma` | Naive reference: recomputes each window from scratch. | | `smaParity` | Comparison of the two kernels. The default is exact equality (NaN positions must match too); decimal pipelines that legitimately drift in the last ulp pass an explicit `epsilon`. | | `validateWasmExports` | Problems of a host-supplied module; empty list means the ABI is honoured. | | `registerPanePrimitive` | Registers a pane painter and returns its idempotent `dispose`. | | `clearPanePrimitives` | Test and host hook: drops every registration. | | `panePrimitiveNames` | - | | `hasPanePrimitives` | - | | `paintPanePrimitives` | Paints the registered primitives of one phase and returns how many of them succeeded. Empty viewports (`visibleFrom >= visibleTo`) and throwing painters are skipped; the other primitives still paint. | | `windowBars` | Bars of the window, inclusive on both ends; without a window - all bars. | | `sessionProfile` | - | | `compositeProfile` | Composite of several session windows: one profile over the concatenation. | | `compareProfiles` | - | | `resolveTick` | - | | `buildProfileGrid` | Grid of levels covering [min..max] with a tick-aligned step. | | `gridBand` | - | | `gridIndex` | Band index of a price, clamped into the grid. | | `gridMid` | - | | `resolveValueArea` | Value area percentage, clamped to 50..95 (canon 78). | | `updateProfileBar` | - | | `profileLevels` | - | | `buildWindowProfile` | Profile of an explicit window of bars; null when the window is empty or broken. | | `valueAreaHistory` | One row per session profile, oldest first, cut to the history limit. | | `compositeSessionProfile` | Composite of the sessions plus their value area history. `sessions` are bar arrays in time order, the same shape `compositeProfile` takes; the session time is the first bar of each session. | | `sessionSlices` | Splits bars into local trading days (bars keep their order). | | `sessionProfiles` | - | | `sessionCompositeProfile` | Composite profile over the last `sessions` session entries (all without the option): the existing window composite builds one profile over the concatenated bars, so the value area covers the union of the ranges. | | `sessionSeparators` | Times where the local session day changes; the first bar never separates. | | `tpoLetter` | Letter of the bar by its index in the window: A..Z, a..z, then the cycle. | | `buildTpoProfile` | - | | `buildVolumeProfile` | - | | `adaptiveDetailMode` | Mode for a bar density. A density that cannot be trusted (zero, negative, `NaN`) keeps the candles: a missing value must not hide information. An infinite density is the densest case, so it reads as a line. | | `quantiles` | Quartile summary of a sample; null for fewer than two finite values (a single point has no spread to describe). | | `paintBoxPlot` | Paints boxes left-to-right; returns the number of boxes drawn. | | `bulletScale` | Upper bound of the scale: the largest finite band, value or target. | | `bulletRanges` | Sorted, finite band boundaries; an empty input falls back to the scale. | | `paintBullet` | Paints the bands top-down, then the value marker (solid) and the target tick (dashed). Returns the number of painted primitives. | | `paintFanChart` | Paints the bands (widest first) and the median on top. Returns the number of painted series (bands plus the median when it has a segment). | | `frontierCurve` | Upper convex hull of the candidates, sorted by risk: at every risk level only the highest return survives, and a candidate is dropped when it sits on or below the segment of its two kept neighbours. The chain is concave - every extra unit of risk buys fewer points of return than the previous one - which is the classic efficient frontier. Returns `[]` below two usable points. | | `paintEfficientFrontier` | Draws the frontier curve, the candidate dots and the current portfolio. The caller owns the axis and the domains; `style.color` tints the curve and the current marker. | | `buildAnalyticReadout` | One readout row per series at the cursor `x`; `null` when no series has samples. The pixels are plot-local (add the plot offset in the host). | | `pickAnalyticPoint` | Nearest sample across series inside the tolerance; ties fall to the lower pixel distance and then to the earlier series. `null` when everything is farther than `tolerancePx` (a click on empty space). | | `clampAnalyticWindow` | Orders the window, clamps it inside `full` and enforces the minimum span. | | `zoomAnalyticWindow` | Zooms about the anchor under the cursor: `factor > 1` zooms in, `share` (0..1) is the anchor position inside the current window. | | `panAnalyticWindow` | Pans by a share of the current span; the full domain clamps the result. | | `paintPaceOfTape` | - | | `paintAnalyticCurve` | Curve: a single polyline over the accepted samples. Returns the number of plotted points; fewer than two accepted samples paint nothing. | | `paintAnalyticBand` | Band: a filled ribbon between an upper and a lower boundary (zones around a payoff, confidence envelopes). Returns the number of paired samples; fewer than two painted pairs draw nothing. | | `paintAnalyticPoints` | Points: a dot per accepted sample. Returns the number of dots. | | `paintAnalyticMarkers` | Markers: dots with a text label to the right. The label is skipped when it would not fit into the plot (the dot stays). Returns the number of dots. | | `paintAnalyticBars` | Bars: vertical columns from the baseline to the sample, up/down colored by the sign against the baseline. Returns the number of bars (zero-height bars are skipped). | | `nearestAnalyticPoint` | Nearest sample to a domain value; the distance is measured in pixels through the axis. The samples must be sorted by `x` (the contract of every provider); ties fall to the lower index. | | `withAlpha` | `#rgb`/`#rrggbb` theme color to `rgba` with the given alpha (clamped to 0..1). Non-hex forms (host tokens like `var(...)`) pass through unchanged. | | `yOf` | Y value to pixel; a flat domain maps every value to the vertical center. | | `waterfallSpans` | Running bases of the bridge: `start` columns grow from zero, `delta` columns from the running total, `total` columns span the whole accumulated value. Non-finite steps are dropped, so the sum of the returned spans always closes. | | `paintWaterfall` | Paints the bridge columns; returns the number of columns drawn. | | `selectAxisLabels` | Drops every candidate that would touch an already kept one. The first candidate wins its place, later ones yield - so a dense axis thins out from the left/top edge instead of piling up on the newest bars. | | `timeLabelStep` | Bars between two time labels: wide enough for the measured text plus the gap, and never denser than `MAX_TIME_LABELS` labels per window. | | `priceLabelCount` | Value labels asked for from a pane height: tick count follows the height. | | `fitTextSize` | Font size that fits `text` into `maxWidth`. `null` means the fitted text would be smaller than `minSize` and is not painted at all (a watermark must not become an unreadable smear in a small window). | | `valueAxisLabelPlacement` | - | | `volumeDepthShare` | Volume of the bar against the reference volume, clamped to 0..1. A non-positive or non-finite reference means "no scale available" and gives 0, so a missing average never brightens a body. | | `bodyDepthAlpha` | Shade alpha of a depth share: linear between the two canonical stops. | | `paintBodyDepth` | Paints the inner shade of one body. A tall body takes two flat fills - a light shade over the whole body and a heavier foot; a short one takes a single fill, because the second fill is invisible there and the dense-history measurement charges for it. Returns false when there is nothing to paint (share zero, box degenerate), so callers can count real work. | | `vapRows` | VAP rows of one bar: the cluster cells of that bar, largest level first through the cap, returned in price order. Cells of other bars, non-finite prices and non-positive volumes are skipped; rows are clipped to the body box, so a level outside the body never draws outside it. | | `paintVapInBody` | Paints the rows from the left edge of the body: the width follows the share, so the profile of the bar reads at a glance. Returns the painted row count. | | `morphProgress` | Progress of a fold over `elapsedMs`, eased out: fast start, soft landing. | | `morphDurationMs` | Duration under the motion policy: zero when the host asked for reduced motion, so the fold is skipped entirely instead of being played silently. | | `morphBars` | Bars of the fold at `progress`. The result is `next` itself at a completed fold and an empty array without a next series; a bar whose previous value is unknown keeps its own values (no invented history). | | `rebaseToBaseline` | Rebases one series to the baseline at its first finite point. That first point has to be non-zero: a series whose first value is zero has no base at all, and silently starting from a later point would compare different moments. | | `paintCompareOverlay` | Polyline per series plus the label of its last visible point. Every series is normalized to `overlay.baseline` (100 by default) on its first visible point, so the curves compare from the same moment whatever the host handed over. More than `COMPARE_OVERLAY_LIMIT` series are cut deterministically - the first ones win, the caller can report the cut. A series whose first visible value is zero or missing has no base to compare from and is skipped. | | `resolveCrosshair` | Bar under the crosshair. The index sticks to the nearest bar and is clamped to the data (invariant I-1: the returned bar is the data itself, no rounding); a hidden crosshair or an empty series yields no bar. | | `stickyBarIndex` | Integer bar index under a pixel; -1 when there is no data. | | `tooltipRows` | Value rows of the tooltip window. Order is stable for tests and hosts: time, open, high, low, close, volume, change in percent. | | `crosshairLabels` | Flat labels for hosts that render a single line: `O 815.40` and friends. | | `clampAxisLabel` | Keeps an axis label inside the axis area (invariant I-2). | | `tooltipHeading` | Heading of the hover card: ticker, timeframe and exchange. | | `tooltipRowTone` | Tone of one tooltip row: the close and the change follow the bar direction. | | `tooltipBox` | Card next to the crosshair: it sits on the wider side of the cursor and flips to the other one when the plot runs out, while the caret keeps aiming at the hovered bar. Everything is clamped into the plot, so the card is never painted over the price axis or out of the frame. | | `barUpdateFlash` | Last-bar update highlight over `progress` of `DATA_FLASH_MS`: quadratic fade from `BAR_FLASH_PEAK` to zero; outside 0..1 - zero. | | `alertFlash` | Alert row flash over `progress`: same decay, louder peak and its own tone. | | `cellPulse` | Ladder cell pulse: null when the value did not change (the cell must not blink), otherwise the tone of the change and its normalised intensity. Equal magnitudes relative to the larger side map to the same intensity. | | `motionAlpha` | Applies the surface motion policy to any envelope: zero when the host asked for reduced motion, the value itself otherwise. | | `buildDataWindow` | Builds the row list of one bar. Sections without their source are omitted entirely; without `ext` only the bar group is returned. A repeated build of the same bar with the same `ext` and options objects is memoised. | | `dataWindowGroups` | Groups of the model in display order; only non-empty groups are listed. | | `isDeltaBarMode` | True when the value is one of the delta bar modes. | | `deltaNormaliser` | Normaliser of the tone: the host value when it is usable, otherwise the mean `\|delta\|` of the window. Returns 0 when no delta is finite, which the tone functions read as "paint the plain palette colour". | | `deltaBackgroundTone` | Tint behind the slot: only the sign of the delta decides the colour, the saturation stays constant so the OHLC of the bar is not disturbed. | | `deltaBarSplit` | Lower/upper halves of a body box, split at its vertical middle. | | `paintDeltaBackground` | Paints the background tint of the whole slot. Returns false when there is nothing to paint, so the caller can count real work. | | `deltaTailTone` | Tone of the lower half of the body: the delta tone of the bar. Returns null when the delta carries no information - the body then keeps its own direction colour. | | `lastBarRegion` | Region affected by an update of the newest bar: from one bar slot left of the last bar to the right edge, full height - this covers the price axis labels as required by §7.2. | | `drawDot` | One data dot on the canvas: round when the context implements `arc`, a square of the same size otherwise. Markers, lollipop dots and analytic points all come through here, so the degrade rule lives in one place and a minimal context (a mock, a canvas shim) still gets a dot. | | `createLaneItemsCache` | - | | `eventLaneItems` | - | | `eventBadgeColor` | Fill of a badge by kind: alerts warn, the rest stay in the accent family. | | `eventLaneBadgeRect` | Rect of one badge in canvas coordinates; painter and hit test share it. | | `eventLaneHit` | Badge under a canvas point, or null. The tolerance widens the target, so touch hosts can pass a bigger value without changing the layout. | | `paintEventLane` | Paints the lane in the axis strip right above the time chip. Returns the number of badges drawn; an empty lane paints nothing at all. | | `formatPlaceholder` | Placeholder of a missing or broken value: / `n/a`. | | `formatPrice` | Price with the instrument precision; placeholder for a broken value. | | `formatPercentValue` | Percent with a sign; placeholder for a broken value. | | `formatBarTime` | Bar time in the timeframe granularity and the locale representation. | | `normalizeAngle` | Angle of the gradient normalised into 0..360; a non-finite value falls back. | | `normalizePhase` | Phase of the shimmer normalised into 0..1; a non-finite value means no shift. | | `gradientEndpoints` | End points of the gradient across a box at the given angle, in radians from the centre; the axis always spans the box, so no corner stays unpainted. | | `applyGradient` | Paints nothing but prepares `ctx.fillStyle` with the gradient of the box. Returns `false` when the canvas cannot paint gradients. | | `gridDash` | Dash pattern of the grid lines; `dotted` keeps a dense plot quiet. | | `periodDividers` | Indexes of the first bar of every new period inside `[from, to)`: the painter draws a divider there. Gaps in the history (weekends, halts) never open a period on their own, because the scan compares neighbouring bars. | | `bookGrid` | - | | `candleHeatmapGrid` | Candle screener: instruments by rows, periods by columns, cell value is the period change in percent. Missing pairs stay absent (painted as nothing). | | `paintAuctionHeatmap` | - | | `heatmapAlpha` | Quantised `withAlpha`: 65 alpha steps, bounded cache, cleared when flooded. | | `heatmapColor` | Colour of one cell. `intensity` is 0..1 for the flat tones and -1..1 for `diverging`, where the sign picks the side and the magnitude the alpha. | | `heatmapPalette` | Resolves the tone palette of a grid. `resolveLook` walks the whole look pack, so a per-cell call would dominate the frame - painters resolve once and then use `heatmapToneColor` for every cell. | | `heatmapToneColor` | Colour of one cell for a palette that was already resolved. | | `heatmapPlotRect` | Plot rectangle of a heatmap of the given size. Overlay layers (a POC line, a value-area border) recompute a row position through it instead of repeating the padding constants. | | `paintHeatmapGrid` | Paints the grid and returns the number of filled cells. A grid with no rows or no columns paints the "no data" state instead of throwing. | | `paintLiquidityRibbon` | - | | `leftFadeShare` | Share of the plot covered by the fade; `false`/absent means no fade. | | `paintLeftFade` | True when the fade painted; false when the option or the backend refuses. | | `legendToggleBox` | Box of the collapse chevron: it sits under the ticker heading, on the left, like a panel toggle. The position is deterministic (no measurement), so the host hit-tests the same rectangle it sees. | | `legendChevronPoints` | Chevron triangle: the apex points up when the row is open, down when not. | | `legendText` | One compact, locale-formatted OHLCV row; pure and testable. | | `legendTitleSegments` | - | | `legendSegments` | Segments of the compact row (P5). `plain` returns one run in the direction colour (legacy look); `fields` returns label/value pairs so the close and the change carry the direction colour while the rest stay neutral. | | `paintLegendLayer` | Paints the legend row and returns true when something was drawn. The row refuses narrow panes and empty bars; `plain` mirrors the series direction (up when close is not below open), `fields` tones every field separately. | | `paintSessionLevels` | Dashed levels with their tags; the tag tone changes when the price breaks one. | | `paintAutoFib` | Impulse line plus the retracement levels of the automatic Fibonacci. | | `lookFontFamily` | Font stack of a look: a `LOOK_FONTS` name, a literal stack or the theme one. | | `resolveLook` | Resolves the look against the theme. Absent input always yields the classic / presentation, so the option is strictly additive. | | `lookLineTail` | Tail of a body under `lineGradient`: the theme tail, or a share-scaled base. | | `paintChartGradient` | Paints the chart background gradient of the frame. Returns `false` when the canvas cannot paint gradients, so the caller keeps the flat theme fill. | | `lookDirectionColor` | Growth or fall colour of a bar under the resolved look (I-1: theme or look). | | `lookTailColor` | Gradient tail of a bar under the resolved look. | | `paintBodyGradient` | Vertical body shade from the bright top to the soft tail. Returns `false` when the canvas has no gradients, so the caller keeps the flat fill. | | `paintAurora` | Diagonal accent glow of the aurora backdrop: a soft band from the top-right corner, blended over the flat or gradient fill. Returns `false` when the canvas cannot paint gradients, so the caller keeps whatever it painted. | | `paintStrokeGradient` | Horizontal taper of a stroke: full colour at `fromX`, a faint tail at `toX`. Returns `false` when unsupported, so the caller keeps the flat stroke. | | `measureDelta` | Outcome of the ruler: bars, price delta, percent, span and direction. | | `measureDuration` | Span of the ruler in one unit: seconds, minutes, hours or days. | | `measureTagText` | Outcome text; `fits` false drops the percent part (narrow axes). | | `measureChrome` | Vertical guides of the ruler, clamped into the plot area. | | `paintMeasure` | Paints the ruler and returns the number of guides drawn (two when the anchors land inside the plot, one when only one does). A ruler without finite prices still paints the verticals and the span chip. | | `miniExtent` | Normalises a sample to its finite extent; null when nothing is drawable. | | `miniRatio` | Maps a value into `0..1` inside the extent; `NaN` for a flat or empty range. | | `paintSparkline` | Polyline of a sample: the trend of a value across its window. | | `paintDeltaBar` | Signed bar from the centre: direction and size of a change. | | `paintInlineBar` | Bar of a value against the column maximum, over a quiet track. | | `paintMicroBars` | Small column series; columns below the first value take the down colour. | | `paintHeatStrip` | Row of heat cells (months, buckets) toned by value. | | `paintMiniStack` | Stacked shares of one group: what the row is made of. | | `paintScaleMark` | Marker on a labelled scale: rating, tenor, percentile. | | `paintQualityStrip` | Coverage strip: one segment per field, height by fill ratio, stale segments take the warning colour. Answers "can I trust this row". | | `paintTimelineStrip` | Events of a row on one line: position in `0..1`, weight sets the dot radius, `kind` picks the tone (accent, up, warn). | | `paintMiniDistribution` | Histogram of a column sample with the median tick; `range` shades the part the host filtered or brushed. | | `paintMiniGauge` | Utilisation arc: how much of a limit the row consumed. | | `paintMiniWaterfall` | Steps of a bridge: how the pieces build the total. | | `paintMiniLadder` | Bid and ask depth of the row: bars grow left and right from the middle. | | `paintRiskLadder` | Risk ladder of an order or a position: the entry line, the stop below it in the down tone and the target above it in the up tone. The two legs are drawn to scale, so the row shows the risk-to-reward ratio without a number. | | `paintStatusFunnel` | Stage funnel: how many items reached each step of a workflow. | | `paintIvMatrix` | Volatility surface (TAB-C4): one cell per strike and expiry, tinted by the level, and the smile of every expiry drawn through the cheapest strike of that row - the shape a trader looks for before reading any number. | | `paintPayoffCurve` | Payoff of a strategy (TAB-C5): the curve against the underlying, the winning side filled up and the losing side down, with a mark where the curve crosses zero - the break-even of the host model. | | `paintGreekBars` | Greeks of a position (TAB-C5): one signed bar per greek around the middle line, so a delta and a negative theta are told apart at a glance. A greek that is not a number is dropped: half a row of bars lies about the position. | | `paintTermCurve` | Futures term structure (TAB-F1): the curve of the contracts and the open interest under every point as a bar, because a flat curve with no interest is not a signal. | | `paintCorrelationHeat` | Correlation heat of a book (TAB-F4; the name tells it apart from the risk kit painter `paintCorrelationMatrix`): diverging tint - one colour for moving together, another for moving apart - with the diagonal left empty, because a member is always correlated with itself and the cell says nothing. | | `paintScenarioCone` | Scenario cone (TAB-F6): the band a shock spreads over the horizon, drawn as a filled envelope with the centre path on top, because the question is the width of the risk and not four numbers in a row. A band that is not centred on the starting value of the host stays visible: that value is marked on the left. | | `paintBalanceTimeline` | Balance timeline of an account (TAB-G3): money does not move between two settlements, so the line steps instead of sloping, the part below zero is tinted as a violation and the lowest point of the window carries a mark - the reader looks for the day the balance was thin. | | `paintCashflowLadder` | Cash-flow calendar (TAB-G6): every period is a column - inflows above the line, outflows below - and the cumulative line runs over them, because the question is whether the account survives the month, not the size of one payment. | | `paintLimitBar` | Utilisation of a limit with its breach threshold (TAB-H3): the bar grows with the usage, the threshold is a mark on the track, and the part above it takes the warning colour - a limit breach is a fact of the row, not a caption. | | `paintAgreementScatter` | Agreement of two books (TAB-G5): one dot per compared pair, the expected value on one axis and the actual on the other, with the diagonal of perfect agreement and the outliers outside the tolerance band. A reader sees in one glance whether the breaks are noise around the line or a systematic shift. | | `paintMiniFigure` | Dispatcher by id; the payload is the array or scalar the figure expects. | | `clampUnit` | Clamp a progress value to the 0..1 range; NaN becomes 0. | | `lerp` | Linear interpolation between two numbers. | | `easeOutCubic` | Cubic ease-out: fast start, soft landing (zoom steps, scrolls). | | `easeOutQuad` | Quadratic ease-out: gentler variant for short 80-120 ms transitions. | | `easeInOutQuad` | Ease-in-out: symmetric mid acceleration (crossfades). | | `animatedBarSpacing` | Bar spacing after `elapsedMs` of an animated zoom step (ease-out cubic). | | `markerAppear` | - | | `drawingGhostStyle` | Fade-in of a placement or drag ghost: transparency 0 -> 0.5 with a dashed edge while the object stays uncommitted. Zero duration (reduced motion) returns the final ghost immediately. | | `drawingAppearStyle` | Object-level appear envelope: alpha 0 -> 1 and marker scale 0.6 -> 1 over 140 ms; zero duration returns the final style. | | `flashDecay` | - | | `crossfadeAlpha` | Alpha of the outgoing frame during a crossfade: 1 -> 0 (ease-in-out). | | `createZoomAnimation` | - | | `paintOrderbookChart` | Paints one order book chart variant and returns the number of painted primitives (levels, bars, cells, labels) - a diagnostic the tests assert on. An empty book paints the "no liquidity" state instead of an exception. | | `buildOrderbookView` | Builds the normalised view: buckets, caps every side to `levels` best rows and recomputes both cumulative curves from the best price outwards. | | `paintLineOverlays` | Paints every overlay over the visible bar window and returns the number of points written into the visible plot. The dash pattern is reset after the pass so the following layers start from a clean state. | | `dimAlphaFor` | Spotlight dim of the plot area: 5 percent dark, 3 percent light (item 2). | | `hoverColumnAlphaFor` | Hovered column tint: 6 percent on dark, 4 percent on light (item 7). | | `wickWidthOf` | Wick width by zoom: two pixels above ten pixels per bar (item 4). | | `bodyRadiusOf` | Body corner radius by zoom: one pixel above ten pixels per bar (item 4). | | `pulseGlowAlpha` | Pulse glow alpha of the last price tag: 0 -> 0.25, 0.5 -> 0.55 (item 1). | | `vignetteOuterAlpha` | Vignette outer alpha: 16 percent on dark, 3 percent on light (item 9). | | `shade` | - | | `paintBackgroundGradient` | Vertical background gradient: background at the top, shaded at the bottom. | | `paintVignette` | Radial vignette over the whole canvas (item 9); false when unsupported. | | `paintAxisDot` | Solid axis dot used by the spotlight; falls back to a square (item 2). | | `lockGlyph` | Padlock of a locked tag: body below, shackle arc above (size 8 by default). | | `priceLineTagBox` | Tag of a price line on the price axis: the width covers the label plus the padlock, the vertical centre stays inside the frame (invariant I-2). | | `priceLineHit` | Nearest line within the tolerance, or null; inactive lines stay reachable. | | `paintPriceLines` | Paints the hairlines and their axis tags; returns the number of lines drawn. | | `readoutColumns` | Columns of the line mode. Order is stable: heading, OHLC, volume, trades, change; the change column carries the tone of the movement. | | `readoutStripHeight` | Height of the strip: zero when there is nothing to paint. | | `readoutDirtyRegion` | True when the strip has to repaint: model change or different legend rows. | | `truncateReadoutText` | Truncates text with an ellipsis so it never overflows `width`. | | `paintReadout` | Paints the strip inside its own clipped band. The heading column (symbol, timeframe, time) is dropped first when the width is tight, then the rest is ellipsized; a null model with no rows paints nothing. | | `attributionRows` | Rows of an attribution table. The share is the step value over the largest span of the bridge, so a negative step reads as a negative share; the cumulative column is the running level of `waterfallSpans` and therefore ends on the bridge total. A step with a non-finite value never reaches this table (the span builder drops it), and a bridge without usable steps is an empty table rather than an exception. | | `correlationGrid` | Labels plus a square correlation matrix to a heatmap grid. The value is clamped to `-1..1`, a non-finite cell stays neutral (not tinted) and the diagonal is forced to 1 - a correlation matrix that disagrees with itself is a data error, not a figure. With an asymmetric input the upper triangle wins, because that is the triangle the labels read against. | | `paintCorrelationMatrix` | Paints the correlogram: the shared heatmap painter with the diverging tone. | | `monteCarloCone` | Simulates `paths` geometric random walks and returns the median path plus the nested confidence bands. `steps` below one, `paths` below one, a non-finite start or a non-positive volatility return an empty cone (the caller paints the no-data state); `volatility = 0` collapses every band onto the drift path. | | `monteCarloJob` | Same simulation in flat typed arrays for a worker: the job is structured-clone safe and its buffers can be transferred instead of copied. The math is one implementation - `monteCarloCone` and `monteCarloJob` differ only in the shape they hand back, so a host may compute in a worker and validate in the main thread without divergence. | | `coneFromJob` | Points the painter as before, rehydrated from a job result (once per result). | | `monteCarloJobTransferables` | Buffers of a job, for `postMessage(job, transferables)`: each buffer appears once, so a host never lists the same array twice (a duplicate transfer list is rejected by the structured clone algorithm). | | `paintMonteCarloCone` | Paints the cone through the fan chart of the analytic family. | | `riskContributions` | Relative risk contributions of the weights under the covariance matrix. The covariance is symmetrised first (a covariance matrix is symmetric by definition, and a host that feeds half of it should not change the answer), the weights are normalised to sum one, and a portfolio with zero variance has no decomposition at all - the function returns `[]` instead of dividing by zero. A non-finite weight or matrix entry drops the asset. | | `paintRiskDecomposition` | Draws the contributions as signed columns from zero: the tone follows the sign (a hedged asset contributes negatively) and the bar geometry comes from the analytic series family. Returns the number of painted columns. | | `visibleSlice` | Inclusive-exclusive bar window with a one bar margin on both sides. | | `xOf` | Center of the slot of the given bar index. | | `barWidthOf` | Body width of a candle/column: 70 percent of the slot, at least one pixel. | | `directionColor` | Growth or fall color; the only source of these colors is the theme (I-1). | | `deltaTone` | Body colour of one candle: `up`/`down` by the sign, `accent` for a flat or non-finite delta. `normaliser `, so the same call sequence gives the same codes (tests, CI stands, SSR fixtures). | | `encodeShareState` | Encodes the config into a paste-ready payload. | | `decodeShareState` | Decodes a payload back into a parsed config; `null` only when the envelope itself is broken (foreign prefix or invalid base64url). Config issues are reported through the parser result as usual. | | `createMemoryShareStore` | - | | `encodeShareShort` | Wraps the payload into a short link (`uf1:`). | | `decodeShareShort` | Reads a short link back; null for a foreign prefix, unknown or expired code. | | `createTableChartLink` | Creates the link. The same reference published twice raises one event, because a pointer that stays on a row must not repaint the chart on every frame. | | `exposeVersion` | Publishes the version on the given scope (globalThis by default). A foreign non-empty value is never overwritten - several chart bundles may coexist on a host page. | | `runPaperStrategy` | Runs the strategy over the bars; the last bar always closes the position. | | `compareSeries` | Aligns up to ten series on the reference timestamps and normalises them (absolute, indexed to 100 or percent change). A missing bar carries the previous close forward; before the first bar the value is NaN ( §4). | | `alignByTime` | Close of the last bar at or before each timestamp (carry forward). | | `formatStudyValue` | A value that is not computed yet shows as `-`, never as `NaN` ( §3). | | `buildLegend` | Legend and crosshair rows for the active studies at one bar (FR-IND-06): title with parameters, all output values of that bar, error text when the study failed. The same rows feed the value row and the crosshair tooltip. | | `createOutputBuffers` | - | | `studyBarAt` | Reads a bar defensively: out-of-range gives undefined, never throws. | | `readOutput` | Reads an output value: missing, out-of-range and non-finite give null. | | `numberParam` | Number parameter with fallback; non-finite and wrong types fall back. | | `booleanParam` | - | | `stringParam` | - | | `validatePlugin` | - | | `installPlugin` | Installs a plugin atomically: either every study is registered or nothing is. A collision with an existing id refuses the whole plugin (no silent override). | | `validateDefinition` | Contract check with actionable problems; used by the registry and by tests. | | `validateStudyParams` | Runtime parameters of a registered study (wave, ): a key the definition never declared is refused with the declared names, a value outside the declared range is refused with the range. Values are NOT coerced. | | `paramsHash` | Stable parameter hash: key order does not matter, types do. Used as a part of the result cache key ( §2). | | `indicatorCacheKey` | - | | `defaultPoolSize` | Pool size rule from §2. | | `createTemplateLibrary` | - | | `loadStarterTemplates` | Loads the starter pack into a fresh library (idempotent per id). | | `fibonacciLevels` | Levels for a swing from `from` to `to` (anchor prices, either direction). Non-finite anchors yield an empty list instead of NaN prices. | | `bracketEntryRequest` | Entry leg of the plan on the platform catalogue (the six types of `trading-ms`). | | `bracketDistances` | Absolute distance of a level from the entry, in ticks and percents. | | `targetFromRisk` | Quick targets of the risk ruler: the 1R / 2R multiple of the entry risk. | | `orderTypeSpec` | - | | `orderTypeLabel` | Panel label of the order type; KZ has its own column, `uz` falls back to EN. | | `validateOrderRequest` | Problems list; an empty list means the request may be sent (I-4). | | `confirmationDecision` | - | | `hitTestTradeLines` | Nearest trading line within `tolerancePx` of the pointer, else null. | | `snapToTick` | Rounds a price to the instrument tick; a broken tick passes the price through. | | `clampTradePrice` | Clamps a price into the allowed band; broken bounds are ignored. | | `resolveDragPrice` | Final price of one drag step: optional tick snap, then the band clamp. | | `canPlaceOrder` | - | | `canModifyStop` | Modifying a stop is a significant action: same gates as placing. | | `dragConfirmationRequired` | In `live` a dragged stop needs an explicit confirmation by default. | | `buildTradingOverlay` | - | | `ticketAvailability` | Panel availability of the current role and mode ( §5.3). | | `orderTag` | Paper-order tag: demo orders are marked as demo, the rest as live. | | `paperSessionReport` | Builds the session report. `equityCurve` is optional; without it the drawdown is computed on the running sum of realized PnL, which matches the broker cash line for closed trades. | | `paperLeverage` | Clamp of the leverage policy: non-finite and out-of-range values fall back. | | `paperKpi` | KPI of the paper desk. The unrealised part and the equity come from the account state unchanged, so the dock and the session report show the same numbers; only the margins are derived here. | | `referencePrice` | - | | `previewOrder` | - | | `computeRisk` | - | | `addVolumePane` | Adds a pane that carries its own `volume` price scale and is linked to the shared time range: columns grow from the pane baseline to the tallest visible volume. The host paints the columns through `paintVolumeLayer`; the pane keeps the volume scale off the price pane ( §2-§3). | ## Types (805) | Symbol | What it does | | --- | --- | | `AlertActionKind` | - | | `AlertAction` | - | | `AlertActionPlan` | - | | `SeriesMap` | Indicator series aligned by bar index; null marks a gap. | | `AlertDeliveryHost` | - | | `AlertDeliveryResult` | - | | `DrawingConditionResult` | - | | `AlertTick` | Alert engine (FR-ALERT-04, §4/§6/§7): one instance per instrument stream. Rules are validated and stored with their runtime state - the last fire time (cooldown), the trigger window of `repeated` and the object-alert side for drawing conditions. A repeated tick (same time and price) is ignored entirely (gate: idempotency), the first tick only seeds the comparison base. While `dataComplete` is false the emitted events carry the flag through to the journal (snapshot mode, §4.5). | | `BarHelpers` | - | | `AlertUpsertResult` | - | | `AlertEngineOptions` | - | | `AlertGroupLogic` | - | | `AlertConditionGroup` | - | | `AlertGroupResult` | - | | `DeliveryStatus` | Alert journal (FR-ALERT-04, §5/§6): records of the firings with their delivery status (pending -> sent -> failed), combination filters (all fields are ANDed, the period is inclusive, the search is case-insensitive) and a stable CSV export. The trade link follows the product order "fired -> acted -> executed": an order id must be attached before a trade id, the reverse order is rejected. | | `JournalRecord` | - | | `AlertJournalFilter` | - | | `JournalStats` | - | | `AlertPriceLine` | Draggable alert price line (ANALYSIS/06 §5.2): a price level with a step-snapped drag model. The host paints the line and routes pointer events; the model keeps the price honest (snapped to the step, positive, clamped). | | `AlertLineOptions` | - | | `AlertLineHitOptions` | - | | `PlatformAlertRule` | Mapping to the platform rule model (FR-ALERT-03, §2): the library never invents its own format - `toPlatformRules` produces the exact fields of `notification-ms` (`metricName`, `conditionOperator`, `thresholdValue`, `severity`, `notificationChannel`, `ruleType`, `thresholdCount`, `timeWindowMinutes`). Conditions the single-threshold model cannot express (a two-sided cross, a range exit) unfold into two platform rules. | | `PlatformMetric` | - | | `AlertSeverity` | Alert rule model (FR-ALERT-01/03, §1-2): the union of the twelve condition kinds ALT-01..12, the rule that mirrors the `notification-ms` `alert_rules` model and the event the engine emits. Evaluation kernels live in ticks.ts / bars.ts / patterns.ts / drawings.ts; the engine (engine.ts) owns rule state, debounce and limits. | | `AlertChannel` | - | | `AlertRuleType` | - | | `AlertDirection` | - | | `AlertOperator` | - | | `CandlePatternId` | - | | `AlertFormulaEvaluator` | External formula evaluator (ALT-12): host wires the S5 sandboxed runtime. | | `AlertCondition` | - | | `AlertConditionKind` | - | | `AlertEvaluationMode` | - | | `AlertConditionMeta` | - | | `AlertRule` | Rule mirrors `notification-ms` `alert_rules` ( §2). | | `AlertEventOut` | - | | `EditableAlertConditionKind` | Editor defaults of the catalogue conditions ( follow-up "the alert rule editor form"): a ready-to-edit condition per kind, so rule builders and the alert group editor do not hard-code their own fixtures. The formula kind needs a host evaluator and is excluded on purpose. | | `AlertPanelStatus` | - | | `AlertFiredFact` | - | | `AlertPanelRow` | - | | `AlertPanelOptions` | - | | `AlertPanelFilter` | - | | `AlertTemplateContext` | Production alert helpers (§5): message templates with placeholders and the delivery retry policy. The BFF owns the queue itself; the core provides the deterministic pieces - rendered text, retry timing (exponential with a cap and a seeded jitter) and the retryable-error class. | | `RetryPolicy` | - | | `TickContext` | Tick condition kernels (§1/§4): deterministic edge predicates over the (previous, current) pair. ALT-01/02/03 fire strictly on a crossing - a tick that is already beyond the level stays silent until the price comes back and crosses again. ALT-10 fires on the first tick outside the range (borders inclusive) or on a close beyond them. | | `TimelineKind` | Event timeline (FR-ALERT-05, §5): news, dividends, reports, alerts and trades on one axis. Entries are deduplicated by id, ranges are inclusive, and markers come out sorted by time; on equal times the kind priority decides (alert above trade above report above dividend above news) so a firing stays visible next to the event that caused it. | | `TimelineEntry` | - | | `TimelineMarker` | - | | `FibLevel` | - | | `AutoFibResult` | - | | `BasketMember` | One selected row with its weight (nominal, quantity, exposure). | | `BasketMetrics` | - | | `BasketOptions` | - | | `BasketSeries` | Series of one member: the composite is built over the common time axis. | | `CursorBucket` | One bucket of a cursor: the day (or week) the crosshair points at. | | `TimeFilter` | - | | `ComparisonRowInput` | - | | `ComparisonRow` | - | | `ComparisonTableOptions` | - | | `ComparisonSortKey` | - | | `ComparisonSortDirection` | - | | `DivergenceKind` | - | | `DivergencePoint` | - | | `DivergencePair` | - | | `DivergenceOptions` | - | | `DivergencePaintInput` | - | | `DayCountConvention` | Day-count convention of an accrual period. | | `IsoDateParts` | Parsed calendar date of an ISO string. | | `InstrumentStatsOptions` | Instrument statistics HUD (ANALYSIS/06 §4.2): last price and change, day extremes, ATR, VWAP distance and close-to-close volatility. The trading day is the UTC day of the last bar; the host calendar stays authoritative for exchange-local sessions and the values are honest aggregates of the passed bars only. | | `InstrumentStats` | - | | `LeaderboardRow` | Compare leaderboard (ANALYSIS/06 §4.1): ranks instruments by their change against the session open. Rows with a zero or invalid open are dropped; ties fall back to the symbol order, so the ranking is stable. | | `LeaderboardDirection` | - | | `LeaderboardEntry` | - | | `LeaderboardOptions` | - | | `ReconciliationPair` | One pair of numbers about the same key: what was expected and what came. | | `ReconciliationEntry` | One compared pair with the difference and the verdict. | | `ReconciliationSummary` | - | | `ReconcileOptions` | - | | `ReasonStep` | One step of the reason waterfall: a label and the signed amount behind it. | | `DatedRow` | One row of a book at a point in time. | | `AsOfGap` | Difference between two versions of the same book. | | `ReconciliationTextOptions` | - | | `RsPoint` | Relative strength (ANALYSIS/06 §4.6): the instrument against a benchmark, aligned by exact bar time and normalised so the first aligned point equals `baseValue` (default 100). Bars without a matching time are skipped; the alignment count keeps the honest coverage. | | `RelativeStrength` | - | | `RsPanelRow` | - | | `RsPanelOptions` | - | | `RsPanelSummary` | - | | `LevelPeriod` | - | | `LevelKind` | - | | `SessionLevel` | - | | `SessionLevelsOptions` | - | | `LevelBreakout` | - | | `SwingKind` | - | | `SwingPoint` | - | | `SwingOptions` | - | | `ImpulseOptions` | - | | `Impulse` | - | | `TreeEntry` | One visible line of a flattened tree. | | `TableTreeOptions` | - | | `TreeKeyOf` | Key of a row inside the tree: the same key the table uses for its rows. | | `TableAggregate` | Aggregated value of one column of a group; `null` when there is nothing to show. | | `TableTextOptions` | Text form of a table (TAB-D6): tab separated by default, comma separated with `separator: ','`. The header is always taken from the column titles, and a cell is the formatted value, exactly as it is displayed. | | `TableViewRange` | Range filter of one column, as a view stores it. | | `TableViewChart` | Chart the view was looking at; the host fills what it needs. | | `TableView` | Saved arrangement of a board. | | `TableColumnKind` | - | | `TableTone` | - | | `TablePill` | - | | `TableFigure` | Figure of a table cell: which painter draws the cell, how the values of a row are read and what a screen reader hears. The model only describes the figure and resolves the samples; drawing belongs to the host, so the cell figure works in a table, a board or a printed report alike. | | `TableColumn` | - | | `TableSortDirection` | - | | `TableSort` | - | | `TableHistogramBucket` | One interval of a column distribution. | | `TableHistogram` | - | | `HttpResponseLike` | Host owned HTTP transport: the core never touches fetch or DOM. | | `HttpTransport` | - | | `EventSourceLike` | - | | `SseFactory` | - | | `StompSocketLike` | - | | `StompFactory` | - | | `MarketDataEndpoints` | - | | `MarketDataAdapterOptions` | - | | `MemoryAdapterOptions` | - | | `AdjustmentMode` | - | | `AdjustmentAction` | - | | `BarApplyKind` | - | | `TickRejectReason` | Why a tick did not produce a bar write (used by pipeline counters). | | `TickApplyResult` | - | | `TickDetailedResult` | Detailed outcome of one tick: applied bar or a concrete reject reason. | | `BarAggregatorEvent` | Stream events of the tick aggregator ( follow-up, event stage 5). | | `SeriesCacheMeta` | Identity of the data behind a cached series ( §4). | | `ComparisonFeedSymbol` | - | | `ComparisonFeedRequest` | - | | `ComparisonFeedIssue` | - | | `ComparisonFeedResult` | - | | `ConnectionState` | - | | `ConnectionSnapshot` | - | | `ConnectionEvent` | - | | `ConnectionControllerOptions` | - | | `DataControllerOptions` | - | | `LoadRequest` | - | | `LoadResult` | - | | `StreamRequest` | - | | `DataControllerEvent` | - | | `BarsEvent` | - | | `DatafeedErrorKind` | Typed datafeed errors (§3). Messages never carry tokens, headers or full response bodies: hosts show them to users and send them to telemetry (NFR-RELY-02, NFR-OPS-04). | | `CalendarEventKind` | - | | `CalendarEvent` | - | | `EventLaneMarker` | - | | `EventCluster` | One group of the lane: a single marker or a crowd of close markers. | | `BarsCsvOptions` | - | | `GetBarsRequest` | Datafeed contract (§3). The core never owns a transport: hosts inject it into adapters, so the package stays DOM free. | | `BarsPage` | - | | `SubscribeBarsRequest` | - | | `SubscribeTicksRequest` | - | | `Unsubscribe` | - | | `MarketMarkKind` | - | | `MarketMark` | - | | `MarksRequest` | - | | `LoadState` | UI level state of a series ( §3, FR-INTERACT-07). | | `Datafeed` | - | | `GapMonitorEvent` | Stream event of the monitor ( follow-up). | | `LegacyFeedLike` | - | | `LegacyAdapterIssue` | - | | `LegacyAdapterOptions` | - | | `RenkoOptions` | - | | `KagiOptions` | - | | `PointAndFigureOptions` | - | | `RangeBarsOptions` | - | | `LineBreakOptions` | - | | `OrderbookLevel` | Order book layer: a framework-free model that keeps the ladder honest - levels are validated, sorted and deduplicated, snapshots are applied idempotently by sequence, and derived values (best bid/ask, spread, mid, cumulative depth, imbalance) are pure functions of the kept state. | | `OrderbookSnapshot` | - | | `OrderbookRow` | - | | `OrderbookDepth` | - | | `BarPack` | Columnar view over a bar series. Time stays float64 (epoch ms), prices and volume are float32: enough for tick precision and half the memory of a plain array of objects. | | `VisibleWindow` | - | | `PAndFAutoOptions` | - | | `PAndFParameters` | - | | `TickPipelineStats` | - | | `TickPipelineOptions` | - | | `PipelineBarKind` | - | | `GapReport` | - | | `GapSpan` | One missing stretch: time after which buckets are absent ( follow-up). | | `StompFrame` | Minimal STOMP 1.2 frame reader/writer. Covers exactly what the market-data stream needs: CONNECT/SUBSCRIBE/UNSUBSCRIBE out, MESSAGE in, heartbeats. A full client with reconnects is deferred (delta of S3). | | `StompParseResult` | - | | `StompSocketFactory` | - | | `StompTimers` | Timer seam: tests advance reconnects deterministically. | | `StompReconnectOptions` | - | | `StompSubscriptionOptions` | - | | `StompSubscriptionHandle` | - | | `StoredSeries` | - | | `AsyncKeyValueStore` | Narrow async key-value contract a host adapts to IndexedDB, OPFS or any other storage; the core never touches browser APIs directly. | | `PersistentStore` | Persistence of loaded pages so a reload does not refetch history. | | `AlertKind` | Object alerts (FR-DRAW-08, §5): touch a level, break a channel, leave a closed figure, enter a zone. Evaluation is pure: it consumes bars and a state, returns the edge-triggered events and the next state. Delivery to EMAIL/SMS/IN_APP/PUSH stays with the host. | | `ObjectAlert` | - | | `AlertEvent` | - | | `AlertSide` | - | | `AlertState` | - | | `AlertEvaluation` | - | | `MoveDelta` | Drawing commands and the fifty step history ( §2). Every mutation goes through a command that returns its inverse; unchanged commands are not recorded, objects are replaced instead of mutated, so snapshots stay intact. | | `DrawingCommand` | - | | `DrawingHistoryEvent` | Stream payload of the history stack ( follow-up: `history:changed`). | | `CustomPrimitive` | Primitive of a custom builder without the identity fields the engine owns. | | `CustomToolContext` | - | | `CustomToolSpec` | - | | `CustomToolAdapters` | - | | `FillPatternKind` | - | | `FillPatternDefinition` | - | | `FillShapeRect` | - | | `FillShapeEllipse` | - | | `FillShapePolygon` | - | | `FillShape` | - | | `FillBounds` | - | | `FillSegment` | - | | `FillDot` | - | | `FillPatternGeometry` | Geometry of one pattern tile set: strokes, dots or nothing. | | `FillPatternPaintInput` | - | | `FillPatternPaintResult` | - | | `ScreenPoint` | Screen geometry of the wave one tools ( §6): every tool turns its resolved anchors into primitives that the renderer draws and the hit test queries. All coordinates are finite or the object is considered invisible. | | `Viewport` | - | | `GeometryEnv` | - | | `DrawingPrimitive` | - | | `GeometryOptions` | - | | `MeasureSummary` | - | | `Box` | Hit testing of drawing primitives ( §2-3): point markers win over bodies, higher layers win over lower ones, hidden objects never reach this layer (geometry returns nothing for them). The spatial grid answers box and point queries so a chart with thousands of objects stays responsive. | | `HitResult` | - | | `JournalRow` | Object journal (FR-DRAW-05, §2): a derived view of the store rows, the focus frame for jumping to an object and the group actions that the host sends through the regular command history. | | `JournalFilter` | - | | `JournalGroupAction` | - | | `MagnetMode` | Magnet snapping ( §2): `off` leaves the cursor alone, `weak` snaps to candlestick fields and object anchors inside 6 px, `strong` widens the radius to 12 px and adds round price levels. | | `MagnetKind` | - | | `MagnetCandidate` | - | | `MagnetContext` | - | | `MagnetResult` | - | | `DrawingPointKind` | Drawing model of the charting core ( §1): objects anchor to time and price only, style travels with the object and colours stay theme tokens so the palette gate keeps hex literals out of the core. | | `TimePricePoint` | - | | `BarPricePoint` | - | | `PricePoint` | - | | `TimePoint` | - | | `DrawingPoint` | - | | `LineStyle` | - | | `TextAlign` | - | | `DrawingStyle` | - | | `DrawingMeta` | - | | `Drawing` | - | | `DrawingInit` | - | | `DrawingValidation` | - | | `MeasurePoint` | - | | `MeasureSet` | - | | `MeasureSpan` | - | | `MeasureSpread` | - | | `DrawingPaletteTool` | - | | `DrawingPaletteSubgroup` | - | | `DrawingPaletteGroup` | - | | `DrawingPaletteState` | Serializable toolbar state of the palette rail: the plain-JSON payload that lands in a workspace snapshot unchanged (NFR-RELY-04). All transitions are pure and ignore unknown tool ids, so a snapshot of an older catalogue stays safe (NFR-SEC-06: unknown fields are ignored, a damaged snapshot never throws). | | `DrawOp` | - | | `GeometryCacheStats` | - | | `DrawingAppearance` | Per-frame appearance of one object (ghost, drag, appear),. | | `LayerOpsOptions` | - | | `LayerOps` | - | | `AnchorEnv` | Anchor resolution ( §1): drawings live in time and price. The host injects the pixel mapping of the current scales; time anchors find the bar that opens at (or just before) their timestamp, so switching a timeframe keeps the object on the same moment of the market. | | `ResolvedAnchor` | - | | `DrawingIssue` | - | | `DrawingParseResult` | - | | `DrawingTemplate` | - | | `TemplateParseResult` | - | | `DrawingStoreEvent` | Ordered collection of drawings ( §2): stable order by layer `z`, then by insertion; every mutation keeps the collection consistent. The store also streams its mutations: created/changed/removed, cleared and selection changes reach the subscribers in mutation order. | | `DrawingStyleTemplate` | - | | `StyleTemplateInit` | - | | `TemplateTarget` | Template library (FR-DRAW-06, §4): named object sets, one default template for a fresh chart, applying a set to another instrument. The library keeps immutable templates and never touches the store itself. | | `DrawingCategory` | Wave S6 tool catalogue ( §6, rows marked "S6"): 29 tools across five categories. Tool definitions describe the anchor contract and the default style; geometry lives in `geometry.ts`, the model in `model.ts`. | | `DrawingPointSpec` | - | | `DrawingToolDefinition` | - | | `DrawingForInit` | - | | `PinnedTooltip` | Drawing tooltip pinning: hosts pin the tooltip of one drawing object so it stops following the cursor. A second click on the same object unpins it, a pin on another object replaces the previous one and a removed object clears its pin on the next frame. Pure state only - drawing the pinned label stays with the host scene. | | `DrawingTreeRow` | - | | `DrawingTreeNode` | - | | `DrawingTreeOptions` | - | | `ChartEventKind` | Events overlay (ANALYSIS/06 §4.3): news, dividends, reports and alert facts anchored to bars. Markers snap forward to the first bar at or after the event time (`nearestIndexAtOrAfter` semantics, the lesson), events beyond the loaded data are skipped, and same-bar markers stack into lanes. | | `ChartEventRow` | - | | `ChartEventMarker` | - | | `EventMarkerOptions` | - | | `EventFilter` | - | | `EventHitLayout` | - | | `ContextMenuAction` | - | | `ContextMenuInput` | - | | `ContextMenuItem` | - | | `InteractionHost` | Everything the controller reads from the hosting chart. | | `InteractionControllerOptions` | - | | `PointerKind` | - | | `HoverState` | - | | `WheelOptions` | - | | `FollowOptions` | Auto-follow of the last bar and the elastic history edge (, ideas 40 and 33). | | `ViewWindow` | - | | `FollowInput` | - | | `FollowDecision` | - | | `ElasticPan` | - | | `GestureIntent` | Gesture intents: one table turns modifiers and pointer kinds into the action of the gesture, so hosts and the controller never duplicate the modifier logic. Pure data, no DOM. | | `GestureModifiers` | - | | `LongPressInput` | - | | `InteractionState` | Interaction state owned by the host shell. Reducers below are pure in the sense that they only mutate the passed time scale - the returned state is a new object, so hosts can store it in their own reactive store. | | `WheelLike` | - | | `GestureLike` | - | | `PriceWindow` | Visible price window a vertical gesture rescales. | | `ScaleDragOptions` | - | | `MarqueeRect` | Marquee selection in pixels (the host draws the rectangle). | | `NavDirection` | Keyboard navigation over drawings and layers (, idea 39). | | `NavItem` | - | | `ProCommandId` | - | | `ProShortcut` | - | | `ScaleClickOrderInput` | - | | `ScaleClickOrderResult` | - | | `InteractionCommand` | Keyboard map of §6: pure data, so hosts can display and remap it. | | `KineticOptions` | Kinetic scrolling: decaying pixel velocity for the time axis. The core keeps no timers - hosts advance `tick(dtMs)` from their frame loop and apply the returned pixel delta to the scale. Friction and the duration budget are explicit, so the stop moment is deterministic in tests. | | `KineticTick` | - | | `MinimapLayout` | Minimap geometry (ANALYSIS/06 §1.5): a density strip over the whole history with a draggable viewport window. Pure geometry: the host paints columns and moves the window; the model only maps indexes to pixels. | | `MinimapColumn` | - | | `MinimapWindow` | - | | `ReadoutModel` | - | | `ReadoutBuildOptions` | - | | `ReadoutInstrument` | Minimal instrument shape of the readout: hosts pass at least the symbol, the remaining fields refine the change base and the precision. | | `BarSelectionEvent` | Stream event of the selection ( follow-up). | | `SnapMode` | Where the cursor looks for a price: the whole bar, or one part of it. | | `SnapKind` | What a target is, used for the tie-break order and for the label. | | `SnapTarget` | - | | `SnapInput` | - | | `SnapResult` | - | | `LinkSelectionEvent` | LINK selection and drawing channels: in addition to the crosshair bus (`sdk/crosshair-link.ts`) a LINK group of windows can share the selected drawing object and apply drawing edits (upsert/remove). The bus is a pure model: members are injected, delivery skips the source window, repeated broadcasts of the same payload from one source are suppressed inside the echo window, drawing revisions order the edits (remove wins over a stale update) and a late joiner receives the current snapshot. | | `DrawingLinkOp` | - | | `LinkedWindow` | - | | `AuctionWindow` | - | | `AuctionConfig` | - | | `AuctionPhase` | - | | `AuctionBand` | - | | `AuctionCue` | - | | `Bar` | Core market data model: bars, ticks, instruments and timeframes. No DOM and no framework dependencies here. | | `TickSide` | - | | `Tick` | - | | `SessionSpec` | - | | `Instrument` | - | | `Timeframe` | 22 timeframes from a second to a month ( §2). | | `TradingCalendar` | - | | `SessionCalendarOptions` | : `dst: true` follows the US Eastern rules for the offset. | | `SessionPhase` | - | | `SessionBreak` | - | | `UpsertResult` | - | | `SessionRange` | - | | `AnomalyThresholds` | - | | `AnomalyOptions` | - | | `TapeFilters` | - | | `WallEventKind` | - | | `WallEvent` | - | | `AuctionCell` | One TPO cell: a price level visited during one time bucket. | | `BarProfileLevel` | - | | `BarProfile` | - | | `VwapPoint` | - | | `BookLevel` | Order book history heatmap (ANALYSIS/06 §3 heatmap): keeps a bounded history of depth snapshots and projects it into a price x time intensity grid for rendering. Memory is bounded by `maxColumns` (oldest columns are dropped) and `maxLevels` (largest levels win); the grid coarsens its step until the row count fits `maxRows`. | | `HeatmapLevel` | - | | `HeatmapColumn` | - | | `HeatmapGridOptions` | - | | `HeatmapRow` | - | | `HeatmapGrid` | - | | `BookHeatmapOptions` | - | | `DeltaRow` | Cumulative delta (ANALYSIS/06 §3.3, §2 extension): aggregates per-bar footprint deltas into a running curve and finds classic price/delta divergences on swing points. Pure model: no DOM, no timers. | | `DeltaPoint` | - | | `DeltaExtremes` | - | | `DeltaDivergence` | - | | `DeltaDivergenceOptions` | - | | `LadderRow` | - | | `LadderView` | - | | `TapeEntry` | - | | `TapeView` | - | | `LargePrintOptions` | - | | `LargePrint` | - | | `LargePrintReport` | - | | `PrintBucketRow` | - | | `TapeWindow` | One window of the tape: a half-open `[from, to)` interval with its counters. | | `ReplayLike` | The minimal replay surface the collector needs (MarketReplay satisfies it). | | `ReplayHeatmapOptions` | - | | `ReplayHeatmapGridOptions` | - | | `ReplayHeatmap` | - | | `RibbonSample` | One sampled book state: `imbalance` is -1..1 by contract, `depth` is size. | | `TileRange` | - | | `SmaAbiLayout` | WASM pilot (PRO wave, CHT-13-28): the ABI, the memory layout and two independent implementations of the moving average - the streaming kernel shaped after the planned WebAssembly module and the naive reference. Parity must hold bit-for-bit before a real binary is wired in. | | `SmaParityResult` | - | | `PanePrimitiveFrame` | - | | `PanePrimitivePainter` | - | | `PanePrimitiveOptions` | - | | `ProfileWindow` | Profile windows (FR-PROF-03/04, §4): the caller owns the calendar, the core slices bars by an inclusive [from..to] window, and the composite profile simply concatenates the sessions in order. | | `CompositeProfile` | - | | `ProfileCacheKey` | Profile cache (FR-PROF-05, §5): LRU of built profiles keyed by symbol, period, level count and mode. The key is stored as a nested map chain - no string is built per lookup (frame-path friendly). `invalidate` without a period drops everything; with a period it drops the entries of that period only. Stats are cumulative and survive `clear`. | | `ProfileCacheStats` | - | | `ProfileComparison` | Comparison of two profiles (FR-PROF-04, §4): the anchor levels (VAL, POC, VAH) of the left profile are matched against the right one within the common step; unmatched levels split into positive (above the shared pivot) and negative (below it). | | `FootprintTick` | Footprint clusters (FR-PROF-02, §2): tick level aggregation into bar x price cells with bid/ask sides, delta, imbalance flags and optional absorption. Ticks are idempotent by eventId, the cell budget is enforced with pruning of the oldest bars. | | `FootprintCell` | - | | `FootprintOptions` | - | | `FootprintState` | - | | `FootprintEvent` | Stream event of the footprint accumulator ( follow-up, event stage 5). | | `FootprintErrorEvent` | Stream event: malformed prints of a batch ( follow-up, event stage 7). | | `ProfileGridOptions` | Shared price grid of the profile family ( §1): levels from the low of the window, step rounded up to the instrument tick. Used by the volume, TPO and footprint profiles so every mode speaks the same level indices. | | `ProfileGrid` | - | | `UpdateProfileOptions` | Incremental profile patch (FR-PROF-05, §5): the forming bar is replaced without a full rebuild - its old contribution is subtracted and the new one added on the grid of the previous profile. The grid is extended by whole steps when the new bar leaves the previous range (the base moves down by whole steps, an upwards extension keeps the base), which keeps the band edges aligned: the result is identical to a full rebuild whenever the rebuild resolves the same grid. When the rebuild would shrink the range (the replaced bar owned an extreme) the patch keeps the wider grid and the host should rebuild instead. | | `ProfileLevelKind` | - | | `ProfileLineLevel` | - | | `WindowRange` | - | | `WindowProfileStats` | - | | `WindowProfileCacheOptions` | - | | `SessionValueArea` | - | | `ValueAreaMigration` | - | | `SessionHistory` | - | | `CompositeSessionResult` | - | | `SessionSlice` | - | | `SessionProfileEntry` | - | | `TpoForm` | TPO profile (FR-PROF-03, §3): one base bar paints one mark on every level it passed - the profile measures time, not volume. POC and the value area share the rules of the volume profile (tie to the lower level, VA expansion prefers the upper side). | | `TpoProfileOptions` | - | | `TpoLevel` | - | | `TpoProfile` | - | | `ProfileDistribution` | - | | `ProfileSpread` | - | | `VolumeProfileOptions` | - | | `ProfileLevel` | - | | `VolumeProfile` | - | | `AdaptiveDetailMode` | Text representation of one bar; candles are the richest, the line the cheapest. | | `BoxStats` | - | | `BulletSpec` | - | | `FanBand` | - | | `PortfolioPoint` | One candidate portfolio: risk (volatility) on X, expected return on Y. | | `AnalyticReadoutSeries` | One series the readout walks: samples sorted by `x`, optional labels. | | `AnalyticReadoutRow` | Nearest sample of one series at the cursor. | | `AnalyticReadout` | - | | `AnalyticPick` | Pick of a single sample; hosts turn it into selection events. | | `AnalyticWindow` | Visible domain of the analytic X axis. | | `NearestAnalyticPoint` | - | | `AnalyticPoint` | One analytic sample: a domain value on X and a value on Y. | | `AnalyticSeriesKind` | Kinds of the analytic series family ( §1). | | `AnalyticSeriesSpec` | Declarative description of one analytic series; painters read the same fields. | | `AnalyticStyle` | Per-call style of the painter functions; every field falls back to the theme. | | `AnalyticGradientFill` | Two-stop ramp of a band fill (S105): the box is the bounding box of the ribbon, so the ramp spans the whole band and never a single cell; the angle follows the look pack (0 - to the right, 90 - down by default). | | `AnalyticBarGradient` | Vertical ramp of the bar painter (S105): every bar keeps its role colour and its own box, the dense end sits at the tip of the bar and the tail fades to the baseline - never per cell. | | `AnalyticPaintInput` | - | | `WaterfallStep` | - | | `WaterfallSpan` | - | | `AxisLabelBox` | One candidate label of an axis: `centre` is the middle of its box in px. | | `ValueAxisLabelPlacement` | Where a value-axis label sits: `x` is the text start, `align` the canvas text alignment of the paint call, `null` means the label is dropped. | | `BackendId` | - | | `BackendPreference` | - | | `RenderBackend` | - | | `BackendFactory` | Creates a backend or reports that it is unavailable. The host owns context creation, so the core still never touches the DOM. | | `RendererChangedEvent` | - | | `RendererEventMap` | - | | `ChartRendererOptions` | - | | `BodyBox` | Rectangle of one body in plot pixels. | | `VapRow` | One VAP row: a horizontal bar at the price level, `share` of the widest one. | | `Canvas2DLike` | Minimal surface of CanvasRenderingContext2D used by the renderer and the series/layer code. Declared locally so the core has no DOM dependency in typing and can be exercised by a fake context in tests. | | `RenderInput` | - | | `RenderStats` | - | | `CompareOverlayPoint` | - | | `CompareOverlaySeries` | - | | `CompareOverlayData` | - | | `CompareOverlayPaintInput` | - | | `CrosshairState` | Crosshair state: which pane and bar the pointer points at ( §3, §6). The model is intentionally free of pixels so hosts can sync panes. | | `TooltipRow` | - | | `CrosshairResult` | - | | `TooltipBoxInput` | - | | `TooltipBox` | - | | `CellPulse` | - | | `DataWindowGroup` | - | | `DataWindowTone` | - | | `DataWindowRow` | - | | `DataWindowBookLevel` | - | | `DataWindowExt` | Optional extended sources of the row under the cursor. | | `BuildDataWindowOptions` | - | | `DataWindowModel` | - | | `DeltaBarMode` | Modes of the delta reading on the candle. | | `Rect` | Dirty region tracking and partial repaint support (§7.2). The tracker is dumb on purpose: it accumulates rectangles, merges overlaps and falls back to a full frame when the region budget is exceeded. | | `EventLaneItem` | - | | `EventLaneInput` | Frame option of the lane: the markers of the window and the badge overrides. | | `EventLaneCardRow` | One row of the event card: label on the left, value on the right. | | `EventLaneCard` | Detail card of a badge: title, rows and an optional action label. | | `EventLaneGeometry` | Geometry of the lane band; shared by the painter and the hit test. | | `EventLaneLayoutInput` | - | | `LaneItemsCache` | Memo of the lane layout ( follow-up): a dense corporate calendar would be re-laid out on every frame and on every pointer move otherwise. The cache compares the markers by identity plus the view numbers, so pan, zoom and new data invalidate it while hovering does not. | | `EventLanePaintInput` | - | | `GradientBox` | - | | `GradientOptions` | - | | `GridStyle` | - | | `GridPeriod` | - | | `CandleHeatmapCell` | One screener cell: an instrument, a period and the period change. | | `AuctionPaintInput` | - | | `HeatmapPalette` | Tone colours of one grid, resolved once per paint. | | `HeatmapTone` | Colour ramp of a heatmap; `diverging` reads a signed intensity. | | `HeatmapRowLike` | One grid row: an optional label (price, year) and its cell values. | | `HeatmapGridLike` | Normalised matrix every heatmap source maps onto. | | `HeatmapPaintInput` | - | | `FadeRect` | - | | `LegendInput` | - | | `LegendTitle` | Heading of the legend row: the ticker, its timeframe and its exchange. | | `LegendPaintInput` | - | | `LegendTone` | Tone of one legend segment: `muted` labels, `text` plain values. | | `LegendSegment` | - | | `LevelLineInput` | - | | `BackdropStyle` | Backdrop of the background layer: flat fill, soft gradient or an accent glow. | | `ReadoutSkin` | Readout strip skin: plain columns, chips or value cards. | | `ChartLookInput` | - | | `ResolvedLook` | - | | `ResolvedChartGradient` | - | | `MeasureInput` | - | | `MeasureDelta` | - | | `MeasureChrome` | - | | `MeasurePaintInput` | - | | `MiniFigureInput` | Box a mini figure draws into; the host owns the pixels. | | `MiniFigureStyle` | Per-call style; every field falls back to the theme. | | `MiniFigureId` | Ids of the built-in mini figures. | | `MiniFigureInfo` | One entry of the figure catalogue: id, human title and what it answers. | | `IvMatrixInput` | Implied volatility of one option: the row of a smile, cell by cell. | | `SquareMatrixInput` | Square symmetric matrix (correlation of the members of a book). | | `LimitBarInput` | Utilisation of one limit: what is used, the ceiling and where the breach starts. | | `ScenarioConeInput` | Scenario cone of a horizon: the value of the host today and the band around it. | | `DrawingGhostStyle` | - | | `DrawingAppearStyle` | - | | `ZoomAnimation` | An eased zoom between two bar spacings (CHT-15-08). The core never runs timers: hosts advance `elapsedMs` (wall clock or rAF) and read `spacingAt`. | | `OrderbookChartVariant` | - | | `OrderbookChartInput` | - | | `OrderbookViewInput` | - | | `OrderbookViewLevel` | - | | `OrderbookView` | - | | `LineOverlay` | Host-provided line overlays (PRO wave): indicator curves (moving averages, VWAP, Bollinger bands) and level lines painted by the series layer over the price pane. Values are aligned to bars by index: `null` breaks the polyline, a gap is never bridged. The core paints, the host computes - the same contract as every other layer. | | `OverlayPaintInput` | - | | `PerformanceGuardOptions` | Frame budget guard (§7.1). Three frames over budget in a row switch the chart to the economy mode (no grid); a single frame inside the budget resets it. The rule is deliberately simple and testable. | | `VisualPolish` | - | | `ChartPriceLine` | - | | `LockGlyph` | - | | `PriceLineTagBoxInput` | - | | `PriceLineTagBox` | - | | `PriceLinePaintInput` | - | | `ReadoutOptions` | - | | `ReadoutColumn` | - | | `ReadoutRow` | - | | `ReadoutStripInput` | - | | `ReadoutPaintLayout` | - | | `AttributionRow` | - | | `MonteCarloSpec` | - | | `MonteCarloBands` | - | | `MonteCarloJob` | Flat, transferable cone: the same simulation in typed arrays, so a host can run it in a worker and hand the buffers over without a per-point copy (`monteCarloJobTransferables`). The painter consumes the point form, built once per result with `coneFromJob`. | | `SeriesRenderType` | Series render types. The first wave ( §5): candles, outlineCandles, bars, line, area, histogram, step, baseline. adds the PRO pair: the footprint cluster grid and the four non-standard looks (renko, kagi, pointAndFigure, lineBreak) fed by the `data/non-standard` builders. adds the analytic four: volumeCandles, lineWithMarkers, hlcArea, highLow. | | `FootprintPaintData` | Footprint cluster data attached by the host; bars are indexes of the series. | | `SeriesPaintInput` | - | | `SeriesTypeDefinition` | - | | `VisibleSlice` | - | | `SeriesPainterInput` | Everything a painter needs to draw one frame of its window. | | `SeriesPainter` | - | | `TimePriceCell` | - | | `TimePriceHeatmapData` | - | | `GhostPaintData` | Ghost series of the previous period, aligned to the current one. | | `SparkParticle` | - | | `SparksState` | - | | `SparkStyleName` | Named spark bursts: ten presets a host picks per chart. | | `SparkStyle` | - | | `SplinePoint` | Monotone spline points (, idea 14): the smoothed curve of the `spline` series. The interpolation is the Fritsch-Carlson monotone cubic - unlike the classic Catmull-Rom it never leaves the span of the neighbouring points, so a smoothed price chart cannot show a price that was never traded. | | `SplineOptions` | - | | `ChartStateKind` | - | | `ChartStateInput` | - | | `ChartStatePaintInput` | - | | `TextMetricsLike` | Text measurement cache. Axis chips and tooltip rows measure the same strings every frame; the cache keeps the last N measurements and drops the oldest entries first (Map keeps insertion order). | | `TextCacheStats` | - | | `ChartTheme` | Chart theme. Colors are never hardcoded in layers: they come from the shell tokens (`--ud-*`) of the Desktop Kit or from the built-in defaults below ( §1). | | `ThemeName` | Names of the selectable palettes plus the `system` alias. | | `BuiltInThemeName` | Names of the six palettes the library ships, in menu order. | | `BarPaletteName` | Bar palettes of the look pack: `classic` keeps the theme up/down. | | `BarPalette` | - | | `VolumeToneName` | Volume tone of the look pack: how the columns read against the series. | | `VolumeTone` | - | | `MotionPolicy` | - | | `TokenResolver` | - | | `VolumeLayerInput` | - | | `VolumePaintInput` | - | | `WatermarkLine` | - | | `WatermarkImage` | Host image of the watermark (white label): an opaque canvas source with its size in CSS pixels. The core never touches the DOM - it only forwards the source to `drawImage`, so any host image type works. | | `WatermarkPosition` | Where a watermark sits: the plot centre or the bottom-left corner. | | `Rgba` | - | | `ClipTransform` | CPU geometry builders for the WebGL2 backend. Everything is produced in clip space (-1..1, y up) so the vertex shader stays a pass-through; the builders mirror the canvas2d pixel math, which is what makes the parity check meaningful. | | `PlotGeometryContext` | - | | `CandleGeometry` | - | | `BarsGeometry` | - | | `WebGL2Like` | Minimal WebGL2 surface used by the backend. Declared locally so the core keeps no DOM dependency: hosts pass a real WebGL2RenderingContext, tests pass a recording fake. | | `FlatProgram` | - | | `WorkerMessage` | Worker render bridge (PRO wave, CHT-13-27): the message protocol and the controller of off-main-thread painting over an injected port. The library never creates the worker itself - the host owns the worker file, the OffscreenCanvas transfer and the lite switch; the bridge keeps the sequencing (init, paint with ack, dispose) and the deterministic fallback. | | `RenderPort` | - | | `WorkerRenderOptions` | - | | `RenderMode` | - | | `WorkerRenderState` | - | | `WorkerRender` | - | | `ReplayParseOptions` | - | | `ReplayParseResult` | - | | `ReplaySpeed` | - | | `ReplayOptions` | - | | `ReplayEngineEvent` | Stream events of the replay engine ( follow-up, event stage 4). | | `MarketReplayRecord` | - | | `MarketReplayOptions` | - | | `MarketReplayState` | - | | `RecordSessionOptions` | - | | `AxisFormatter` | Non-time X axis (§1): numeric and categorical scales for analytic series whose domain is not a bar index - yield curves, payoff diagrams, open interest by strike. Degenerate domains never divide by zero: a flat numeric domain widens by one unit per side, a zero-width axis maps every value to the zero pixel. | | `AxisTick` | A laid out axis tick: the domain value, its pixel position and label. | | `NumericAxisOptions` | - | | `CategoryAxisOptions` | - | | `AnalyticXAxis` | Common surface of the analytic X axes; painters read only this block. | | `PeriodPreset` | Period presets (ANALYSIS/06 §1.6): maps 1D/1W/1M/YTD/ALL buttons to a bar index range. The calendar is anchored to the last bar time (or an injected anchor) and uses UTC days - the host calendar/session layer stays authoritative for exchange-local boundaries. | | `PeriodRange` | - | | `PriceScaleMode` | - | | `PriceScaleOptions` | - | | `PriceRange` | - | | `PriceTick` | - | | `ScaleModeHint` | - | | `ScaleModeChoice` | - | | `TimeMapping` | Positional data of the axis: time to pixel and back. | | `ScaleModeInput` | - | | `FutureExtent` | - | | `TickMarkType` | Granularity of a time label; `price` marks value-axis labels. | | `TickMarkContext` | - | | `TickMarkFormatter` | User label of one tick; null hides the tick, exceptions fall back. | | `TimeGap` | - | | `GapOptions` | - | | `AxisLabel` | - | | `AxisMarker` | - | | `CompressionInput` | - | | `TimeCompression` | - | | `AxisRowsInput` | - | | `TimeScaleOptions` | - | | `VisibleRange` | Visible window in bar indexes (fractional while panning). | | `RenderProfile` | Render profiles decide which layers are active ( §4): `sparkline` - dashboards, no grid, axes or crosshair; `mini` - small chart with axes; `standard` - the portal chart; `terminal` - the desktop shell. | | `LayerId` | Layer identifiers and the canonical paint order of §4. Orders are spaced by ten so hosts can insert their own layers later. | | `FrameContext` | Everything a layer needs to paint one frame. | | `SceneLayer` | - | | `SceneStats` | - | | `SceneType` | - | | `SceneOptions` | - | | `SceneProfileSummary` | - | | `KeyboardBinding` | - | | `KeyModifiers` | - | | `ChartAriaDescriptor` | - | | `ChartAria` | - | | `PaletteCommand` | Command palette model (PRO feature 1.3): a pure ranking function over host-provided commands. The core never touches the DOM or key events here - the host collects its commands, passes the typed query and renders the list. | | `ScoredCommand` | - | | `BarRef` | - | | `ComparisonDelta` | - | | `BarPairComparison` | - | | `ConfigTheme` | Palette names of the declarative config: the six registries of §1 plus the white-label `brand` entry, which the host resolves from tokens. | | `ChartPaneConfig` | - | | `ChartIndicatorConfig` | - | | `ChartConfig` | - | | `ParsedChartConfig` | - | | `LinkedCrosshairChart` | - | | `DiagnosticsSeries` | Diagnostics snapshot (NFR-OPS-04): a compact state image for error reports - series sizes, panel layout, caches, connection and renderer status plus the version. Personal data never leaves: keys that look like a token, secret, password, credential, session or an API key are cut out at any nesting level, deep structures are truncated. | | `DiagnosticsPanel` | - | | `DiagnosticsInput` | - | | `CrosshairPoint` | - | | `CrosshairMoveEvent` | - | | `CrosshairLeaveEvent` | The pointer left the plot area; the crosshair is hidden. | | `CrosshairPinEvent` | - | | `BarClickEvent` | - | | `InteractionEventName` | - | | `InteractionEvent` | - | | `LocaleCode` | Core locale pack (FR-SDK-06, §2): the strings of the core UI plus deterministic number and date formatting for RU, EN, UZ and KZ. Formatting is implemented locally (no Intl dependency) so the output never drifts with the host ICU version: RU/UZ/KZ group with a space and a comma decimal, EN groups with a comma and a dot decimal. | | `LocalePack` | - | | `PdfSignatureSlot` | PDF signature slots ( follow-up "crypto signature of PDF reports"): the platform owns the signing keys and the trust chain, the library owns the document mechanics - a reserved detached signature field appended as a PDF incremental update with a proper `/ByteRange`, so the signed bytes and the verified digest are stable and reproducible. Crypto (hashing, signing, verification) is injected: the core never touches environment globals. | | `PdfSignatureReserveOptions` | - | | `ReadPdfSignature` | - | | `ChartPdfMeta` | PDF export (PRO wave, CHT-13-24): a deterministic single-page PDF with the chart snapshot as a JPEG image - written by the library itself, no third-party PDF writer. The output is byte-stable for the same inputs (the timestamp is injected), so signed reports keep reproducible hashes. | | `ApiStability` | Public API registry (FR-SDK-09, §9): the stability map of the `@unifin/chart-core` exports. The registry is derived from the real `index.ts` source - `buildApiRegistry` parses the re-export blocks, so the stability map can never drift from the published surface; the test compares the derivation with the runtime namespace in both directions. | | `ApiKind` | - | | `ApiRegistryEntry` | - | | `ApiEventEntry` | - | | `ShortLinkPort` | - | | `ShortLinkService` | - | | `ShareStore` | Share store seam: the platform stores an opaque payload server-side and hands back a short code (`uf1:`); hosts with a backend inject their HTTP transport, hosts without one get a deterministic in-memory store with TTL. The drawing codec (`C1.`) and the chart-config links (`S1.`, sdk/share-link.ts) keep their formats - this seam serves arbitrary payloads and adds the idempotent-put and collision rules. | | `MemoryShareStoreOptions` | - | | `TableRowRef` | One row of a table, as the chart side sees it. | | `TableLinkEvent` | Direction of a published reference. | | `TableChartLinkOptions` | - | | `TableChartLink` | - | | `WorkspaceMeta` | Workspace library (PRO feature 1.1): named layouts over the chart snapshot of the host. Storage-agnostic and DOM-free - the host persists the exported JSON wherever it wants (localStorage, server, file). Time comes from an injected clock, so tests and reports stay deterministic. | | `WorkspaceRecord` | - | | `WorkspaceLibraryOptions` | - | | `WorkspaceLibraryEvent` | Stream event of the workspace library ( follow-up, event stage 3). | | `PaperStrategy` | - | | `PaperRunResult` | - | | `CategorySummary` | - | | `Preset` | - | | `CatalogSnapshot` | - | | `ComparisonNormalization` | - | | `ComparisonInput` | One instrument in a comparison panel ( §4, FR-DATA-09). | | `ComparisonOptions` | - | | `ComparisonSeriesModel` | - | | `ComparisonModel` | - | | `LegendOutputValue` | - | | `LegendRow` | - | | `LegendOptions` | - | | `IndicatorCategory` | Study model ( §1): one contract for core, catalogue and future plugins. A definition never touches DOM, network or storage; it only reads bars and parameters and writes numeric outputs aligned to the bars array. * Parameters arrive as a plain record: helpers below read them defensively, so a broken setting degrades one indicator instead of breaking the layer. | | `IndicatorPlacement` | - | | `InputKind` | - | | `IndicatorInput` | - | | `OutputKind` | - | | `OutputStyle` | - | | `IndicatorOutput` | - | | `ReferenceLevel` | - | | `StudyParameters` | Everything a calculation may read and write: no other ambient state. | | `StudyState` | - | | `StudyContext` | Everything a calculation may read and write: no other ambient state. | | `IndicatorDefinition` | - | | `IndicatorDefinitionProblem` | - | | `PluginLicense` | Plugin contract ( §1): a third party extends the catalogue without forking it. Installation is atomic and gated: source, licence and every definition are checked before anything reaches the registry. | | `IndicatorPlugin` | - | | `EngineOptions` | - | | `EngineStats` | - | | `IndicatorEngineEvent` | Stream events of the indicator engine ( follow-up, event stage 6). | | `IndicatorInstance` | - | | `SchedulerTaskOptions` | - | | `SchedulerHandle` | - | | `FrameSchedulerOptions` | - | | `WorkerLike` | Worker transport stays outside the core: the host injects a factory over its real Worker (browser) or worker_threads (Node), the pool only speaks messages. | | `WorkerFactory` | - | | `WorkerPoolOptions` | - | | `WorkerTask` | - | | `TemplatePayload` | - | | `TemplateRecord` | - | | `TemplateCatalog` | - | | `FibonacciLevel` | - | | `TradingAdapter` | Trading adapter contract ( §6, NFR-SEC-01): the ONLY way out of the library towards the trading contour. The host implements it over the BFF of the portal; the core never holds tokens and never talks to a brokerage API directly. Errors travel as `TradingException` with a typed kind. | | `BracketLevelId` | - | | `BracketPlanIdentity` | - | | `BracketLayerOptions` | - | | `BracketLevelVersion` | - | | `BracketGeometryLine` | - | | `BracketGeometryZone` | - | | `BracketGeometry` | - | | `BracketPlan` | - | | `BracketDistances` | - | | `BracketStatus` | - | | `BracketEvent` | - | | `BracketOutcome` | - | | `BracketSeamOptions` | - | | `OrderTypeSpec` | Order catalogue (FR-TRADE-01, §1): exactly the six types of `trading-ms` with their panel fields. The library never extends the catalogue on its own - a new type appears in the platform first. | | `ConfirmationThresholds` | - | | `ConfirmationInput` | - | | `ConfirmationDecision` | - | | `ConfirmationOptions` | - | | `TradeLineBounds` | Trading line drags (CHT-16-06): the pure half of "drag the stop, take or order line on the chart". The core maps pointer pixels to prices, snaps to the instrument tick and clamps into the allowed band; the host owns the pointer events, the journal (`StopManager`) and the redraw. | | `TradeLineLike` | Any horizontal trading line a pointer can grab (stop, take, order). | | `TradeLineHit` | - | | `DragPriceInput` | - | | `AccessDecision` | Role and mode gates (FR-TRADE-06/07, §5): orders are created by TRADER and PARTICIPANT only; OPERATOR and COMPLIANCE watch and export; `readOnly` blocks everyone. The gates are pure - the host calls them BEFORE touching the adapter, so a forbidden action never reaches the BFF. | | `OrderRecord` | Trading journal ( §7): orders may reference the alert that fired, trades reference their order - `chain(alertId)` resolves the product story "fired -> acted -> executed". A trade without a known order is rejected, so the chain never starts in the middle. | | `TradeRecord` | - | | `TradeChain` | - | | `OrderSide` | Trading layer model (FR-TRADE-01/06/07, §1/§5/§6): the order catalogue of `trading-ms` stays exactly six types, roles and modes follow the platform, and the library never talks to a brokerage API itself - the host wires a `TradingAdapter` behind the BFF (NFR-SEC-01). | | `OrderType` | - | | `TradingMode` | - | | `TradingRole` | - | | `OrderStatus` | - | | `TradingErrorKind` | - | | `OrderRequest` | - | | `OrderResult` | - | | `AccountSnapshot` | - | | `OrderPreview` | - | | `StopModifyRequest` | - | | `OrderUpdate` | - | | `PositionUpdate` | - | | `TradingUnsubscribe` | - | | `OrderLineVersion` | Order lines on the chart ( follow-up, closing CHT-16-06): a pending order is a horizontal line the trader drags to a new price - the platform order is modified by the host, the library only keeps the current price per line id and the version journal (who, when, was, became). A drag over N steps writes N records - one per step - and the last record is the final level, matching the stop journal (`FR-TRADE-04`). The host owns the pointer events, the redraw and the platform call. | | `OrderLineManagerOptions` | - | | `OrderLineMeta` | - | | `OrderLineState` | - | | `OverlayLine` | Trading objects on the chart (FR-TRADE-05/07, §4/§5): the model projects the trading state into render-agnostic structures - stop/take lines, the position zone and the entry/order/trade markers. The host draws them; the core only decides what exists and in which order (time, then entry before order before trade on equal times). | | `OverlayZone` | - | | `OverlayMarker` | - | | `OverlayOrderInput` | - | | `OverlayTradeInput` | - | | `TradingOverlayInput` | - | | `TradingOverlay` | - | | `PaperSessionReport` | - | | `PaperKpiInput` | - | | `PaperKpi` | - | | `PaperSide` | Paper trading (PRO feature 2.3): a pure virtual broker for replay sessions. Market orders fill immediately at the given price; limit orders rest as working and fill when the tape crosses them. Positions average on increases and realize PnL on reductions; no platform calls are made. | | `PaperOrderType` | - | | `PaperOrderInput` | - | | `PaperOrder` | - | | `PaperFill` | - | | `PaperTrade` | - | | `PaperAccountState` | - | | `PaperBrokerOptions` | - | | `PaperBrokerEvent` | Stream events of the paper broker ( follow-up, event stage 3). | | `Fill` | Position tracking (FR-TRADE-05, §4): fills open, add to, reduce and flip the position; the average price follows the actual fills and the realised P&L is accumulated on the closing part of every opposite fill. Unrealised P&L is `(last - average) * size`, zero for a flat position. | | `PositionState` | - | | `PreviewContext` | Order preview (FR-TRADE-02, §2): the client-side estimate of the panel - notional, commission, required margin and the free remainder after the order. The reference price is the order price, the trigger price or the last market price in this order. The BFF preview of the adapter stays the source of truth; the deviation is a host concern. | | `RiskInput` | Risk ruler (FR-TRADE-03, §3): the numbers shown on the chart and in the order panel before the confirmation - risk per unit, risk amount and its share of the capital, the side-aware potential, R:R and the day limit usage. The day limit itself comes from the BFF; the library only compares. Zero risk is a valid case (R:R stays null), the potential of a take on the wrong side is negative - both are product states, not errors. | | `RiskMetrics` | - | | `StopVersion` | Stop and take management (FR-TRADE-04, §4): every drag writes a full version into the journal (who, when, was, became). A drag over N steps produces N records - one per step - and the last record is the final level. | | `StopManagerOptions` | - | | `StopMeta` | - | | `TicketState` | Order panel pipeline (FR-TRADE-02/06/07, §2/§5): draft -> gates -> validation -> preview -> submit -> accepted / rejected / partially filled / filled. The gates run BEFORE the adapter, so a forbidden role, the readOnly mode, an incomplete request or a local shortage of funds never send anything (the negative tests count the adapter calls). Errors of the adapter arrive as `TradingException` and leave the pipeline in `rejected` with the kind. | | `TicketOutcome` | - | | `TicketOptions` | - | | `PaneOptions` | - | | `PaneRect` | - | | `VolumePaneOptions` | Options of the ready-made volume pane preset (P3). | ## Constants (197) | Symbol | What it does | | --- | --- | | `CANDLE_PATTERN_TITLES` | - | | `CANDLE_PATTERN_TITLES_KZ` | - | | `ALERT_CONDITION_META` | Registry of the twelve conditions, ALT ids follow §1. | | `ALERT_SEVERITIES` | - | | `ALERT_CHANNELS` | - | | `ALERT_RULE_TYPES` | - | | `DEFAULT_ALERT_TEMPLATES` | Default templates of the product (no personal data in either language). | | `AUTO_FIB_RATIOS` | Ratios shown by the automatic retracement: the impulse ends are the line itself. | | `COMPARISON_TABLE_LIMIT` | - | | `DIVERGENCE_LOOKBACK` | - | | `DIVERGENCE_MAX_PAIRS` | - | | `DIVERGENCE_MIN_STRENGTH` | - | | `RS_WINDOW_POINTS` | Points of the window the change of the ratio is measured over. | | `LEVEL_PERIOD_MS` | Length of a period in milliseconds: the same convention as `scale/periods`. | | `SWING_LOOKBACK` | Bars on each side of a pivot; the classic five-bar fractal. | | `IMPULSE_ATR_SHARE` | Share of the ATR an impulse has to cover to count as significant. | | `EVENT_CLUSTER_GAP_PX` | Default screen gap below which markers merge into a numbered group. | | `PAND_F_BOX_ATR_SHARE` | Share of the volatility that one box covers; a classic starting point. | | `PAND_F_MIN_REVERSAL` | Reversal columns needed to switch direction; two is the minimum that works. | | `PAND_F_RANGE_PERIOD` | Period of the fallback average range when the host brings no ATR. | | `DRAWING_HISTORY_LIMIT` | Default history limit: fifty steps, §2. Hosts override it through the constructor argument - the panel reads the value back (`history.limit`), so one number is shown and enforced. | | `CUSTOM_TOOL_LIMIT` | - | | `FILL_PATTERNS` | The registry: fifteen samples, the first four are the canonical set. | | `FILL_PATTERN_IDS` | Ids of the registry, in the display order (the API grows additively). | | `DEFAULT_FILL_PATTERN` | Pattern of a legacy style that never named one: the flat alpha fill. | | `POINT_MARKER_RADIUS` | Radius of the edit point markers ( §2); exported for custom tools. | | `HIT_TOLERANCE` | - | | `DRAWING_POINT_LIMIT` | - | | `MEASURE_LIMIT` | Points kept at once; beyond it the set refuses the click instead of forgetting. | | `EMPTY_MEASURE_SET` | - | | `PALETTE_RECENT_LIMIT` | Cap of the recent-tools list of the palette rail. | | `PALETTE_STATE_INITIAL` | - | | `DRAWING_LAYER_BUDGET_MS` | Frame budget for one layer rebuild, ms (ANALYSIS/03-NFR.md, §3). | | `DRAWING_SCHEMA_VERSION` | Drawing snapshots and templates ( §4): a versioned JSON envelope with tolerant parsing - unknown fields are ignored, damaged objects are dropped with a message. Share payloads are encoded with a self contained base64 so the core stays environment agnostic (no btoa, no Buffer). | | `SHARE_COMPACT_PREFIX` | Prefix of the compressed share payloads; the legacy format has none. | | `STYLE_LIBRARY_LIMIT` | - | | `DRAWING_STYLE_STARTERS` | Starter sets: one canonical look per key tool class (idempotent load). | | `TEMPLATE_COMMAND_PREFIX` | Palette commands of the stored templates (PRO wave closure, CHT-13-04: "templates as commands"): the host ranks them with the other commands and calls `TemplateLibrary.apply` on the picked id. Command ids are prefixed, so they never collide with the built-in palette entries. | | `DRAWING_TOOLS` | - | | `CONTEXT_MENU_ACTIONS` | Context menu model (AUD-003, §6): the core supplies the item list and the enabled rules, the host renders and positions the menu and performs the actions. The canon items are bar values, add alert, add tool, reset scale and a PNG snapshot; titles come from the RU/EN locale pack. | | `EDGE_RESISTANCE` | Default elastic resistance of the history edge, in share of the requested shift. | | `EDGE_MAX_OVERSHOOT_PX` | Hard cap of the elastic overshoot, in pixels. | | `EDGE_RELEASE_FACTOR` | Share of the remaining overshoot returned per frame; small enough to read. | | `LONG_PRESS_MS` | Long-press timing of §6: hold without movement opens the menu. | | `LONG_PRESS_SLOP_PX` | - | | `INITIAL_INTERACTION_STATE` | - | | `WHEEL_ZOOM_SPEED` | Wheel sensitivity: factor = exp(-deltaY * speed). | | `MARQUEE_MIN_PX` | A marquee narrower than this is a click, not a zoom. | | `NAV_KEYS` | Keys a keyboard-first host binds; Tab walks, Home/End jump. | | `PRO_KEYMAP` | - | | `KEY_COMMANDS` | - | | `HANDLED_KEYS` | Keys the chart consumes; the host uses the list to call preventDefault. | | `SNAP_TOLERANCE_PX` | Default pull radius, in pixels. | | `SNAP_PRIORITY` | Tie-break order at an equal distance: a session level outranks a bar value, a bar value outranks a plain line, a round price comes next and a shape edge is last (it is the least meaningful of the five). | | `TOOLTIP_HOLD_MS` | Default hold of the hover card after the pointer leaves: five seconds. | | `TOOLTIP_HOLD_MAX_MS` | Upper bound of the hold window (a card must never stick forever). | | `TIMEFRAMES` | - | | `ANOMALY_DEFAULT_SHARE` | Share of the tape that belongs to the "large" tail by default. | | `AUCTION_DEFAULT_STEP` | Fallback row height when the cells carry no usable price range. | | `TAPE_DEFAULT_WINDOW_MS` | Default span of one window; the tape reads at second granularity. | | `TAPE_DEFAULT_COUNT` | Default number of windows returned; the newest window comes last. | | `RIBBON_INTENSITY_MAX` | The imbalance is bounded by construction, so the diverging scale is 1. | | `WASM_PILOT_EXPORTS` | Required export names of the future module (checked before wiring it in). | | `LIVE_PROFILE_WINDOW_MAX` | Upper bound of the window the cache accepts, in bars. | | `SESSION_HISTORY_MAX` | Sessions kept in the history, newest last. | | `PROFILE_BUDGET_P50_MS` | Cold day profile budget of 260 000 bars, ms (NFR-PERF-05, §5). | | `PROFILE_BUDGET_P99_MS` | - | | `ADAPTIVE_CANDLE_MIN_SPACING` | At or above this many pixels per bar the chart keeps the candles. | | `ADAPTIVE_LINE_MAX_SPACING` | At or below this many pixels per bar the chart drops to the close line. | | `ADAPTIVE_RIBBON_HEIGHT` | Height of the direction band of the ribbon mode, pixels. | | `ADAPTIVE_STRIP_HEIGHT` | Height of the direction strip under the close line, pixels. | | `BOX_IQR_FACTOR` | Interquartile factor of the whiskers (Tukey). | | `FAN_BAND_ALPHA` | Alpha of the widest band; narrower bands step up towards the median. | | `FAN_BAND_ALPHA_STEP` | - | | `FRONTIER_POINT_RADIUS` | Candidate dot radius; the current portfolio gets a larger marker. | | `FRONTIER_CURRENT_RADIUS` | - | | `FRONTIER_EPSILON` | Cross-product tolerance of the hull test. A candidate that sits on the segment of its neighbours turns by less than this and is dropped, so a straight run of candidates reduces to its two ends even though floating point rarely produces an exact zero. | | `ANALYTIC_WINDOW_MIN_SHARE` | The window never shrinks below this share of the full domain. | | `ANALYTIC_CLIP_MARGIN` | Pixels of margin kept around the plot; samples outside are skipped. | | `AXIS_LABEL_GAP` | Free space kept between two label boxes, px (portal density, §4). | | `MAX_TIME_LABELS` | Time labels asked for at most: the axis stays a ruler, not a wall of text. | | `MAX_PRICE_LABELS` | Value labels asked for at most (the pane height thins them further). | | `VAP_MIN_BODY_WIDTH` | Smallest body width in pixels that still carries readable VAP rows. | | `VAP_MAX_LEVELS` | Rows per bar: the biggest levels survive the cap, the rest is dropped. | | `VAP_ROW_ALPHA` | Alpha of the VAP rows: readable over the body, never louder than it. | | `BODY_DEPTH_MIN_ALPHA` | Depth shade of the emptiest bar and of the densest one (idea 1). | | `BODY_DEPTH_MAX_ALPHA` | - | | `MORPH_DURATION_MS` | Length of the fold; the host may pass its own, the policy keeps the default. | | `COMPARE_OVERLAY_LIMIT` | Series a reader can still tell apart on one plot. | | `COMPARE_MAX_POINTS_PER_SERIES` | Points drawn per series at most. The window of a zoomed-out chart can hold a hundred thousand points: the painter walks them in even steps instead of mapping every one (the S7/ lesson - a per-point pass over the whole series is what blows a frame, not the drawing). | | `COMPARE_BASELINE` | Base of the rebasing; the comparison table of uses the same one. | | `HIDDEN_CROSSHAIR` | - | | `DATA_FLASH_MS` | Decay of a live-data highlight ( motion policy, ladder 160 ms). | | `BAR_FLASH_PEAK` | Peak alpha of the last-bar update highlight. | | `ALERT_FLASH_PEAK` | Peak alpha of the alert row flash. | | `DELTA_BACKGROUND_ALPHA` | Alpha of the background tint: present but never louder than the body. | | `EVENT_GLYPHS` | Letters of the badges; hosts may override any of them. | | `EVENT_LANE_HEIGHT` | - | | `EVENT_BADGE_SIZE` | - | | `EVENT_MIN_GAP` | Badges closer than this collapse into the leftmost one. | | `GRADIENT_DEFAULT_ANGLE` | Default direction: top to bottom. | | `GRADIENT_MAX_PHASE` | Longest distance a phase shift may move the ramp, as a share of the box. | | `GRID_PERIODS` | - | | `HEATMAP_TONES` | - | | `HEATMAP_MAX_ALPHA` | Intensity-to-alpha ceiling; keeps the palette colours readable. | | `HEATMAP_MIN_INTENSITY` | A cell below this intensity is not painted (keeps the frame cheap). | | `LEFT_FADE_SHARE` | Share of the plot width the fade covers when the host asks for `true`. | | `LEFT_FADE_MAX` | Widest fade the option accepts; a full cover would hide the data. | | `LEGEND_MIN_WIDTH` | Panes narrower than this hide the legend row entirely. | | `LEGEND_TOGGLE_SIZE` | Side of the collapse chevron. | | `GRADIENT_TAIL_SHARE` | Default share of the body and volume gradients (47-104). | | `CHART_GRADIENT_ANGLE` | Default direction of the chart background gradient: top to bottom. | | `MINI_FIGURES` | Catalogue of the mini figures, in the order a page shows them. | | `ZOOM_STEP_MS` | Default zoom step duration of motion policy. | | `MARKER_APPEAR_MS` | Rising marker envelope: scale 0.6 -> 1 and alpha 0 -> 1 over 140 ms. | | `DRAWING_GHOST_MS` | Ghost envelope of an object being placed or dragged. | | `FLASH_DECAY_MS` | Fast decay of the new-bar flash over 160 ms (1 -> 0). | | `CROSSFADE_MS` | Crossfade window of a timeframe swap (CHT-15-08). | | `ORDERBOOK_CHART_VARIANTS` | - | | `AREA_GRADIENT_TOP_ALPHA` | Area gradient: 8 percent at the line, zero at the bottom (item 5). | | `PRICE_LINE_ACTIVE_WIDTH` | Widest stroke of an active line, in pixels. | | `PRICE_LINE_IDLE_ALPHA` | - | | `READOUT_LINE_HEIGHT` | - | | `READOUT_ROW_HEIGHT` | - | | `READOUT_PADDING` | - | | `CORRELATION_MAX` | Correlation is bounded by definition, so the diverging scale is 1. | | `MONTE_CARLO_PATH_LIMIT` | Upper bound on the simulated paths; a bigger request is clamped, not refused. | | `MONTE_CARLO_DEFAULT_PATHS` | Default path count of a cone that stays inside the frame budget. | | `MONTE_CARLO_LEVELS` | Quantile levels of the bands, widest first (80% then 50%). | | `adaptiveSeries` | - | | `DELTA_MIN_ALPHA` | Body alpha of the smallest meaningful delta; the largest reaches 1. | | `deltaCandlesSeries` | - | | `seriesTypes` | Registry of the series types: the eight basic ones ( §5, S1 wave) plus the PRO set - the footprint cluster grid and the four non-standard looks (renko, kagi, pointAndFigure, lineBreak) - plus the analytic four (volumeCandles, lineWithMarkers, hlcArea, highLow) and the adaptive detail type (idea 9). | | `SERIES_RENDER_TYPES` | The same list at runtime (AUD-010): hosts that receive a type from an attribute or plain JS validate membership against it instead of casting. | | `lollipopSeries` | Lollipop series (, idea 15): one dot per bar with a stem down to a baseline - the event look for dividends, reports and corporate actions. The baseline is the close of the first visible bar (comparison with the start of the period) unless the host passes `lollipop.baseline`. | | `splineSeries` | Spline series (, idea 14): the smoothed close line for yields and indices. Runs of finite closes are smoothed on their own, so a gap in the data breaks the curve instead of drawing through it. | | `HEATMAP_CELL_MIN_WIDTH` | Below this slot width the cells are unreadable and become column strips. | | `timePriceHeatmapSeries` | Heatmap series: one filled rectangle per cell, the tone of the cell from the ladder of the theme and the alpha from the weight of the cell against the heaviest one on screen. A slot narrower than `HEATMAP_CELL_MIN_WIDTH` degrades to one strip per column (the same idea the delta block uses), because a cell thinner than a pixel is noise, not information. | | `TREND_MIN_ALPHA` | Weakest tint of the trend tone; the strongest reaches full alpha. | | `GHOST_ALPHA` | Alpha of the ghost stroke; it must stay behind the live series. | | `SPARKS_LIMIT` | Hard particle budget; further spawns are dropped while it is reached. | | `SPARK_LIFE_MS` | Time for a fresh particle to burn out, ms. | | `SPARK_STYLES` | The ten presets. `bengal` (small sparkler sparks) is the light, fast and short-lived one; `nova` and `sparkler` are the widest, `fountain` throws upward, `comet` and `shower` are directional. | | `SPLINE_SEGMENT_SAMPLES` | Samples drawn per segment; enough for a smooth curve at any bar spacing. | | `CHART_STATE_KINDS` | - | | `STATE_MIN_PLOT_WIDTH` | Panes narrower or lower than these hide the state text. | | `STATE_MIN_PLOT_HEIGHT` | - | | `THEME_TOKENS` | Theme token to shell variable mapping. | | `DARK_THEME` | - | | `LIGHT_THEME` | - | | `ORANGE_THEME` | Terminal palette of the kit: black base with amber accent, a monospace readout and compact density. The font stack names only generic families and fonts already present on the platform - no third-party asset is referenced or shipped (``, ``). A leftover of the old amber palette is the amber accent itself; the surface, grid and typography are the terminal flavour requested for the `orange` name. | | `CORPORATE_THEME` | Business palette of the six set: flat light surfaces, a neutral grey grid and a restrained corporate blue. Built for quarterly reporting, portfolio and screening layouts where the chart sits inside documents and dashboards rather than a terminal. | | `CAPITAL_MARKETS_THEME` | Capital-markets palette of the six set: charcoal surface, tight grid, muted green/red and a restrained brass accent - the density and restraint of a professional data vendor terminal, on our own colours. | | `UNIFIN_THEME` | Brand palette of Unifin Charts (; owner wave 06.10.2026): the UNIFIN wordmark gradient - deep violet base, violet accent, the same two stops the portal paints its brand name with (`#2700fe` -> `#cc06fb`). Every gradient of the look pack derives its tail from this accent, so a chart in the brand style runs violet end to end, while up and down keep the trading green and red. | | `NEUTRAL_THEME` | Extra neutral base of the library (P4): a flat, almost-black surface with a neutral grid, for terminal layouts. It is an option - the default stays `DARK_THEME` (navy) and the four kit palettes are unchanged. | | `CHART_THEMES` | Named registry of the six shipped palettes (`` attribute accepts, so the menu order, the attribute values and the registry cannot drift apart. | | `BUILT_IN_THEMES` | The six palettes shipped by the library, in menu order. | | `LOOK_BAR_PALETTES` | Named bar palettes for the look pack. `classic` is a marker - the resolver keeps the live theme colours for it, so a white-label shell stays repaintable ( §1). Every other entry is a deliberate showcase palette. | | `LOOK_VOLUME_TONES` | Volume tones: `theme` is the classic pass-through, `dim` sinks the columns into a neutral shade, `accent` tints them with the palette accent and `contrast` uses a cool slate so the volumes read as a separate band. | | `LOOK_FONTS` | Popular reading fonts offered by the look pack (`font` option). | | `SYSTEM_THEME_NAME` | Name of the palette that follows the host preference (dark or light base). | | `SYSTEM_THEME` | Base of the `system` alias: hosts swap it with `systemTheme(prefersLight)`. | | `THEME_PALETTES` | Seven palettes of `` §1: the six shipped basses plus the `system` alias. The alias itself is resolved by the host, the core stays DOM free. | | `THEME_NAMES` | Selectable palette names, `system` included, in menu order (`ThemeName`). | | `VOLUME_MIN_PANE` | Panes below this height drop the layer entirely (volume-tiny edge). | | `VOLUME_MIN_COLUMN` | Columns shorter than this degrade to zero (volume-zero edge). | | `MAX_REPLAY_TICKS` | - | | `REPLAY_SPEEDS` | - | | `FUTURE_SLOTS_MAX` | Cap of the empty space reserved for the bars to come. | | `GAP_MIN_MS` | Shortest pause that counts as an empty zone; below it the chart is continuous. | | `GAP_SLIVER_PX` | Width a compressed zone keeps, in pixels - visible, but not proportional. | | `DEFAULT_MONTHS` | Fallback month row: the host passes its own pack for other locales. | | `RENDER_PROFILES` | - | | `LAYER_ORDER` | - | | `SCENE_TYPES` | - | | `KEYBOARD_MAP` | - | | `LOCALES` | - | | `API_SINCE_BY_GROUP` | the group was introduced in (rules of the breaking-change policy). | | `API_STABILITY_OVERRIDES` | Per-symbol stability overrides; everything else is `stable`. The analytic layer is `beta` until the kit contracts (-) settle ( §9). | | `PUBLIC_API_EVENTS` | Real event names currently emitted by the core (`DataController` and the render backend). The product target of §9 is 62 events; the list grows as producers are added - the record keeps the honest delta. | | `SHORT_LINK_PREFIX` | - | | `SHARE_STATE_PREFIX` | - | | `SHARE_SHORT_PREFIX` | - | | `UNIFIN_CHARTS_VERSION` | Runtime version (NFR-OPS-03): `UNIFIN_CHARTS_VERSION` is the single source used in error reports, and `exposeVersion` publishes the `__UNIFIN_CHARTS_VERSION__` global the diagnostics convention expects. The constant must equal `packages/chart-core/package.json` - a test reads the manifest and fails on drift. | | `COMPARISON_LIMIT` | - | | `PLUGIN_LICENSES` | - | | `PLUGIN_DEFINITION_LIMIT` | - | | `TEMPLATE_LIMIT` | Record limit of the local catalogue ( §9 spirit). | | `TEMPLATE_STARTERS` | Ten starter setups: id, title, presets and layout. | | `FIB_RATIOS` | Fibonacci retracement levels: the seven classic ratios over a swing between two anchor prices. Pure maths - hosts paint the lines and format the labels; the element builds level overlays from this list. | | `RISK_ZONE_PATTERN` | Zone fills of the risk and the profit side ( registry ids). | | `PROFIT_ZONE_PATTERN` | - | | `ORDER_TYPE_CATALOGUE` | - | | `DEFAULT_CONFIRMATION_THRESHOLDS` | Safe starting thresholds for hosts that want defaults, not a policy. | | `PAPER_DEFAULT_LEVERAGE` | Leverage applied when the host gives none. | | `PAPER_MAX_LEVERAGE` | Upper bound of the leverage clamp, the catalog range of the platform. | | `MAX_PANES` | Hard product limit from §3: no more than 16 panes. | ## Subpath `@unifin/chart-core/workspace` (81) Imported as `@unifin/chart-core/workspace`; the subpaths of this table are self-contained: a host that does not need them does not pay for them. ### Functions (30) | Symbol | What it does | | --- | --- | | `sliderShareToIndex` | Bar index behind a share of the track; the share is clamped to 0..1. | | `paneAlertBadges` | Badges per pane, most serious first. Alerts without a pane are ignored: the badge belongs to a pane and a host cannot place it anywhere else. | | `searchShortcuts` | Shortcuts matching the query, best first. An empty query returns the list as it is, a query that matches nothing returns an empty list - never a guess. | | `indexToSliderShare` | Share of the track for a bar index; an out-of-range index is clamped. | | `auditOverlayRows` | Rows of the overlay; a poor feed or a slow request is marked as a warning. | | `buildExportLegend` | - | | `normalizeWeights` | Weights that sum to 1; a layout of zeroes or a single pane stays usable. | | `scenarioFromReplay` | Steps in the order of the replay; ties keep the order of the input. An empty replay gives an empty scenario with zeroed bounds, never a phantom step. | | `narrateFrame` | Sentence describing the state of the chart: instrument, visible window, price range, and how many series, drawings and notes sit on it. | | `frameGovernorDecision` | Two independent reasons to leave the frame: the picture is already below the rate, or the series is large enough that it will be. Without a worker the answer is always the main thread. | | `snapShareToSessions` | Handle pulled to the nearest session boundary within `tolerance` shares. | | `groupAlertFeed` | Group alerts of one instrument and kind that arrived within `windowMs` of each other. Groups are returned newest first; the sum of `count` always equals the number of the input items. | | `layersOf` | Drawings grouped by layer, unknown layers resolved to the default one. | | `resizePane` | Drag the border under `id` by `deltaPx`: the pane grows and its neighbour shrinks, neither falls below `PANE_MIN_SHARE`, and the sum stays 1. | | `parseAssistantRequest` | Calls of the catalogue found in the phrase, in the order of the phrase. The numbers of the phrase go to the parameters the command declares first, so the result stays explainable. | | `projectLine` | - | | `exportFileName` | File name of an export: instrument, UTC timestamp, extension. The time has no colons (Windows refuses them) and the symbol keeps its letters and digits only. | | `frameBudgetRows` | Rows of the panel: p50 and p99 against the budget, plus the counted steps. | | `buildHeaderValues` | Values of the visible fields; an unknown field is skipped, not rendered as NaN. | | `applyLayerState` | Drawings with the layer rules applied. A missing layer leaves the object as it was: an unknown layer is a host mistake, not a reason to hide the user's work. | | `maximizePane` | Full-screen pane: every other pane collapses, the layout is remembered. | | `restoreLayout` | Back from full screen; a layout that was not maximised is returned as it is. | | `notesAt` | Notes grouped by the bar they fall on; a note off the history is dropped. | | `isMaximized` | True when exactly one pane holds the whole workspace. | | `visibleHeaderFields` | Fields to render: the required ones are added back in catalogue order, so a host layout can never drop the symbol. | | `addTimeNote` | - | | `removeTimeNote` | - | | `alignInstrumentLayers` | Several instruments on one axis: the axis unions their times, a missing bar is carried forward (a line does not jump back), a leading gap stays empty. | | `classOfInstrument` | Class of an instrument: the explicit `assetClass` wins, the venue code is the fallback, anything else is `other` (a wrong guess is worse than a plain one). | | `templateForClass` | Template of a class, with the `any` template as the fallback. | ### Types (41) | Symbol | What it does | | --- | --- | | `SessionShare` | Time slider of the workspace (, idea 88): the track of the history in shares and the bar index behind it. Snapping keeps the handle on the session boundaries a trader expects, without leaving the range. | | `AlertSeverity` | Alert feed with grouping (, idea 84): a burst of the same alert on the same instrument becomes one row with a count, so the feed stays readable without losing a single event. Channels stay those of the platform. | | `ScenarioAction` | Scenarios out of a replay (, idea 63): the actions a user made during a replay become an ordered list of steps a host can replay, export or turn into a test. The module copies nothing: it only names what happened. | | `AuditOverlayInput` | Audit overlay of the workspace (, idea 83): the rows a support engineer reads out loud - how much data is loaded, which quality level it has, how much markup sits on the chart. Values only, no internal identifiers. | | `ShortcutEntry` | - | | `FrameNarrationInput` | - | | `HeaderFieldId` | - | | `PaneAlertBadge` | - | | `AlertFeedItem` | - | | `ReplayEventInput` | - | | `LegendEntry` | - | | `AssistantCommand` | Assistant of the chart (, idea 100): a phrase in natural language becomes chart-as-code calls of the known catalogue. The module only returns data: it never runs the phrase, never calls the network and never builds a function from the text (`eval` and `new Function` are forbidden by the project rules). Unknown words are reported instead of guessed. | | `PaneSpec` | - | | `ProjectionPoint` | - | | `HeaderField` | - | | `ShortcutHit` | - | | `PaneLayout` | - | | `AlertGroup` | - | | `ExportLegendRow` | - | | `ScenarioStep` | - | | `AuditOverlayRow` | - | | `FrameGovernorInput` | - | | `ProjectionInput` | - | | `AssistantCall` | - | | `DrawingLayer` | - | | `Scenario` | - | | `LegendModel` | - | | `AssistantDraft` | - | | `LayerGroup` | - | | `FrameGovernorDecision` | - | | `Projection` | - | | `HeaderValue` | - | | `EffectiveDrawing` | Effective state of an object after the layer rules are applied. | | `FrameBudgetRow` | - | | `TimeNote` | - | | `BarNotes` | - | | `InstrumentSeries` | - | | `AlignedLayer` | - | | `AlignedLayers` | - | | `InstrumentClass` | - | | `DrawingTemplateRef` | - | ### Constants (10) | Symbol | What it does | | --- | --- | | `EXPORT_LEGEND_MAX_ROWS` | Hard cap of legend rows: a chart with more series needs a summary, not a list. | | `FRAME_P99_BUDGET_MS` | Frame budget of p99, in milliseconds (ANALYSIS/03-NFR.md). | | `PANE_MIN_SHARE` | Smallest share a pane keeps while resizing, in parts of the whole. | | `PROJECT_MAX_BARS` | Hard cap of projected bars, whatever the host asks for. | | `WORKER_FPS_THRESHOLD` | Below this observed rate the calculation leaves the frame. | | `WORKER_POINT_LIMIT` | Above this many points the calculation leaves the frame. | | `DEFAULT_LAYER_ID` | Layer of objects the host did not assign. | | `HEADER_FIELDS` | - | | `ASSISTANT_MAX_WORDS` | Longest phrase the assistant reads, in words; the rest is left unmatched. | | `INSTRUMENT_CLASSES` | - | --- # "Indicators API (@unifin/chart-indicators)" (Shared edition) Source: /docs/api/chart-indicators Generated from the package entry `packages/chart-indicators/src/index.ts`. Names are reachable through `@unifin/chart-indicators`; use your editor for full signatures - this page carries the map. ## Classes (6) | Symbol | What it does | | --- | --- | | `FormulaSyntaxError` | - | | `FormulaCompileError` | - | | `FormulaLimitError` | - | | `RingWindow` | Fixed window of the newest `length` values with a running sum. `sum` is NaN until the window is filled; `at(offset)` reads with 0 = newest. | | `EmaSmoothing` | Exponential smoothing seeded by the simple average of the first `length` values (the convention shared with the S0 vector functions). | | `WilderSmoothing` | Wilder smoothing: alpha = 1 / length, same seeding rule as the EMA. | ## Functions (29) | Symbol | What it does | | --- | --- | | `createCatalogRegistry` | - | | `defineStepped` | - | | `numberInput` | - | | `selectInput` | - | | `lineOutput` | - | | `histogramOutput` | - | | `parseFormula` | - | | `visitFormula` | Depth first walk used by the compiler for arity and name checks. | | `compileFormula` | - | | `evaluateFormula` | - | | `defineFormula` | Wraps a formula into a normal incremental study definition. | | `runFormulaJob` | Pure entry point for the host worker: no DOM, no timers, structured payload in and values out. | | `sma` | - | | `ema` | Exponential moving average, seeded by the SMA of the first `length` values. | | `wma` | Linearly weighted moving average (weights 1..length). | | `weightedAverage` | Weighted average with an arbitrary weight vector (newest value last). | | `fillNaN` | - | | `valueAt` | Reads a value defensively: out-of-range and non-finite give NaN. | | `trueRangeAt` | True range against the previous close; the first bar uses high - low. | | `closeAt` | - | | `typicalPriceAt` | Typical price (high + low + close) / 3. | | `snapshotState` | Shallow state copy with deep copies of the listed ring and smoothing keys. | | `rsi` | Relative Strength Index (IND-017), Wilder smoothing. | | `macd` | Moving average convergence divergence (IND-018). | | `williamsR` | Williams %R as a bounded momentum value in the range [-100, 0] (IND-021). | | `bollinger` | Bollinger Bands (IND-042): middle is the SMA, band width is k * deviation. | | `trueRange` | True range of one bar against the previous close. | | `atr` | Average True Range (IND-041), Wilder smoothing. | | `keltner` | Keltner channel: EMA centre with ATR based bands (IND-045). | ## Types (14) | Symbol | What it does | | --- | --- | | `SteppedSpec` | Builder for incremental definitions: `calculate` replays the same `step` over the range, `update` runs one step, so the incremental and the full path can never drift apart ( §1-2). | | `FormulaNode` | - | | `ParsedFormula` | - | | `CompiledFormula` | - | | `FormulaLimits` | - | | `FormulaContext` | Host provided series (other instrument, index, spread) aligned to the bars. | | `FormulaSpec` | - | | `FormulaJobPayload` | - | | `FormulaJobResult` | - | | `NumericSeries` | Moving averages (catalogue IND-001... IND-016). Contract: the result has the same length as the input; values that cannot be computed yet are NaN ( §2), never zero and never a shortened array. | | `Cloneable` | Shared incremental primitives for the wave W1 catalogue (S4). Every primitive is a small stateful object; definitions keep instances in the study state and clone them through `clone` for forming bar replays. | | `MacdResult` | - | | `BandResult` | - | | `OhlcBar` | - | ## Constants (145) | Symbol | What it does | | --- | --- | | `INDICATOR_CATALOG` | Catalogue waves: W1 (S4, 32 studies) plus the S5 groups as they land. Every id below has a provenance record in with a test link; the gate fails when they drift apart. | | `CATALOG_PROVENANCE_IDS` | Catalog ids that reference a provenance record (IND-xxx). | | `userFormulaDefinition` | - | | `compositeDefinition` | - | | `otherInstrumentDefinition` | - | | `eventDefinition` | - | | `CUSTOM_DEFINITIONS` | - | | `hilbertDefinition` | - | | `sineWaveDefinition` | - | | `laguerreRsiDefinition` | - | | `fisherMedianDefinition` | - | | `savitzkyGolayDefinition` | - | | `kalmanDefinition` | - | | `butterworthDefinition` | - | | `superSmootherDefinition` | - | | `hilbertChannelDefinition` | - | | `adaptiveRsiDefinition` | - | | `instantaneousTrendlineDefinition` | - | | `roofingFilterDefinition` | - | | `CYCLE_DEFINITIONS` | - | | `tsiDefinition` | - | | `ultimateDefinition` | - | | `awesomeDefinition` | - | | `kstDefinition` | - | | `coppockDefinition` | - | | `bopDefinition` | - | | `rviDefinition` | - | | `rsiDivergenceDefinition` | - | | `macdDivergenceDefinition` | - | | `rsRatioDefinition` | - | | `pmoDefinition` | - | | `fisherDefinition` | - | | `cogDefinition` | - | | `trendMeterDefinition` | - | | `smiDefinition` | - | | `MOMENTUM_DEFINITIONS_2` | Second momentum group in catalogue order (IND-025... IND-040). | | `rsiDefinition` | - | | `macdDefinition` | - | | `stochasticDefinition` | - | | `williamsRDefinition` | - | | `rocDefinition` | - | | `momentumDefinition` | - | | `cciDefinition` | - | | `stochRsiDefinition` | - | | `cmoDefinition` | - | | `MOMENTUM_DEFINITIONS` | - | | `correlationDefinition` | - | | `betaDefinition` | - | | `zScorePriceDefinition` | - | | `zScoreVolumeDefinition` | - | | `spreadDefinition` | - | | `ratioDefinition` | - | | `linRegSlopeDefinition` | - | | `rSquaredDefinition` | - | | `meanDeviationDefinition` | - | | `medianPriceDefinition` | - | | `percentileDefinition` | - | | `typicalPriceDefinition` | - | | `weightedCloseDefinition` | - | | `seasonalityDefinition` | - | | `volatilityTimeDefinition` | - | | `atrPercentDefinition` | - | | `STATISTICS_DEFINITIONS` | - | | `ichimokuDefinition` | - | | `vortexDefinition` | - | | `dpoDefinition` | - | | `schaffTrendDefinition` | - | | `qstickDefinition` | - | | `zigzagDefinition` | - | | `fractalsDefinition` | - | | `pivotClassicDefinition` | - | | `pivotFibonacciDefinition` | - | | `pivotCamarillaDefinition` | - | | `pivotWoodieDefinition` | - | | `linRegChannelDefinition` | - | | `raffChannelDefinition` | - | | `priceChannelDefinition` | - | | `trendIntensityDefinition` | - | | `massIndexDefinition` | - | | `elderImpulseDefinition` | - | | `choppinessDefinition` | - | | `vhfDefinition` | - | | `adxrDefinition` | - | | `STRENGTH_DEFINITIONS_2` | - | | `adxDefinition` | Trend strength and structure studies of the wave W1 catalogue ( §5). | | `psarDefinition` | - | | `aroonDefinition` | - | | `trixDefinition` | - | | `STRENGTH_DEFINITIONS` | - | | `kamaDefinition` | Second trend group of the catalogue ( §1, wave S5). | | `almaDefinition` | - | | `zlemaDefinition` | - | | `t3Definition` | - | | `mcginleyDefinition` | - | | `demarkLineDefinition` | - | | `supertrendDefinition` | - | | `TREND_DEFINITIONS_2` | - | | `smaDefinition` | Trend studies of the wave W1 catalogue ( §1). | | `emaDefinition` | - | | `wmaDefinition` | - | | `demaDefinition` | - | | `temaDefinition` | - | | `hmaDefinition` | - | | `lsmaDefinition` | - | | `rmaDefinition` | - | | `vwmaDefinition` | - | | `TREND_DEFINITIONS` | - | | `chaikinVolatilityDefinition` | Second volatility group of the catalogue ( §3, wave S5). | | `historicalVolatilityDefinition` | - | | `chandelierExitDefinition` | - | | `atrTrailingStopDefinition` | - | | `ulcerIndexDefinition` | - | | `squeezeMomentumDefinition` | - | | `relativeVolatilityIndexDefinition` | - | | `volatilityStopDefinition` | - | | `trueRangeDefinition` | - | | `VOLATILITY_DEFINITIONS_2` | - | | `atrDefinition` | Volatility studies of the wave W1 catalogue ( §3). | | `bollingerDefinition` | - | | `percentBDefinition` | - | | `bandwidthDefinition` | - | | `keltnerDefinition` | - | | `donchianDefinition` | - | | `stdDevDefinition` | - | | `VOLATILITY_DEFINITIONS` | - | | `anchoredVwapDefinition` | - | | `accumulationDistributionDefinition` | - | | `chaikinMoneyFlowDefinition` | - | | `moneyFlowIndexDefinition` | - | | `forceIndexDefinition` | - | | `easeOfMovementDefinition` | - | | `volumeOscillatorDefinition` | - | | `priceVolumeTrendDefinition` | - | | `klingerDefinition` | - | | `volumeProfileDefinition` | - | | `deltaFootprintDefinition` | - | | `volumeWeightedMacdDefinition` | - | | `negativeVolumeIndexDefinition` | - | | `VOLUME_DEFINITIONS_2` | - | | `volumeDefinition` | Volume studies of the wave W1 catalogue ( §4). | | `vwapDefinition` | - | | `obvDefinition` | - | | `VOLUME_DEFINITIONS` | - | | `FORMULA_VARIABLES` | Sandboxed runtime for user formulas ( §5): the AST from the parser is interpreted against bar data with a function whitelist and hard limits. There is no access to DOM, network, storage or trading APIs by construction, and a limit breach raises `FormulaLimitError` so the engine can disable the study. | | `FORMULA_FUNCTIONS` | - | --- # "React API (@unifin/chart-react)" (Shared edition) Source: /docs/api/chart-react Generated from the package entry `packages/chart-react/src/index.ts`. Names are reachable through `@unifin/chart-react`; use your editor for full signatures - this page carries the map. ## Functions (20) | Symbol | What it does | | --- | --- | | `resolveThemeByName` | Palette by public name (`` §1). The lookup is case-insensitive and an unknown or missing name falls back to the dark base, so a foreign attribute or property value can never reach the renderer unchecked (AUD-010). The caller owns the host preference: `prefersLight` resolves the `system` alias only. | | `activeBindings` | Number of bindings created and not yet disposed (leak-test witness). | | `createChartBinding` | - | | `resolveBrowserTheme` | Reads the `--ud-*` tokens of the shell and builds a theme. Values are read from the document root, so a theme change requires no chart recreation: the host only re-renders and calls this resolver again ( §1, ). | | `prefersReducedMotion` | Reads `prefers-reduced-motion` from the host window, defaulting to false. | | `UnifinChart` | React entry point. Client-side only: creation happens in an effect, so the component is safe to import in a server component or Next.js app ( §3). | | `ChartGrid` | Dashboard grid 2x2 (FR-SDK-11, §4): four charts on one board with a shared viewport group. The group itself is framework-free (`createSyncGroup`); the grid registers a panel adapter per chart and renders the boards. | | `createChart` | - | | `attachChartInput` | Binds the DOM events of `target` to the controller and returns the detach function. Idempotent per call: attach once, detach once - a host that remounts attaches a fresh set over the same target without duplicates. | | `MiniChart` | Dashboard mini panel (FR-RENDER-06, §4): price scale and time labels stay, the toolbar and the grid go away. | | `quoteSpread` | Spread of a two-sided quote; a crossed or incomplete book yields nulls. | | `quoteTone` | Direction of the change; an unknown or flat change stays neutral. | | `quoteChangePercent` | Change against the previous close in percent; null without a valid base. | | `QuoteHeader` | - | | `captureChartPng` | Repaints the binding and returns a PNG data URL of the canvas, or null when the canvas cannot export (no context, no `toDataURL`, disposed binding). | | `copyChartPngToClipboard` | Copies the repainted canvas to the clipboard as `image/png`. Returns false when the environment has no clipboard API or the host denies the write. | | `shareChartPng` | Shares the repainted canvas as a PNG file through the Web Share API (CHT-16-08). Returns `unsupported` when the platform or the host declines the payload, `failed` when the share sheet errors; the caller can fall back to `copyChartPngToClipboard` or a download. | | `Sparkline` | Dashboard sparkline (FR-RENDER-06, §4): no axes, no grid, no labels - the minimal trend line for tables and KPI tiles. | | `createSyncGroup` | - | | `useChart` | Wires a canvas element to the core pipeline through the framework-free binding ( §3). The effect creates exactly one binding; its cleanup disposes it - React 18 StrictMode double-invocation therefore keeps a single active binding and never leaks. The core owns the state; React only publishes props and asks for a repaint. | ## Types (50) | Symbol | What it does | | --- | --- | | `Bar` | Core market data model: bars, ticks, instruments and timeframes. No DOM and no framework dependencies here. | | `Tick` | - | | `Instrument` | - | | `Timeframe` | 22 timeframes from a second to a month ( §2). | | `SeriesRenderType` | Series render types. The first wave ( §5): candles, outlineCandles, bars, line, area, histogram, step, baseline. adds the PRO pair: the footprint cluster grid and the four non-standard looks (renko, kagi, pointAndFigure, lineBreak) fed by the `data/non-standard` builders. adds the analytic four: volumeCandles, lineWithMarkers, hlcArea, highLow. | | `LineOverlay` | Host-provided line overlays (PRO wave): indicator curves (moving averages, VWAP, Bollinger bands) and level lines painted by the series layer over the price pane. Values are aligned to bars by index: `null` breaks the polyline, a gap is never bridged. The core paints, the host computes - the same contract as every other layer. | | `ReadoutModel` | Readout model: the bar under the cursor becomes one value row the shells read instead of assembling themselves. Pure data: no DOM, no canvas. The controller caches the model per bar object, so a repeated hover over the same bar returns the same instance without allocations. | | `ReadoutBuildOptions` | - | | `CrosshairMoveEvent` | - | | `CrosshairLeaveEvent` | The pointer left the plot area; the crosshair is hidden. | | `CrosshairPinEvent` | - | | `BarClickEvent` | - | | `InteractionEventName` | - | | `InteractionEvent` | - | | `ChartTheme` | Chart theme. Colors are never hardcoded in layers: they come from the shell tokens (`--ud-*`) of the Desktop Kit or from the built-in defaults below ( §1). | | `ThemeName` | Names of the selectable palettes plus the `system` alias. | | `BuiltInThemeName` | Names of the six palettes the library ships, in menu order. | | `AttributionInput` | Corner mark of the chart: where it points and what it says. | | `CrosshairMode` | Crosshair behaviour of the binding: hidden, free or magnet to the close. | | `ChartBindingOptions` | - | | `ChartBinding` | - | | `ThemeHostElement` | Narrow view of the host element: only what is needed to read shell tokens. Keeps the binding testable in Node without a real DOM. | | `UnifinChartProps` | - | | `ChartGridPanel` | - | | `ChartGridProps` | - | | `ChartContainerLike` | - | | `CreateChartOptions` | - | | `ChartHandle` | - | | `InputEventLike` | - | | `InputTargetLike` | - | | `AttachInputOptions` | - | | `MiniChartProps` | - | | `QuoteSpread` | - | | `QuoteTone` | - | | `QuoteHeaderProps` | - | | `PngCanvasLike` | - | | `ClipboardEnv` | - | | `ShareEnv` | Environment of the Web Share API, injected for tests and SSR safety. | | `ShareResult` | Outcome of `shareChartPng`: nothing is thrown at the host. | | `ShareChartOptions` | - | | `SparklineProps` | - | | `SyncRange` | - | | `SyncPanel` | - | | `SyncGroupOptions` | - | | `SyncDrawingOp` | - | | `SyncSelectionHandler` | - | | `SyncDrawingHandler` | - | | `SyncGroup` | - | | `UseChartOptions` | - | | `UseChartResult` | - | ## Constants (5) | Symbol | What it does | | --- | --- | | `CHART_THEMES` | Named registry of the six shipped palettes (`` attribute accepts, so the menu order, the attribute values and the registry cannot drift apart. | | `BUILT_IN_THEMES` | The six palettes shipped by the library, in menu order. | | `THEME_NAMES` | Selectable palette names, `system` included, in menu order (`ThemeName`). | | `ATTRIBUTION_HREF` | Site of the library, opened by the mark. | | `ATTRIBUTION_LABEL` | Label of the mark. | ## Subpath `@unifin/chart-react/workspace` (15) Imported as `@unifin/chart-react/workspace`; the subpaths of this table are self-contained: a host that does not need them does not pay for them. ### Functions (15) | Symbol | What it does | | --- | --- | | `useDrawingLayers` | Effective state of the drawings after the layer rules. | | `useLayerGroups` | Drawing layers with their members, ready for a tree view. | | `useHeaderValues` | Values of the configured header fields. | | `useAlignInstrumentLayers` | Series of several instruments on one time axis. | | `usePaneLayout` | Pane actions that return the next layout; the host keeps the state. | | `useAlertFeed` | Alert feed with grouping and the badges of the panes. | | `useExportLegend` | Legend rows of an export, with the hidden series last. | | `useAuditRows` | Rows of the audit overlay. | | `useFrameNarration` | Narration sentence of the current frame. | | `useFrameBudget` | Rows of the frame budget panel and the worker decision behind them. | | `useWorkerDecision` | Decision whether the calculation leaves the frame. | | `useAssistantDraft` | Draft of the assistant: calls of the catalogue plus the words it did not know. | | `useTimeNotes` | Notes pinned to their bars. | | `useReplayScenario` | Scenario of a replay: ordered steps a host shows, exports or turns into a test. | | `useTimeSlider` | Position of the time slider: the bar index of a share, snapped to a session edge. | --- # "Element API (@unifin/chart-element)" (Shared edition) Source: /docs/api/chart-element Generated from the package entry `packages/chart-element/src/index.ts`. Names are reachable through `@unifin/chart-element`; use your editor for full signatures - this page carries the map. ## Classes (1) | Symbol | What it does | | --- | --- | | `UnifinChartElement` | - | ## Functions (6) | Symbol | What it does | | --- | --- | | `themeForName` | Element palette of the `theme` attribute: the six names of `THEME_NAMES`. | | `defineUnifinChart` | Registers the element once; returns false without a registry (SSR, node) or when the tag is already taken - never throws. | | `isFxPreset` | Narrows a foreign attribute or query value to an effect preset. | | `resolveFx` | Turns one preset on or off. Asking for an effect while `reducedMotion` is set is refused: the returned list stays unchanged and `refused` is true, so callers can surface a hint instead of silently animating. | | `linkScenes` | - | | `planSceneMotion` | - | ## Types (7) | Symbol | What it does | | --- | --- | | `ReplayViewState` | Replay cursor state of the element; `active` is false until engaged. | | `ElementViewState` | Viewport readback of the element (bar spacing and first visible bar). | | `FxPreset` | - | | `FxEnvironment` | - | | `FxResolution` | - | | `SceneLinkElement` | - | | `SceneMotionPlan` | - | ## Constants (4) | Symbol | What it does | | --- | --- | | `MIN_BAR_SPACING` | Bar spacing limits of the element viewport (mirrors the scale defaults). | | `MAX_BAR_SPACING` | - | | `FX_PRESETS` | Showcase effects: optional presentation presets for the site stage - a sheen sweeping the frame border, a glow following the cursor and a spark burst on scene switches. The module is pure: it resolves which presets are active and which classes the host carries; CSS lives with the embedding page. Effects always respect the motion policy. | | `SCENE_FADE_MS` | Scene crossfade duration; inside the 80-160 ms canon. | --- # "Bonds kit API (@unifin/chart-kit-bonds)" (Shared edition) Source: /docs/api/chart-kit-bonds Generated from the package entry `packages/chart-kit-bonds/src/index.ts`. Names are reachable through `@unifin/chart-kit-bonds`; use your editor for full signatures - this page carries the map. ## Functions (69) | Symbol | What it does | | --- | --- | | `yearFraction` | Year fraction between two ISO dates under ACT/365 or 30/360; NaN on a bad date. 30/360 counts whole months as thirty days, which is the convention an accrual period of a swap is usually quoted under. | | `curveCompassModel` | Curves projected onto the tenor angles with a shared radius domain. | | `paintCurveCompass` | Paints the compass: the polar grid, muted family outlines, then the active ring filled with its vertex dots; tenor chips ride on wide panels. Returns the number of painted rings. | | `countryHeatmapModel` | Signed deviations of the countries mapped onto a diverging scale. | | `paintCountryHeatmap` | Paints the tile grid: diverging tiles, the value inside large tiles, the accent edge of the active tile and its card above or below it. Returns the number of painted tiles. | | `creditSpreadPanel` | The two readings over one window: series stats, stress zones and domain. | | `paintCreditSpreadPanel` | Paints the panel: the two corridors, the stress zones, the IG line and the glowing HY line with the window maximum marked and labelled in bp. Returns the number of painted lines (0..2). | | `yieldCurvePoints` | Sorted copy of the points (by years); non-finite samples are dropped. | | `curveToPoints` | Curve points as analytic samples for the core painters. | | `interpolateCurveValue` | Value of a cleaned, sorted curve at a tenor: exact nodes win, a hit between two nodes interpolates; a repeated tenor reads its first node. With `clamp` the ends extend to the nearest node, otherwise a tenor outside the quoted range gives `null`. | | `curveSpread` | Difference of two curves aligned by years, in basis points. | | `paintYieldCurve` | Paints the curve as a polyline over the numeric axis. | | `paintCurveLabels` | Paints the labelled curve points as markers (label to the right). | | `paintCurveSpread` | Paints the spread as signed bars from zero. | | `yieldDecomposition` | One nominal date split into the real part and the expectations. | | `paintYieldDecomposition` | Paints the decomposition: for every date the real block from the zero line and the expectations block above it, the light edge of the nominal top and the share labels. Returns the number of painted dates. | | `morphShares` | Interpolates the shares of the decomposition between two dates (S102): a linear blend with `t` clamped into 0..1; signs survive and the sum of the valid input pairs holds; a non-finite target returns `from` untouched. | | `couponEvents` | Events from the cash flows; the final flow is the redemption. | | `eventPoints` | Events as analytic samples (x = years, y = amount). | | `eventsTotal` | Total of all events (coupons plus redemption). | | `paintCouponTimeline` | Paints the events as labelled markers (label to the right of the dot). | | `curveFanHistory` | Aligns the dated history: cleans the samples, thins the excess, assigns the alpha ramp by age and pads the domain for the labels and the glow. | | `paintCurveFan` | Paints the fan: muted lines first (oldest to newest), the hero accent line last with a light glow when the canvas supports shadows. Returns the number of painted lines. | | `buildLadder` | Ladder buckets in the given order; non-finite amounts count as zero. | | `ladderWeightedYtm` | Amount-weighted average yield of the ladder; NaN when no row carries a yield. | | `paintBondLadder` | Paints the ladder as bars from zero over the category axis. | | `marketMapModel` | The curve plus the issues: every bond reads its spread to the interpolated curve; issues with unreadable values are dropped, a curve without readable nodes drops every issue (there is nothing to compare against). Codes of the issues are expected to be unique - the connector and the spread resolve the first row of a code. | | `marketMapSpread` | Spread between two issues in bp (A minus B); `null` when a code is absent. | | `paintMarketMap` | Paints the map: the hero curve, one bubble per issue in its verdict colour and, when two issues are selected, their connector with the spread chip. Returns the number of painted issues. | | `couponSchedule` | Coupon dates from settlement to maturity, back-stepped by the frequency. | | `couponFlows` | Coupon plus redemption flows of a plain vanilla bond, near to far. | | `priceFromYield` | Present value of the flows at the given yield (decimal, nominal annual). | | `bondPrice` | Clean price of the bond at the given yield. | | `bondYtm` | Yield to maturity solved by bisection against the target clean price. | | `bondYtp` | Yield to the call or put date: flows stop at the redemption date. | | `flowsUntil` | Cash flows of a bond that redeems early at `redemptionYears`. | | `macaulayDuration` | Macaulay duration in years: present-value weighted mean term. | | `modifiedDuration` | Modified duration: relative price sensitivity to the yield. | | `convexity` | Convexity in years squared: second-order price sensitivity (period-based). | | `accruedInterest` | Accrued interest since the last coupon: the coupon amount scales with the elapsed share of the coupon period under the chosen day count. | | `morphEase` | Cubic-in-out easing of the canon; non-finite input means the zero frame. | | `morphCurveSeries` | One morph frame: both curves are aligned on the union of their tenors (the ends extend to the nearest node: the morph moves the shape, not the range) and blended by the eased progress. `t` is clamped into 0..1; `t = 0` gives the `from` curve, `t = 1` the `to` curve. A curve empty on one side passes through unchanged. | | `paintDot` | Round dot; without `arc` the host canvas gets a square of the same box. | | `paintLabelChip` | Rounded label capsule with a centred text; `x`/`y` address the centre of the capsule. A canvas without `arc` degrades to a plain filled rectangle - the text stays legible, the contrast survives (BOND-VISUALS §5). | | `priceToPar` | Clean price to par (100) from the absolute price of the terms. | | `parToPrice` | Absolute clean price of the terms from a price-to-par reading. | | `priceFromYieldSeries` | Reads a yield series as clean prices to par: every point goes through the bond math of the terms. Unreadable points (zero face, NaN) are dropped. | | `yieldFromPriceSeries` | Reads a clean price series (to par) back as yields through the bond math. | | `priceModeSeries` | The series in the requested mode: `yield` passes the samples through (sorted, cleaned), `price` reads them as clean prices to par. | | `tenorPulseChips` | Chips of the pulse, ordered by tenor (the panel reads left to right). | | `paintTenorPulse` | Paints the pulse row: one chip per tenor with its tone underlay, the value inside and the signed delta under the chip on tall panels. Wraps the chips into at most `rows` (default 2) lines instead of clipping them. Returns the number of painted chips. | | `pvWaterfall3dModel` | Builds the waterfall model. Non-positive and out-of-window flows paint nothing; PVs come from `priceFromYield` on a one-flow array (the exact per-flow present value), so a scenario total equals the kit price at the shifted yield by construction. | | `paintPvWaterfall3d` | Paints the waterfall through the scene3d bars painter and returns the number of painted faces (three per bar). Bar colors: the active scenario takes the theme accent, negative shifts the down tone, the rest the muted tone; widths follow the flow and scenario counts, so a single scenario is one flat row. | | `curveRidgelineModel` | The dated history as bands: newest slot on top, alpha fading with age. | | `paintCurveRidgeline` | Paints the bands: oldest first, the hero last; labels ride in chips on wide panels. Returns the number of painted bands. | | `spreadRiverModel` | Parallel spread channels over one shared half-domain (the sign kept). | | `paintSpreadRiver` | Paints the river: zero edges of every channel, the muted outlines, then the active channel filled by its sign with extreme dots and bp chips. Returns the number of painted channels. | | `buildBondScreenerRows` | Input order is kept: sorting is the host's controlled step. | | `formatTenor` | `0.25` -> `3M`, `1` -> `1Y`, `7.5` -> `7.5Y`; non-finite values render as `-`. | | `curveSnapshotModel` | Aligns the dated curves: cleans the samples, picks the hero and pads the domain so the hero underlay and labels never touch the edges. | | `paintCurveSnapshot` | Paints the snapshot: muted curves first, then the hero underlay, the hero line, its halo points and the term labels. Returns the number of painted curves (muted plus hero), matching the other painters of the kit. | | `yieldAtYears` | Linear interpolation of the curve at a tenor: exact nodes win, a hit between two nodes interpolates, anything outside the quoted range returns `null`. | | `spreadStripModel` | One pair over the dated history: spreads in bp, zones, stats and domain. | | `paintSpreadStrip` | Paints the strip: recession plates with their year, the inversion underlay below the threshold, signed gradient bars from zero, the zero line, the extreme dots and the haloed marker of the current reading. Returns the number of painted bars. | | `curveSurfaceModel` | The dated history as a surface: thinned rows, depth, alpha ramp and domain. | | `paintCurveSurface` | Paints the surface: the flat underlay of the front curve, the muted rows from the farthest to the nearest, then the front hero with its end dot. Returns the number of painted rows. | | `yieldMapModel` | The dated history as a tenor x time grid with a percentile colour domain. | | `yieldMapIsolines` | Isolines of the requested levels (default: the 1 pp grid inside the domain). | | `paintYieldMap` | Paints the map: one diverging tile per quotable cell, then the isolines and their level chips on wide panels. Returns the number of painted cells. | ## Types (93) | Symbol | What it does | | --- | --- | | `DayCountConvention` | Day-count convention of an accrual period. | | `CompassSeries` | - | | `CurveCompassOptions` | - | | `CompassVertex` | - | | `CompassRing` | - | | `CurveCompass` | - | | `CurveCompassPaintOptions` | - | | `CountryHeatmapEntry` | - | | `CountryHeatmapOptions` | - | | `CountryRegion` | A titled cluster of country codes (order of the codes is the capture order). | | `CountryHeatmapTone` | - | | `CountryHeatmapCell` | - | | `CountryHeatmapGroup` | A titled cluster of tiles ready for the painter (empty clusters dropped). | | `CountryHeatmap` | - | | `CountryHeatmapPaintInput` | - | | `CountryHeatmapPaintOptions` | - | | `CreditSpreadPoint` | - | | `CreditSpreadOptions` | - | | `CreditSpreadSeries` | - | | `CreditSpreadRange` | - | | `CreditSpreadSpan` | Zone boundaries as indexes into `hy.points`; parallel to `zones`. | | `CreditSpreadPanel` | - | | `CreditSpreadPaintOptions` | - | | `CurvePoint` | One curve point: years to maturity and the yield as a decimal. | | `CurveSpread` | - | | `YieldDecompositionInput` | - | | `YieldDecompositionRow` | - | | `YieldDecomposition` | - | | `YieldDecompositionPaintOptions` | - | | `CouponEventKind` | - | | `CouponEvent` | One dated event of the bond: coupon C1..Cn plus the final redemption M. | | `CurveFanEntry` | - | | `CurveFanOptions` | - | | `CurveFanLine` | - | | `CurveFan` | - | | `CurveFanPaintOptions` | - | | `BondLadderRow` | One ladder row: a maturity bucket and the amount maturing in it. | | `BondLadder` | - | | `MarketBondInput` | - | | `MarketMapOptions` | - | | `MarketMapRow` | - | | `MarketMap` | - | | `MarketMapPaintOptions` | - | | `CashFlow` | One future cash flow: years to the payment and its amount (face currency). | | `BondTerms` | Terms of a plain vanilla coupon bond. | | `MorphOptions` | - | | `LabelChipOptions` | - | | `PriceModePoint` | One dated sample of the series; `x` is the position on the time axis. | | `TenorPulseEntry` | - | | `TenorPulseChip` | - | | `TenorPulsePaintOptions` | - | | `PvWaterfallInput` | - | | `PvWaterfallOptions` | - | | `PvWaterfallBar` | - | | `PvWaterfall3d` | - | | `PvWaterfall3dPaintInput` | - | | `PvWaterfall3dPaintOptions` | - | | `CurveRidgelineEntry` | - | | `CurveRidgelineOptions` | - | | `CurveRidgelineRow` | - | | `CurveRidgeline` | - | | `CurveRidgelinePaintOptions` | - | | `SpreadRiverSeries` | - | | `SpreadRiverOptions` | - | | `SpreadRiverPoint` | - | | `SpreadRiverRow` | - | | `SpreadRiver` | - | | `SpreadRiverPaintOptions` | - | | `BondScreenerEntry` | - | | `BondScreenerRow` | - | | `CurveSnapshotInput` | - | | `CurveSnapshotOptions` | - | | `CurveSnapshotSeries` | - | | `CurveSnapshot` | - | | `CurveSnapshotPaintOptions` | - | | `SpreadPair` | - | | `SpreadStripInput` | - | | `SpreadStripRange` | - | | `SpreadStripOptions` | - | | `SpreadStripPoint` | - | | `SpreadStrip` | - | | `SpreadStripPaintOptions` | - | | `CurveSurfaceEntry` | - | | `CurveSurfaceOptions` | - | | `CurveSurfaceRow` | - | | `CurveSurface` | - | | `CurveSurfacePaintOptions` | - | | `YieldMapEntry` | - | | `YieldMapOptions` | - | | `YieldMap` | - | | `YieldMapIsolinePoint` | - | | `YieldMapIsoline` | - | | `YieldMapPaintOptions` | - | ## Constants (152) | Symbol | What it does | | --- | --- | | `COMPASS_DEFAULT_TENORS` | Tenor angles of the radar. | | `COMPASS_MAX_SERIES` | - | | `COMPASS_MIN_VERTICES` | - | | `COMPASS_RING_COUNT` | Rings of the polar grid and their tone. | | `COMPASS_RING_ALPHA` | - | | `COMPASS_SPOKE_ALPHA` | - | | `COMPASS_ACTIVE_FILL_ALPHA` | The active ring is the single filled one. | | `COMPASS_MUTED_LINE_ALPHA` | - | | `COMPASS_HERO_WIDTH` | - | | `COMPASS_MUTED_WIDTH` | - | | `COMPASS_VERTEX_RADIUS` | - | | `COMPASS_TENOR_LABEL_MIN_PX` | Tenor chips need this much panel width. | | `COMPASS_LABEL_GAP_PX` | - | | `COMPASS_PAD_SHARE` | Share of the radius kept free for the tenor chips. | | `COUNTRY_REGION_GAP` | Vertical gap between regional clusters (S102). | | `COUNTRY_REGION_TITLE_MIN_PX` | Cluster titles need this much panel width. | | `COUNTRY_REGION_FONT_PX` | - | | `COUNTRY_MIN_ALPHA` | Intensity floor and slope of a coloured tile (BOND-VISUALS §2: 0.06 + 0.5 t). | | `COUNTRY_INTENSITY_ALPHA` | - | | `COUNTRY_FLAT_ALPHA` | Quiet tile exactly on the neutral centre (text 0.04). | | `COUNTRY_VALUE_MIN_PX` | A tile shows its value only from this size (BOND-VISUALS §2). | | `COUNTRY_VALUE_FONT_PX` | - | | `COUNTRY_ACTIVE_EDGE` | Edge width of the active tile (BOND-VISUALS §2: 2 px accent). | | `COUNTRY_DEFAULT_COLUMNS` | Defaults of the tile grid. | | `COUNTRY_DEFAULT_GAP` | - | | `COUNTRY_DEFAULT_PADDING` | - | | `CREDIT_CORRIDOR_ALPHA` | Quiet corridor of each series (BOND-VISUALS §2: text 0.10). | | `CREDIT_STRESS_ALPHA` | Stress zone underlay (BOND-VISUALS §2: down 0.06). | | `CREDIT_LINE_WIDTH` | Width of the two lines; the glow belongs to HY alone. | | `CREDIT_HY_GLOW_BLUR` | - | | `CREDIT_HY_GLOW_ALPHA` | - | | `CREDIT_MAX_DOT_RADIUS` | Radius of the window-maximum dot. | | `CREDIT_MARKER_GAP` | Gap between the maximum dot and the bottom of its bp chip. | | `CREDIT_PAD_SHARE` | Vertical padding of the shared domain, as a share of the bp span. | | `DECOMP_REAL_ALPHA_TOP` | Gradients of the two stacked parts (BOND-VISUALS §2), top -> bottom. | | `DECOMP_REAL_ALPHA_BOTTOM` | - | | `DECOMP_REAL_ALPHA_FLAT` | - | | `DECOMP_EXPECTED_ALPHA_TOP` | - | | `DECOMP_EXPECTED_ALPHA_BOTTOM` | - | | `DECOMP_EXPECTED_ALPHA_FLAT` | - | | `DECOMP_EDGE_ALPHA` | Light 1 px edge on the top of the stack (BOND-VISUALS §2). | | `DECOMP_BAR_WIDTH_SHARE` | Bar width as a share of the slot between the samples (clamped 1..18 px). | | `DECOMP_BAR_WIDTH_MAX` | - | | `DECOMP_LABEL_MIN_PX` | A share label needs this much block height. | | `DECOMP_LABEL_FONT_PX` | - | | `DECOMP_PAD_SHARE` | Vertical padding of the domain, as a share of the value span. | | `DECOMP_SHEEN_ALPHA` | Diagonal sheen inside the stack (S102, BOND-VISUALS §2). | | `DECOMP_SHEEN_ANGLE_DEG` | - | | `DECOMP_SHEEN_WIDTH_SHARE` | - | | `FAN_ALPHA_MIN` | Muted alpha of the oldest line and of the one just before the hero. | | `FAN_ALPHA_MAX` | - | | `FAN_PAD_SHARE` | Vertical padding of the domain, as a share of the curve span. | | `FAN_DEFAULT_MAX_LINES` | Longest fan kept; the extra history is thinned evenly, the newest stays. | | `FAN_HERO_GLOW_BLUR` | Hero glow: shadow blur and its share (only when the canvas supports it). | | `FAN_HERO_GLOW_ALPHA` | - | | `MARKET_BUBBLE_RADIUS` | Bubble radius of one issue. | | `MARKET_FAIR_ALPHA` | Alpha of a fair (on-curve) issue. | | `MARKET_LINK_ALPHA` | Connector of the two selected issues. | | `MARKET_CHIP_GAP` | Gap between the connector and its bp chip. | | `BOND_MORPH_DURATION_MS` | Morph duration of the canon, ms. Prefixed: the core ships its own morph. | | `BOND_MORPH_RACE_STEP_MS` | Step of the race mode: the scene advances the frames by this, ms. | | `CHIP_HEIGHT` | Chip geometry and tone of the label capsules (BOND-VISUALS §3). | | `CHIP_RADIUS` | - | | `CHIP_BG_ALPHA` | - | | `CHIP_PAD_X` | - | | `CHIP_FONT_PX` | - | | `PRICE_MODE_PAR` | Par value the price mode reads against: the canonical clean price 100. | | `PULSE_CHIP_GAP` | - | | `PULSE_CHIP_MIN_W` | - | | `PULSE_TONE_ALPHA` | - | | `PULSE_FLAT_ALPHA` | - | | `PULSE_MAX_CHIPS` | - | | `PULSE_DELTA_MIN_H` | The delta line needs this much chip height. | | `PULSE_DELTA_FONT_PX` | - | | `PULSE_CHIP_HEIGHT_MAX` | - | | `PV_WATERFALL3D_SHIFTS` | Default rate scenarios: -25/0/+25 bp around the base yield. | | `PV_WATERFALL3D_LABEL_MIN_WIDTH` | Below this pane width the sum/date labels stay off. | | `PV_WATERFALL3D_LABEL_MAX` | Largest-PV bars of the active scenario that carry a label. | | `RIDGE_DEFAULT_MAX_ROWS` | Longest history kept; the extra rows are thinned evenly, the newest stays. | | `RIDGE_ROW_GAP_SHARE` | Share of a slot left as the gap between bands. | | `RIDGE_ALPHA_FAR` | Alpha of the farthest band and of the one next to the hero. | | `RIDGE_ALPHA_NEAR` | - | | `RIDGE_HERO_WIDTH` | - | | `RIDGE_MUTED_WIDTH` | - | | `RIDGE_LABEL_MIN_PX` | Labels need this much panel width. | | `RIDGE_LABEL_FONT_PX` | - | | `RIDGE_LABEL_PAD_X` | - | | `RIVER_MAX_SERIES` | - | | `RIVER_ROW_GAP_SHARE` | Share of a channel left as the gap between channels. | | `RIVER_ACTIVE_TOP_ALPHA` | Active channel gradient and muted outline. | | `RIVER_ACTIVE_BOTTOM_ALPHA` | - | | `RIVER_MUTED_ALPHA` | - | | `RIVER_ZERO_ALPHA` | - | | `RIVER_EXTREME_RADIUS` | - | | `RIVER_ACTIVE_WIDTH` | - | | `RIVER_MUTED_WIDTH` | - | | `RIVER_CHIP_MIN_PX` | Bp chips on the extremes need this much panel width. | | `RIVER_CHIP_GAP` | - | | `BOND_SCREENER_COLUMNS` | Screener columns of the bonds kit; the host renders and sorts them. | | `SNAPSHOT_MUTED_ALPHA_MIN` | Muted alpha of the oldest curve and of the one just before the hero. | | `SNAPSHOT_MUTED_ALPHA_MAX` | - | | `SNAPSHOT_PAD_SHARE` | Vertical padding of the domain, as a share of the curve span. | | `SNAPSHOT_HERO_ALPHA_TOP` | Hero underlay gradient (BOND-VISUALS §2): top alpha -> bottom alpha. | | `SNAPSHOT_HERO_ALPHA_BOTTOM` | - | | `SNAPSHOT_HERO_ALPHA_FLAT` | Flat fallback of the underlay when gradients are unavailable. | | `SNAPSHOT_POINT_RADIUS` | Hero marker geometry: dot radius, halo radius and its alpha. | | `SNAPSHOT_HALO_RADIUS` | - | | `SNAPSHOT_HALO_ALPHA` | - | | `SNAPSHOT_LABEL_GAP_PX` | Term label: gap between the point and the bottom of its chip. | | `STRIP_BAR_ALPHA_BASE` | Base and tip alpha of a bar: the tip of the move carries the accent. | | `STRIP_BAR_ALPHA_TIP` | - | | `STRIP_BAR_ALPHA_FLAT` | Flat share of the bar when the canvas cannot paint gradients. | | `STRIP_ZONE_ALPHA` | Underlay of the inversion zones: everything below the threshold (BOND-VISUALS §2). | | `STRIP_RECESSION_ALPHA` | Quiet plate of a recession range and its year label. | | `STRIP_RECESSION_FONT_PX` | - | | `STRIP_RECESSION_LABEL_MIN_PX` | Narrowest recession range that still earns a year label. | | `STRIP_BAR_WIDTH_SHARE` | Width of a bar as a share of the slot between the samples (clamped 1..12 px). | | `STRIP_MARKER_RADIUS` | Radius of the current marker and its halo. | | `STRIP_HALO_RADIUS` | - | | `STRIP_HALO_ALPHA` | - | | `STRIP_ZERO_ALPHA` | Alpha of the zero line. | | `STRIP_EXTREME_RADIUS` | Dot radius of the extremes. | | `STRIP_EXTREME_ALPHA` | - | | `SPREAD_PAIRS_DEFAULT` | The two canonical readings of the Treasury curve. | | `STRIP_PAD_SHARE` | The value is in the domain share of the padded span, either sign. | | `SURFACE_DEFAULT_MAX_ROWS` | Longest surface kept; the extra history is thinned evenly, the newest stays. | | `SURFACE_SKEW_PX` | Depth offsets of one step back, pixels: right and up. | | `SURFACE_LIFT_PX` | - | | `SURFACE_ALPHA_FAR` | Muted alpha of the farthest and the nearest (pre-hero) curve. | | `SURFACE_ALPHA_NEAR` | - | | `SURFACE_UNDERLAY_ALPHA` | Flat underlay of the front curve (BOND-VISUALS §2: accent 0.04). | | `SURFACE_HERO_WIDTH` | Width of the front curve and of the muted rows, and the dot radius. | | `SURFACE_MUTED_WIDTH` | - | | `SURFACE_FRONT_DOT_RADIUS` | - | | `SURFACE_PAD_SHARE` | Vertical padding of the domain, as a share of the yield span. | | `SURFACE_FOG_ALPHA` | Fog of depth: a quiet background wash towards the far edge (S102). | | `SURFACE_EDGE_ALPHA` | Light edge above the hero line (BOND-VISUALS §2 highlight). | | `SURFACE_PLENUM_ALPHA` | Isometric mesh of the floor under the rows (S102 plenum). | | `SURFACE_YEAR_CHIP_GAP` | Inset of a year chip from the frame edge; the chip font. | | `SURFACE_YEAR_LABEL_FONT_PX` | - | | `SURFACE_YEAR_LABEL_MIN_PX` | Year chips need this much panel width. | | `YIELD_MAP_DEFAULT_COLUMNS` | Longest history kept; the extra dates are thinned evenly, the newest stays. | | `YIELD_MAP_ROW_COUNT` | Tenor grid lines (rows of the heatmap). | | `YIELD_MAP_LOW_PCT` | Percentile bounds of the colour domain (outliers do not stretch it). | | `YIELD_MAP_HIGH_PCT` | - | | `YIELD_MAP_FLAT_ALPHA` | Cell tones: quiet exactly on the centre, 0.06 + 0.5 t away from it. | | `YIELD_MAP_MIN_ALPHA` | - | | `YIELD_MAP_INTENSITY_ALPHA` | - | | `YIELD_MAP_LEVEL_STEP` | Isolines of the level contour: 1 pp step, thin text-toned line. | | `YIELD_MAP_ISOLINE_ALPHA` | - | | `YIELD_MAP_LEVEL_LABEL_MIN_PX` | Level chips appear only on panels at least this wide. | | `YIELD_MAP_LEVEL_LABEL_GAP` | - | --- # "Portfolio kit API (@unifin/chart-kit-portfolio)" (Shared edition) Source: /docs/api/chart-kit-portfolio Generated from the package entry `packages/chart-kit-portfolio/src/index.ts`. Names are reachable through `@unifin/chart-kit-portfolio`; use your editor for full signatures - this page carries the map. ## Functions (38) | Symbol | What it does | | --- | --- | | `correlationGrid` | Labels plus a square correlation matrix to a heatmap grid. The value is clamped to `-1..1`, a non-finite cell stays neutral (not tinted) and the diagonal is forced to 1 - a correlation matrix that disagrees with itself is a data error, not a figure. With an asymmetric input the upper triangle wins, because that is the triangle the labels read against. | | `paintCorrelationMatrix` | Paints the correlogram: the shared heatmap painter with the diverging tone. | | `riskContributions` | Relative risk contributions of the weights under the covariance matrix. The covariance is symmetrised first (a covariance matrix is symmetric by definition, and a host that feeds half of it should not change the answer), the weights are normalised to sum one, and a portfolio with zero variance has no decomposition at all - the function returns `[]` instead of dividing by zero. A non-finite weight or matrix entry drops the asset. | | `paintRiskDecomposition` | Draws the contributions as signed columns from zero: the tone follows the sign (a hedged asset contributes negatively) and the bar geometry comes from the analytic series family. Returns the number of painted columns. | | `monteCarloCone` | Simulates `paths` geometric random walks and returns the median path plus the nested confidence bands. `steps` below one, `paths` below one, a non-finite start or a non-positive volatility return an empty cone (the caller paints the no-data state); `volatility = 0` collapses every band onto the drift path. | | `monteCarloJob` | Same simulation in flat typed arrays for a worker: the job is structured-clone safe and its buffers can be transferred instead of copied. The math is one implementation - `monteCarloCone` and `monteCarloJob` differ only in the shape they hand back, so a host may compute in a worker and validate in the main thread without divergence. | | `coneFromJob` | Points the painter as before, rehydrated from a job result (once per result). | | `monteCarloJobTransferables` | Buffers of a job, for `postMessage(job, transferables)`: each buffer appears once, so a host never lists the same array twice (a duplicate transfer list is rejected by the structured clone algorithm). | | `paintMonteCarloCone` | Paints the cone through the fan chart of the analytic family. | | `attributionRows` | Rows of an attribution table. The share is the step value over the largest span of the bridge, so a negative step reads as a negative share; the cumulative column is the running level of `waterfallSpans` and therefore ends on the bridge total. A step with a non-finite value never reaches this table (the span builder drops it), and a bridge without usable steps is an empty table rather than an exception. | | `allocationShares` | Shares of the entries; non-finite or negative values count as zero. | | `allocationColor` | Theme palette cycled across the slices (accent, growth, warn, fall, muted). | | `treemapRects` | Binary partition treemap: the list is split at the cumulative midpoint and the split axis alternates with depth (own implementation, no foreign code). | | `paintTreemap` | - | | `paintStackedBar` | Paints a horizontal stacked bar; returns the segment count. | | `paintAllocationDonut` | Paints the allocation donut. The ring is drawn as pie slices with the inner circle punched out by the theme background; without `arc` in the context the painter degrades to a stacked bar of the same width as the diameter. | | `benchmarkCurves` | Indexes both series to 100 and pairs them as analytic samples. | | `paintBenchmarkCurves` | Paints the benchmark first and the portfolio on top; returns the points. | | `monthlyHeatmap` | Builds the rectangular grid from monthly returns (any order). | | `monthlyGrid` | Adapter to the shared heatmap family (, ): the kit grid maps onto `HeatmapGridLike` so hosts can paint it with `paintHeatmapGrid` instead of the kit-local painter. Missing months become zeros (painted as nothing); the intensity cap carries over. | | `paintReturnsHeatmap` | Paints the grid: cells, month headers (EN letters) and year labels. | | `periodReturns` | Simple period-over-period returns of a value series (length - 1 items). | | `cumulativeReturn` | Cumulative return of the series: last over first minus one. | | `indexToBase` | Indexes the series to the given base value (default 100). | | `drawdownSeries` | Drawdown from the running peak for every point (0 or negative). | | `maxDrawdown` | Maximum drawdown of the series (negative number or zero). | | `mean` | - | | `variance` | Sample variance (n - 1 denominator). | | `annualizedVolatility` | Annualised volatility: sample standard deviation times sqrt(periods). | | `sharpeRatio` | Sharpe ratio: annualised mean excess return over its annualised volatility. | | `sortinoRatio` | Sortino ratio: annualised mean excess return over the annualised downside deviation (root mean square of the negative excess returns). | | `covariance` | Covariance of two equal-length series (sample denominator). | | `beta` | Beta of the asset returns against the benchmark returns. | | `relativeStrength` | Relative strength of indexed series: asset index over benchmark index. | | `buildPositionRows` | Input order is kept: sorting is the host's controlled step. | | `underwaterPoints` | Drawdown points in percent: x is the sample index, y is 0 or negative. | | `underwaterZeroLine` | Zero line paired with the drawdown points for the band fill. | | `paintUnderwater` | Paints the underwater ribbon (0..drawdown) and its outline. | ## Types (14) | Symbol | What it does | | --- | --- | | `MonteCarloSpec` | Monte Carlo cone of the portfolio kit ( / CHT-22-17, §1-2): the quantile bands of simulated price paths. The generator is seeded, so the same spec always yields the same cone - a scenario chart that changes on every repaint would be unreadable and unverifiable. The simulation is a scenario, never a forecast. | | `MonteCarloBands` | - | | `MonteCarloJob` | Flat, transferable cone: the same simulation in typed arrays, so a host can run it in a worker and hand the buffers over without a per-point copy (`monteCarloJobTransferables`). The painter consumes the point form, built once per result with `coneFromJob`. | | `AttributionRow` | Attribution table of the portfolio kit ( / CHT-22-18, §2): the steps of a performance bridge as table rows - the step value, its share of the bridge, the running level and the kind of the step. The base arithmetic stays in `waterfallSpans`, so the table and the waterfall can never disagree. | | `AllocationEntry` | - | | `AllocationShare` | One slice: value, its share of the total and the cumulative range 0..1. | | `TreemapRect` | - | | `DonutOptions` | - | | `BenchmarkCurves` | - | | `MonthlyReturn` | - | | `HeatmapGrid` | - | | `HeatmapPaintOptions` | - | | `PositionEntry` | - | | `PositionRow` | - | ## Constants (5) | Symbol | What it does | | --- | --- | | `CORRELATION_MAX` | Correlation is bounded by definition, so the diverging scale is 1. | | `MONTE_CARLO_PATH_LIMIT` | Upper bound on the simulated paths; a bigger request is clamped, not refused. | | `MONTE_CARLO_DEFAULT_PATHS` | Default path count of a cone that stays inside the frame budget. | | `MONTE_CARLO_LEVELS` | Quantile levels of the bands, widest first (80% then 50%). | | `POSITION_COLUMNS` | Positions columns of the portfolio kit; the host renders and sorts them. | --- # "Options kit API (@unifin/chart-kit-options)" (Shared edition) Source: /docs/api/chart-kit-options Generated from the package entry `packages/chart-kit-options/src/index.ts`. Names are reachable through `@unifin/chart-kit-options`; use your editor for full signatures - this page carries the map. ## Functions (33) | Symbol | What it does | | --- | --- | | `buildOptionChainRows` | Input order is kept: sorting is the host's controlled step. | | `smileCurve` | Smile model: atm + skew * ln(K/S) + curvature * ln(K/S)^2. | | `termStructure` | Term structure model: atm + slope * T (own demo-grade shape). | | `smilePoints` | Smile points as analytic samples (x = strike, y = iv). | | `termPoints` | Term points as analytic samples (x = years, y = iv). | | `paintIvSmile` | Paints the smile. | | `paintIvTerm` | Paints the term structure. | | `ivSurface` | Surface from the smile and term models: each expiry gets its own smile. | | `paintIvSurface` | Paints the surface as an accent-tinted heatmap with strike/expiry labels. | | `normCdf` | Standard normal cumulative distribution. | | `normPdf` | Standard normal density. | | `intrinsic` | Intrinsic value at expiry. | | `bsPrice` | Black-Scholes price; degenerate inputs fall back to the intrinsic value. | | `bsDelta` | Delta: the spot sensitivity (0..1 for calls, -1..0 for puts). | | `bsGamma` | Gamma: the delta sensitivity (same for calls and puts). | | `bsVega` | Vega per one unit of volatility (divide by 100 for a vol point). | | `bsTheta` | Theta per year (divide by 365 for a calendar day). | | `bsRho` | Rho per one unit of the rate (divide by 100 for a rate point). | | `impliedVol` | Implied volatility solved by bisection; NaN when the market price sits below the no-arbitrage lower bound or the inputs are degenerate. | | `oiPoints` | Split-bar samples: x = strike index shifted per side, y signed. | | `oiTotals` | Totals of the table: calls, puts (absolute) and the net. | | `maxOi` | Largest single value of the table (for the Y domain of the host). | | `paintOpenInterest` | Paints the split bars (calls up, puts down). | | `legValue` | Value of one leg at the given spot (premium already subtracted). | | `payoffAt` | Total payoff of the position at the given spot. | | `payoffCurve` | Sampled payoff curve; empty for a degenerate range. | | `breakevens` | Zero crossings of the curve with linear interpolation (grid precision). | | `profitZones` | Segments of the curve above zero, edges interpolated at the crossings. | | `paintPayoffZones` | Paints the gain and loss ribbons of the payoff: gain zones grow up from the zero line in the up colour, loss zones hang below it in the down colour. Returns the number of painted ribbons; a zero-width span paints nothing. | | `paintPayoff` | Paints the payoff curve itself. | | `paintPayoffPair` | Paints the expiry and the "now" curves (expiry accent, now muted). With `zoneGradient` the ribbon under the active (expiry) curve becomes a ramp dense at the curve and soft at the zero line (S105, ); the ramp is off by default and the return counts the curve samples only. | | `greekProfile` | Samples a greek across strikes or spot prices. | | `paintGreekProfile` | Paints the greek profile as a curve. | ## Types (26) | Symbol | What it does | | --- | --- | | `OptionChainQuote` | - | | `OptionChainStrike` | - | | `OptionChainContext` | - | | `ChainMoneyness` | - | | `OptionChainRow` | - | | `SmilePoint` | - | | `TermPoint` | - | | `IvCurveOptions` | Options of the IV curve painters; the bare curve is the default. | | `IvSurface` | - | | `SurfacePaintOptions` | - | | `OptionType` | Option math of the options kit ( §2, ): the Black-Scholes price and greeks on the public 1973 formula plus an own implied-volatility solver. Reference values and properties (put-call parity, monotonicity) live in tests/options-math.test.ts; provenance - §2.10. | | `BsParams` | Standard Black-Scholes inputs: spot, strike, years, rate, volatility. | | `StrikeOiRow` | - | | `OiMode` | - | | `OpenInterestOptions` | Options of the open-interest painter; the flat fill is the default. | | `LegKind` | - | | `OptionLeg` | One leg: signed quantity, strike for options, premium paid per unit. | | `PayoffMode` | - | | `NowParams` | Parameters of the "now" valuation (remaining time, rate, volatility). | | `PayoffCurveOptions` | - | | `ProfitZone` | - | | `PayoffZoneStyle` | Zone style of the payoff painter; the flat fill is the compatible default. | | `GreekName` | - | | `ProfileAxis` | - | | `ProfileParams` | - | | `ProfileRange` | - | ## Constants (12) | Symbol | What it does | | --- | --- | | `CHAIN_COLUMNS` | Chain columns of the options kit; the host renders and sorts them. | | `IV_UNDERLAY_ALPHA_TOP` | Underlay shares of the smile and the term curve (S105, ): the ribbon under the curve is dense at the line and soft at the plot bottom. | | `IV_UNDERLAY_ALPHA_BOTTOM` | - | | `IV_FRAME_UNDERLAY_ALPHA` | Wash of the surface frame over the heat cells (S105, ). | | `IV_ROW_EDGE_ALPHA` | Light edge of the row picked by the host (S105, ). | | `OI_BAR_ALPHA_TOP` | Bar ramp shares of the open interest (S105, ): dense at the tip of every bar, soft towards the baseline; the role colour stays the theme one. | | `OI_BAR_ALPHA_BOTTOM` | - | | `PAYOFF_ZONE_ALPHA_TOP` | Zone fills of the payoff (S105, ): the ramp is dense at the curve and fades towards the zero line, so the ribbons read as light. | | `PAYOFF_ZONE_ALPHA_ZERO` | - | | `PAYOFF_ZONE_FLAT_ALPHA` | Flat ribbon alpha: the host default and the canvas gradient degradation. | | `PAYOFF_PAIR_ALPHA_CURVE` | Underlay of the active curve of a pair: dense under the curve, soft at zero. | | `PAYOFF_PAIR_ALPHA_ZERO` | - | --- # "Swaps kit API (@unifin/chart-kit-swaps)" (Shared edition) Source: /docs/api/chart-kit-swaps Generated from the package entry `packages/chart-kit-swaps/src/index.ts`. Names are reachable through `@unifin/chart-kit-swaps`; use your editor for full signatures - this page carries the map. ## Functions (24) | Symbol | What it does | | --- | --- | | `swapPeriods` | Accrual periods from the start date; a negative tenor or step gives no periods. | | `sideOf` | Side factor of the holder: the payer of the fixed leg sees the fixed amounts negative. | | `swapSchedule` | Full schedule of both legs. The floating leg needs the projected rate of every period: the caller passes a reader (`rateOf`), and without one the floating leg is built with a zero rate so the schedule still describes its shape. | | `netFlows` | Net flows of the swap by payment date. The two legs of a plain vanilla swap share their dates, and the reader wants the net - the two gross rows stay in the result so a report can still show them. | | `flowsTotal` | Total of one leg or of the net, ignoring non-finite amounts. | | `flatCurve` | Flat curve of one continuous zero rate, valid for every horizon. | | `zeroCurve` | Curve from quoted points: sorted by horizon, non-finite points dropped. | | `zeroRateAt` | Continuous zero rate at a horizon: linear between the quoted points and flat outside them, which is what a panel of a swap book shows before bootstrapping. | | `discountFactor` | Discount factor of a horizon: the exponential of the zero rate. | | `flowYears` | Years between the valuation date and a payment date. | | `forwardRate` | Forward rate of one accrual period implied by the curve (single-curve bootstrapping identity): the ratio of the two discount factors over the accrual. It is NaN when the accrual is not positive. | | `presentValue` | Present value of one leg at the valuation date. | | `swapNpv` | Net present value of a swap: both legs discounted and their net. | | `cumulativePv` | Cumulative present value of the net flows, one point per payment date: the curve a reader follows to see when the swap has paid for itself. | | `annuityFactor` | Present value of a fixed annuity of one unit of notional (the denominator of a par rate). | | `parSwapRate` | Par swap rate: the fixed rate that makes the two legs equal at the valuation date. The floating leg is rebuilt from the curve, so the answer does not depend on the fixed rate of the terms. | | `swapScheduleOf` | Schedule of a swap whose floating leg is projected from the curve. | | `swapNpvFromCurve` | Net present value of a swap whose floating leg is projected from the curve. | | `legPoints` | Ladder points of one leg: the horizon of the payment against its amount. | | `netPoints` | Net points of the payment dates: what the holder actually pays or receives. | | `cumulativePvPoints` | Points of the cumulative PV curve of the swap. | | `paintSwapLadder` | Bars of the two legs from the zero line; a negative bar is a payment. | | `paintNetArrows` | Marks of the net flows: the amount of every payment date on the palette of the chart, labelled by the caller, because a net figure without its date is useless. An `activeIndex` overpaints one date - the busiest one of the panel. | | `paintCumulativePv` | Cumulative PV as a curve with the points that build it and the S105 ribbon. | ## Types (11) | Symbol | What it does | | --- | --- | | `SwapDirection` | Which side of the swap the holder is on. | | `SwapTerms` | Terms of a plain vanilla swap: one notional, two legs, one frequency. | | `SwapLeg` | - | | `SwapFlow` | One accrual period of one leg, with the amount that falls on its payment date. | | `SwapPeriod` | One accrual period of the swap without a side. | | `SwapSchedule` | - | | `NetFlow` | Net amount on one payment date: the sum of both legs falling on it. | | `ZeroPoint` | One point of a discount curve: continuous zero rate at a horizon in years. | | `DiscountCurve` | A curve of continuous zero rates; one point makes it flat. | | `SwapNpv` | - | | `CumulativePvPoint` | One point of the cumulative PV curve: years from the valuation date and the total. | --- # Android applications (Shared edition) Source: /docs/android This page covers embedding the library into an Android app through a WebView: the page setup, the JavaScript bridge, a verified harness and the limits to know about. Unifin Charts is a browser library: it renders on a canvas through standard web APIs, so a WebView runs it exactly like a desktop browser. No SDK is required. ## How embedding works today 1. Ship the page (or a small bundle) with your app assets, or serve it from your backend. 2. Load it in a `WebView` with JavaScript and DOM storage enabled. 3. Size the WebView to the desired chart area; the renderer adapts to any container size. ```kotlin val webView = WebView(context).apply { settings.javaScriptEnabled = true settings.domStorageEnabled = true settings.mediaPlaybackRequiresUserGesture = false loadUrl("file:///android_asset/chart/index.html") } ``` ```html ``` Communication between the app and the chart uses the standard WebView bridge: `addJavascriptInterface` towards the page and `evaluateJavascript` (or URL schemes) back to the app. ## What to check on device | Area | Recommendation | | --- | --- | | Touch | The element handles pointer input; verify pan, zoom and crosshair with the on-device gestures | | Fonts | Bundle fonts next to the assets - remote font loading is blocked on some networks | | Performance | System WebView versions vary; test frame timing on your oldest target device | | Theme | Pass the app theme into the page and align tokens with your app palette | | Offline | Keep data fetching in the app; feed bars into the page through the bridge | ## Harness example The repository ships a ready harness at `examples/android-webview`: an offline page (assets only, no network), a tiny native bridge and a gradle sample that loads the page from `file:///android_asset/index.html`. | Piece | What it does | | --- | --- | | `src/bridge.mjs` | `window.UnifinHost.setBars(json)`, `setTheme(dark\|light)`, `setSymbol(symbol, timeframe)`; page events `unifin-ready` and the `onCrosshair` hook | | `src/app.ts` | Mounts the element full screen, forwards wheel/pinch zoom, repaints on resize | | `app/MainActivity.kt` | WebView with JavaScript and DOM storage, `addJavascriptInterface`, deterministic demo series | | `node build.mjs` | Builds `assets/app.js` (single IIFE) and copies `index.html` next to it | Verified in automation: the bridge protocol tests (`node --test`), and a touch-enabled browser emulation that loads the built page, sends bars through the bridge, zooms with a wheel event and checks the cursor hook. Checked on a device, confirm the same items: touch pan and zoom feel, cursor readout, fonts bundled with the assets and frame timing on your oldest target WebView. The harness page stays offline by design: keep data fetching in the native layer or in your own page. ## Limitations to know - The `JavascriptInterface` bridge must only be exposed to the offline assets page; never enable it for pages that can navigate to the network. - Some Android builds restrict cookies (FedCM-era changes) - do not rely on cookie-based sessions inside the WebView; authenticate in the native layer and pass data through the bridge. - Very old System WebView versions lack `CustomEvent`; the harness falls back to the `onUnifinBridgeEvent` host hook. > **Caution** Keep the WebView on bundled assets. A page that can reach the network hands the > JavaScript interface to remote code. ## See also - Getting started (/docs/standard/getting-started) - the same page code in a browser. - Custom element (/docs/api/chart-element) - attributes, methods and events the bridge calls. - Editions (/docs/editions) - which entry point to bundle into the app assets. --- # iOS applications (Shared edition) Source: /docs/ios This page covers embedding the library into an iOS app through a `WKWebView`: the page setup, the Swift host, the bridge protocol and the limits to know about. Unifin Charts is a browser library: it renders on a canvas through standard web APIs, so a `WKWebView` runs it exactly like Safari on the same OS version. No SDK and no network access are required. ## How embedding works today 1. Ship the page with your app bundle, or serve it from your backend. 2. Load it in a `WKWebView` with JavaScript enabled and read access limited to the asset folder. 3. Size the view to the chart area; the renderer adapts to any container size. 4. Push data in through `window.UnifinHost` and read the cursor hook back through a message handler. ```swift let configuration = WKWebViewConfiguration() configuration.defaultWebpagePreferences.allowsContentJavaScript = true let webView = WKWebView(frame: .zero, configuration: configuration) webView.scrollView.contentInsetAdjustmentBehavior = .never webView.loadFileURL(pageURL, allowingReadAccessTo: assetDirectoryURL) ``` The page itself is platform neutral: the same `index.html` and `app.js` that the Android page (/docs/android) documents run here unchanged. ## The bridge protocol | Call | Direction | What it does | | --- | --- | --- | | `window.UnifinHost.setBars(json)` | native to page | Parses a bar array, filters malformed entries and repaints; returns the accepted bar count | | `window.UnifinHost.setTheme('dark' \| 'light')` | native to page | Switches the palette without rebuilding the chart | | `window.UnifinHost.setSymbol(symbol, timeframe)` | native to page | Updates the watermark, axis labels and accessible name | | `window.UnifinHost.onCrosshair(handler)` | page to native | Registers the cursor readout hook | | `window.onUnifinBridgeEvent(kind, detail)` | page to native | State changes, including `ready` | Android reaches the page-side function through `addJavascriptInterface`. On iOS the host injects a one-line bootstrap script at document start and forwards the events into a `WKScriptMessageHandler`: ```swift configuration.userContentController.add(bridge, name: "unifinBridge") configuration.userContentController.addUserScript( WKUserScript( source: """ window.onUnifinBridgeEvent = function (kind, detail) { window.webkit.messageHandlers.unifinBridge.postMessage({ kind: kind, detail: detail || {} }); }; """, injectionTime: .atDocumentStart, forMainFrameOnly: true ) ) ``` Sending data uses the same two calls as the Android host: ```swift webView.evaluateJavaScript("window.UnifinHost.setBars(\(jsonLiteral))") webView.evaluateJavaScript("window.UnifinHost.setTheme(\"light\")") ``` > **Note** `evaluateJavaScript` runs on the main thread. Keep the host methods on the main queue and > the JSON payload free of non-finite numbers - the page drops bars that fail validation instead of > blanking the chart. ## Host script The repository ships the Swift host next to the Android harness: | Piece | What it does | | --- | --- | | `examples/ios-webview/ios/ChartBridge.swift` | `WKWebView` host: loads the bundled page, injects the bootstrap hook, drives `setBars`/`setTheme`/`setSymbol` and publishes the cursor readout | | `examples/ios-webview/README.md` | Wiring steps, the shared page assets and the verified scope | | `examples/android-webview/*` | The page and the build step both platforms use | ## What to check on device | Area | Recommendation | | --- | --- | | Touch | The element handles pointer input; verify pan, zoom and crosshair with on-device gestures | | Safe area | Set `contentInsetAdjustmentBehavior = .never` and inset the container yourself, so the axis never slides under the home indicator | | Fonts | Bundle fonts with the page assets - the chart reads them through the same CSS stack | | Performance | Test frame timing on the oldest supported iOS version and on the smallest target device | | Background | Pause your feed when the scene goes to the background; the page keeps painting only when it is visible | | Offline | Keep data fetching in the native layer and feed bars through the bridge | ## Limits to know - The chart page must stay on bundled assets or on a host you control. Never load a remote page that can post messages into the same handler. - Do not enable `allowsBackForwardNavigationGestures` on a chart page: a swipe navigates away and drops the data set. - The page has no session of its own: authenticate in the native layer and pass data through the bridge, exactly as the Android host does. - The Swift host is a documented starting point, not a compiled target: the pipeline has no macOS runner. Its protocol is the one the page and the Android harness tests verify. ## See also - Android applications (/docs/android) - the same page in a WebView, with the shipped harness. - Custom element (/docs/api/chart-element) - attributes, methods and events the bridge calls. - Editions (/docs/editions) - which entry point to bundle into the app assets. --- # AI-assisted development (Shared edition) Source: /docs/ai Unifin Charts ships machine-readable documentation for AI coding assistants. Point your assistant at the files below and it can answer API questions, write embedding code and diagnose integration issues without guessing. ## Machine-readable artifacts | File | Purpose | | --- | --- | | `/llms.txt` | Compact index: every documentation page with its URL and one-line summary | | `/llms-full.txt` | Full documentation text in one file - paste into a chat or load into a RAG index | Both files are generated from this portal during every build, so they always match the published pages and the current package version. ## Ready-made prompts Copy one of these into your assistant together with the relevant file: ```text Context: llms-full.txt for the version you installed (the artifacts carry it). Task: write a React component that renders a 5-minute candles chart for symbol AAPL with the light theme, a 480 px height and an instrument with tickStep 0.01. Use only APIs that exist in the documentation; list the imports explicitly. ``` ```text Context: llms.txt for Unifin Charts. Task: I embed charts into a Next.js app that renders on the server. Explain which packages are safe to import in a server component and where the chart itself must be created. Quote the page section you rely on. ``` ```text Context: llms-full.txt for Unifin Charts. Task: my bundle budget is 6 KB gzip for the chart. Which entry point should I import, which features become unavailable, and how do I render a footprint chart in that budget? ``` ## Ground rules for assistants - **Prefer the documentation over assumptions.** The API surface is small but specific: `UnifinChart` props, `unifin-chart` attributes, `Canvas2DRenderer` frame options. - **Check the version.** The artifacts carry the version they were generated for; regenerate or re-download them when you upgrade. - **No invented methods.** If a method is not in `llms-full.txt`, it does not exist in that release. - **Editions matter.** Ask the assistant to state which entry point (`light`, `pro`, root) its answer targets and whether the feature belongs to Standard or Pro. ## Feeding the docs into an IDE assistant 1. Download `/llms-full.txt` (/llms-full.txt) into your project (for example `docs/unifin/`). 2. Reference it from your assistant rules file (`AGENTS.md`, `.cursor/rules`, workspace instructions) with one line: `Unifin Charts reference: docs/unifin/llms-full.txt`. 3. Ask follow-up questions without re-pasting the file - the assistant reads it from the workspace. See API overview (/docs/api) for the objects an assistant will most often reference. ## See also - API overview (/docs/api) - the objects behind most answers. - Getting started (/docs/standard/getting-started) - the first working example to compare answers against. - Versions (/docs/versions) - how to check which release an answer applies to. --- # Versions (Shared edition) Source: /docs/versions This page lists the versions of the published packages and explains how the documentation stays in step with them. ## How versions work | Rule | Behaviour | | --- | --- | | Lockstep | Every `@unifin/*` package carries the same version number | | Editions | Standard, Pro, the root compatibility entry and the core share that number | | Compatibility | Breaking changes are released in major versions only | | Documentation | Each page records the release it was verified against | ## Editions and where they live | Entry point | Import | Contents | | --- | --- | --- | | Standard | `@unifin/chart-react/standard` | Base charting: 24 series types, scales, panes, sparkline and mini profiles, grid, sync groups (the same entry also publishes as `/light`) | | Pro | `@unifin/chart-react/pro` | Standard plus workspace layouts, replay, order flow, profiles, alerts, trading UI, LINK | | Root | `@unifin/chart-react` | The Standard surface plus the palette registry; the compatibility entry for hosts of earlier majors - Pro lives in `/pro` | The core (`@unifin/chart-core`) is shared by all editions. The domain kits - `@unifin/chart-kit-bonds`, `@unifin/chart-kit-portfolio` and `@unifin/chart-kit-options` - are released in the same lockstep and appear in the table above. ## Keep documentation in sync - The table is generated from the package manifests during the portal build, so it cannot drift by hand. - Every page carries `synced` in its frontmatter: the release the page was verified against. - The portal review step compares `synced` with the current version and reports pages that lag behind. See Changelog (/docs/changelog) for what changed in each release. ## See also - Changelog (/docs/changelog) - notable changes per release. - Editions (/docs/editions) - entry points and surfaces. - Getting started (/docs/standard/getting-started) - install the packages. --- # Changelog (Shared edition) Source: /docs/changelog What changed per release, newest first. One version covers every package: Versions (/docs/versions). ## Unreleased - The Pro desk chart controls moved into a strip above the plot: the readouts stay visible, the strip and the canvas never overlap, and the dock keeps its role gradients in both themes (Pro desk (/docs/pro)). - The fixed-income readings go live and full width: one figure per row with hover readouts, and the eight yield-map formats answer the pointer through the exact geometry of their painters (Fixed income kit (/docs/kits/bonds)). - The options desk and kit panels follow the 200 ms tween: the volatility slider ramps the smile and the now curve, a strike click re-pins the payoff, and `?frozen=1` keeps the frames still for captures (Options kit (/docs/kits/options)). - Four kits gain gradient fills: the swap ladder and PV ribbon, the underwater band and the benchmark underlay, the allocation ramps with the light edge, the payoff zones and OI bars, and the IV underlays. The heat maps and the correlation terrain take a single diagonal frame sheen - never per cell; a canvas without a gradient API keeps the flat fills. - The benchmark fan 3D joins the bonds kit (`./fan3d`): curves recede in depth with gradient skirts and halo markers. The IV surface labels its strikes, expiries and vol ticks, and the correlation terrain carries the frame sheen (Fixed income kit (/docs/kits/bonds)). - The yield-curve dynamics walks up to ten pinned dates with a 750 ms step and a fading trace; the solution stays within its budget (10.91 of 11 KB). - Budgets after the wave: swaps 2.63 of 10, portfolio 4.79 of 8 KB, the fan3d subpath 1.77 of 3, the options formats 2.43 of 3 KB, and one host payload at 192.95 of 196 KB (Versions (/docs/versions)). ## 26.10.18 - A study is a definition of host code: register it in the runtime registry and it appears in the indicator dialog next to the catalogue, with its editable number, boolean and select inputs. Broken definitions and unknown parameters are refused with the name, the kind and the declared range - nothing is executed from data (Research studies (/docs/pro/research)). - The strategy language turns an idea into data: inputs, `entry` and `exit` rules built from the alert conditions (`and`/`or` groups), a `risk` block, errors with line and column, stable round-trip, declared rule limits and no code path at all (Strategies and backtest (/docs/pro/strategy)). - The backtest engine walks the rules over historical bars with commission and slippage on every trade, leverage and a margin gate, the stop checked before the target inside a bar, and reports trades, win rate, P&L, profit factor, drawdown, Sharpe and the equity curve. History arrives through a paged source with named failures; `BacktestPanel` reads the result and computes nothing. - The template gallery ships four study presets (RSI zones, EMA cloud, volatility bands, MA fan) and three strategy presets (EMA cross, range breakout, mean reversion) as data; picking a card fills its parameter form and saving hands the host the resolved parameters. - The research layer ships as `@unifin/chart-core/strategy`; the root entry stays at 146.97 KB gzip of 148 and one host payload at 172.63 of 174, `chart-react/pro` grew to 76.65 of 500. - The bonds kit reads a curve history in four premium formats: the hero snapshot with the labelled curves, the dated fan with the fade of age, the 10Y-2Y spread strip with its inversion zone and the IG/HY credit panel with the stress runs (Fixed income kit (/docs/kits/bonds)). - Eight yield-map formats ride the same page: the topo map with level isolines, the ridgeline echo, the shape compass, the surface with fog and year chips, the inversion river, the nominal split, the country globe and the tenor pulse - each one a pure model plus a painter over the host scales. - The yield constellation floats glowing issues over the benchmark curve with rich/cheap auras, a hover card and the gradient sea; it ships in the `@unifin/chart-kit-bonds/formats` subpath. The kit root stays at 18.89 KB gzip of 21 and the subpath at 3.34 of 4. - Four analytics figures turn 3D on the kit pages: the IV surface with strikes over expiries, the correlation terrain of an asset matrix, the PV/DV01 bond waterfall under rate shocks and the order book cube of level history. Each one is a live section with drag rotation, angle presets, reset, wheel zoom and a `prefers-reduced-motion` still frame (Options kit (/docs/kits/options), Portfolio kit (/docs/kits/portfolio), Fixed income kit (/docs/kits/bonds), Order book (/docs/pro/orderbook)). - The 3D engine ships as `@unifin/chart-core/scene3d`: an own WebGL2 mesh renderer with a Canvas2D fallback grid, an orthographic camera, painter's-algorithm 2D painters and hard limits (4096 quads, 1024 bars, 400 fallback cells). The subpath stays at 7.16 KB gzip of 12 and the core root at 147.26 of 148. - The options and portfolio 3D formats live in the `formats` subpaths of their kits (1.95 and 2.17 of 3 KB each); the kit roots sit at 3.88 and 3.98, the bonds kit at 20.15 of 21, and one host payload at 190.99 of 192 KB. ## 26.10.17 - Two series types join the Series types (/docs/series-types) catalogue: `spline` with a `tension`, and `lollipop` with a `baseline` and a `radius`. Point-and-figure charts derive the box size and the reversal count from the data unless the options set them. - Session levels and an automatic Fibonacci over detected swings draw on the chart, and a comparison overlay ranks several instruments in one table next to the series. - The pointer snaps to the nearest price and time (`resolveSnap`). Follow mode keeps the last bar in place while a live feed grows, and resumes at the same offset after you scroll away (`resolveFollow`, `resumeFollow`). - The price scale picks its mode (`chooseScaleMode`), aligns the ticks (`tickAlignedTicks`) and compresses session gaps on request (`sessionGaps`, `timeCompression`) without moving the timestamps. - Arrow keys, `Home`, `End` and `PageUp`/`PageDown` move the visible window (`resolveNavDirection`); the keyboard help lists the same combinations. - The visible window carries its own volume profile, and the studies set adds a time and price heat map, flow anomalies, session history, divergence search and a relative-strength pane. - Drawing layers hide a whole group without losing the objects, a note attaches to a bar, pane shares resize by dragging with a full-screen view, and the header fields are configurable. - Orders move on the chart: dragging a stop or a take profit snaps the price (`snapOrderPrice`), a position is sized from the accepted risk (`sizeFromRisk`, `RISK_MIN_PERCENT`..`RISK_MAX_PERCENT`) and the result is previewed before the order goes out (`previewOrderPnl`). - `dataQuality` scores a stream and reports duplicate and out-of-order bars; `readCacheSnapshot` reads the offline cache, and a version 1 cache migrates to version 2 on the first read (`CACHE_SCHEMA_VERSION`). - Price precision follows the instrument (`adaptivePriceDigits`, `formatAdaptive`), a replay scenario restores a window together with its drawings, alert groups collapse into one feed with pane badges, the time slider scrubs a session, and the audit overlay lists every action with its outcome. - Volume effects paint from theme tokens: an isometric heat map, a candle parallax and a depth profile (`buildIsometricGrid`, `parallaxShape`, `depthProfileRows`) on the Pro effects (/docs/pro/effects) page. - A phrase becomes a chart description (`parseAssistantRequest`): the call returns catalogue calls, a confidence and the words it did not understand. No code from the phrase runs. - Workspace models ship as `@unifin/chart-core/workspace` and the React binding as `@unifin/chart-react/workspace` (chart-react reference (/docs/api/chart-react)): fifteen hooks read the host state and return a value or the next pane layout, the state itself stays with the host. - Ceilings: core 143.6 KB gzip of 146, one host payload 169.2 of 172, the workspace binding 0.89 of 8. ## 26.10.16 - Table columns draw figures in the cell (`figure` on `ColumnSpec`); one canvas pool serves the visible rows only. A figure with nothing to draw keeps the number. - Five column kinds: `bp`, `money`, `tenor`, `rating`, `boolean`. A column can be `signed`, carry an `inlineBar`, show status `pills` and `flash` a changed cell - the flash stops under `prefers-reduced-motion`. - A numeric header shows the column distribution (`histogram`) with the median and the brushed range; `Shift` dragging brushes it, sorting keeps three keys, `loadingProgress` draws the load strip. - `createTableChartLink` makes the pointer row, the focused row and the chart cursor one reference; the linked row carries `aria-current`, a cursor group shares the row time. - Twenty-five figures ship in the core, including the volatility surface, the payoff, signed greeks, the futures curve, the correlation heat, the scenario cone, the depot balance, the cash-flow ladder, the limit bar and the agreement scatter. - Reconciliation: `reconcile` (absolute tolerance, an unreadable pair counts as broken), `reasonWaterfall`, `asOfVersion` / `asOfGap` (a book as of a date) and `reconciliationToText`. - A saved view keeps the arrangement of a board (`serializeTableView`, `parseTableView`, `applyTableViewColumns`); a foreign payload restores nothing. - The swaps kit `@unifin/chart-kit-swaps`: schedule, forward rates, present value, par rate, and the day-count calendar in the core. - Ceilings after the bundle diet: core 131.5 KB gzip of 140, Standard 11.78 of 12, Pro 51.29 of 52, one host payload 155.8 of 160. - The swaps kit `@unifin/chart-kit-swaps` joins the bonds, portfolio and options kits: schedule of both legs, forward rates from a curve, present value and par rate, the cumulative PV curve and painters for the ladder of flows and the net arrows. Day-count conventions and month rolling live in the core, so the bond and the swap kit accrue the same way for the same dates. - Entry budgets moved by a documented contract step and the set ceiling now measures one host payload instead of summing alternative entries; the bundle diet is a blocking item of the wave acceptance. The diet held through both waves of the release: core 131.51 KB gzip of 140, the root entry 11.84 of 14, light and standard 11.78 of 12 each, Pro 51.29 of 52 and one host payload 155.80 of 160. ## 26.10.15 - Table cells can carry a figure: fourteen mini figures (`sparkline`, `deltaBar`, `inlineBar`, `microBars`, `heatStrip`, `miniStack`, `scaleMark`, `qualityStrip`, `timelineStrip`, `miniDistribution`, `miniGauge`, `miniWaterfall`, `miniLadder`, `statusFunnel`) ship in the core with a catalogue and one dispatcher, and the Table kit (/docs/kits/table) page shows them live in both palettes together with the linking pattern: a row drives the chart next to it, hover, keyboard and click included. - iOS applications have their own page next to Android: the same offline page and the same four-call bridge run inside a `WKWebView`. It covers the Swift host, the bootstrap script that turns the page events into a `WKScriptMessageHandler` message, the device checklist and the limits. - The professional edition is written as **Pro** everywhere on this site; the entry point name (`@unifin/chart-react/pro`) and the package layout are unchanged. - Parameter guides on the Live effects (/docs/standard/effects) page float above the panel on hover or keyboard focus instead of opening inside it, so reading an explanation no longer moves the controls. - A streaming update no longer drops the pointer readout. The chart binding is kept while the object options describe the same configuration, so inline literals such as `polish={{ leftFade: true }}` or `readout={{ mode: 'line' }}` stop rebuilding it - the crosshair, its price tag and the hover card now live through every tick of a live feed, and only a real change to an option rebuilds the chart. Function options (`timeTickFormatter`, `priceTickFormatter`, callbacks) are compared by reference: wrap them in `useCallback` to keep the binding stable. - Entry ceilings moved by a contract step: root 51 KB gzip, Pro 49 KB, a full set 304 KB. - The newest series types keep their frames in the shared type catalogue and in a per-type directory with a manifest that names the capture script, so the images behind the Series types (/docs/standard/series-types) page can be reproduced on demand. - Every figure and series type carries a measurement log next to the line-wide log, so a performance question about one type can be answered without re-running the whole benchmark. ## 26.10.14 - The scenario cone can now be computed in a worker. `monteCarloJob(spec)` returns the same simulation as flat buffers, `monteCarloJobTransferables(job)` lists them for a `postMessage` that moves the data instead of copying it, and `coneFromJob(job)` rebuilds the point form the painter consumes. Both shapes run through one simulator and agree bit for bit, so a worker result can be checked on the main thread - there is no second implementation to drift. - Measured on the 252 x 1000 reference size: the simulation costs 50.76 ms p50 / 53.12 ms p99 inside the worker, the message plus rebuild 0.0375 ms p50 / 0.3270 ms p99 on the main thread for a 10 KB payload, and the in-frame painter stays at 0.0226 ms p50 / 0.7837 ms p99. ## 26.10.13 - The delta channel reaches the chart binding: `deltas` and `deltaSma` travel from `UnifinChart` down to the series painter, so the `deltaCandles` type renders through a real chart (scales, crosshair, keyboard surface) and `DeltaCandlesPanel` is a thin wrapper over `UnifinChart` again. - Four risk panels for terminals: `CorrelationPanel`, `RiskDecompositionPanel`, `ScenarioConePanel` and `AttributionPanel`. The last one is a table on the shared `DataTable`, so sorting and screen reader support come from the control kit instead of a second table implementation. - The risk figures themselves moved into the core (`render/risk`), where the other figure painters live, because the React binding depends on the core only; the portfolio kit re-exports them, so existing host code keeps working. - Repainting the same order book landscape no longer rebuilds its heatmap grid: the adapter caches the adaptation per source grid. ## 26.10.12 - Four portfolio risk figures, all built from painters the library already had: the correlogram (`correlationGrid` over the shared heatmap with the diverging tone), the risk decomposition (`riskContributions` - the Euler decomposition of the variance, shares that add up to one), the scenario cone (`monteCarloCone`, a seeded simulation with nested confidence bands) and the attribution table (`attributionRows`, the same bridge arithmetic the waterfall draws). - The scenario cone is deterministic: the same spec and seed always produce the same cone, and the simulation is a host-side model - it costs tens of milliseconds on a 252 x 1000 reference size (54-120 ms across runs) and never runs inside a frame, where the painter stays under a millisecond. - A correlogram forces its diagonal to one, clamps out-of-range values and leaves a non-finite cell untinted; a hedged asset shows a negative risk contribution below the zero line. - New section on the Analytics kits (/docs/kits) page with all four figures in both themes. ## 26.10.11 - Five professional terminal panels, all thin bindings over pure core arithmetic: `LiquidityRibbonPanel` (the drift of the bid/ask balance as one diverging ribbon), `DeltaCandlesPanel` (a candle type whose body reads the per-bar delta), `PaceOfTapePanel` (the tape folded into aligned windows and tinted by acceleration), `AuctionHeatmapPanel` (a TPO landscape with the POC line and the value-area borders) and `EfficientFrontierPanel` (the concave upper hull of candidate portfolios on the risk/return plane). - The series catalogue grows to twenty-three types with `deltaCandles`; `deltaTone` is a pure function, and a host without a footprint feed still gets plain candles. - `tapeWindows`, `auctionGrid`, `liquidityRibbonGrid` and `frontierCurve` stay in the core, so the figures are testable without a canvas; the panels share one canvas host for measurement, DPR and the image label. - Entry budgets moved by a documented contract step: the root entry is capped at 50 KB gzip and the Pro entry at 48 KB, both measured in the size-budget log. ## 26.10.10 - Analytic figures: `waterfall` (a start-to-total bridge with per-step deltas), `bullet` (qualitative bands, a solid actual marker and a dashed target), `boxPlot` (type-7 quantiles, whiskers inside 1.5 IQR and outliers) and `fanChart` (confidence bands widest first, around a median line). They are pure painters - the data stays yours. - The heatmap painters are now one family (`render/heatmap`): a single cell painter, one tone resolver and the adapters that map an order book, a screener or a monthly returns grid onto it. Tones come from the theme and the look pack, so no colour literal ever enters a grid. - The order book `heatmap` variant is rendered by that family, so a liquidity landscape is laid out top down with the highest price above. The render cost of the variant dropped from a p50 of 1.45 ms to 0.22 ms on a 200-level book. - New portal page Analytic figures (/docs/pro/charts) with all five figures in both themes. - Frames of a live demo scene can be captured reproducibly: the scene supports a `?frozen=1` marker that stops the demo ticker before its first tick. ## 26.10.9 - Four new series types, all additive: `hlcBars` (a high-low stem with a single closing tick, for index series that publish only high, low and close), `columns` (an open-to-close body without wicks) and `rangeCandles`, which gives range bars their own equal-height column renderer instead of borrowing the candle look. - `heikinAshiGlow` renders the smoothed Heikin-Ashi candle with a gradient body and a soft halo outline; the smoothing itself stays a data transformation. - The series catalogue grows from eighteen to twenty-two types: the series-types page, live catalogue and switcher on the portal now cover all of them. ## 26.10.8 - Order book chart (Pro): five canvas variants of a live two-sided book - a cumulative depth area, a per-level depth histogram, the classic price ladder with depth shading and a spread band, a price x time liquidity heatmap and an imbalance pressure board. The core exposes `buildOrderbookView` and `paintOrderbookChart`; `@unifin/chart-react/pro` adds the `OrderbookChart` component with DPR, resize handling and an accessible image label. - Every variant reads the look pack and the active theme: bid and ask take the bar palette, the reading font comes from the four-font set, and fills fall back to flat `withAlpha` colours on a canvas without gradients. - New portal page Order book chart (/docs/pro/orderbook) with all five variants, the aggregation step, the book depth and a streaming book; a card on the home page marks it as a Pro feature. ## 26.10.7 - Eighteen series types: the new `hlcGlow` paints a lit corridor between the high and the low, a soft glow under the close line and a stroke that fades into history; on a canvas without gradients it degrades to the flat HLC area fill. - A last-price tag is a one-line option (`priceTag`), the twin of the volume tag, and the hover card now stays on screen for two seconds after the pointer leaves (`tooltipHold`, adjustable or switched off). - Element attributes `price-tag` and `tooltip-hold` follow those two options. - Portal data: every series-type frame and the professional UX frame are captured on a liquid US equity (AAPL); the A-B ruler is off on the gallery scenes and stays on where the chart chrome is documented. ## 26.10.6 - Look pack: one `look` option groups the presentation choices - a gradient or aurora backdrop, named bar palettes (classic, neon, sunset, ice, mono) with gradient bodies, a dimmed volume band with its own tone and opacity, tapered indicator strokes, `plain`/`chip`/`cards` readout skins and a font stack. - Element attributes follow the look (`backdrop`, `bars-style`, `volume-tone`, `volume-alpha`, `indicator-gradient`, `readout-skin`, `font`); `spark-style` picks one of the ten burst styles. - The `bars` scene now paints real OHLC bars instead of a second candles scene. - Portal: the Live effects page drives the whole look pack, the spark style picker and a replay row (`replayPlay`, `replayStep`, `replayPause`, `replayExit`); the Features page gains a look pack section with a live example; the portal scenes move to liquid US equities and drop the value strip above the chart. - Portal branding: the UNIFIN wordmark in the sidebar header and on the title page, and its gradient (`#2700FE` to `#CC06FB`) paints the library name, the accent and the refreshed docs menu - pill rows, a brand rail on the active page and one radius for the search field. ## 26.10.5 - Chart chrome as options: the ticker watermark (centre or bottom-left, plus a white-label mark), the legend heading with a collapsible row, the hover card next to a bar, the corporate-event lane with detail cards, price and alert lines with lock tags, the volume tag, the pinned A-B measure ruler, the history fade and the dotted grid with period dividers. - Quote header: a compact instrument strip (bid, ask, spread, last price, change) drawn with the kit tokens, so a white-label shell repaints it without touching the markup. - Embedding: `panByPixels` and `panByBars` are public on the React result, on the binding and on the custom element; the canvas keeps touch gestures (`touch-action: none`, pointer capture and `pointercancel`), and `Alt+L` collapses the legend row without a pointer. - Performance: the locale formatters are cached, so a full frame over one million bars with every new layer costs 0.40 ms at the median (frame budget 4 ms). ## 26.10.4 - Reading order of the chart: legend swatches, split OHLC fields, a compact indicator label, the price axis side as a host option (left or right, right by default), an optional volume pane and a neutral palette next to the dark one. ## 26.10.3 - Analytics kits: the non-time X axis and the analytic series family in the core, plus three domain kits - fixed income (yield curve, ladder, coupon timeline), portfolio (benchmark curve, underwater, allocation, monthly heatmap) and options (Black-Scholes, payoff, volatility smile and surface, open interest). - Four new series types: volume candles, line with markers, HLC area and high-low. - Portal: the Analytics kits page and the Live effects page with a live demo chart; the series reference and the live explorer cover all seventeen types, the kit packages appear in the versions table, and the Indicators page attaches every study of the 128-study catalogue to a live chart with ready-to-use code. ## 26.10.2 - Visual refresh of the professional surface: one type and metric scale, 103 own icons, unified panel headers, dialogs and toolbars v2, four palettes with a full contrast pass, and reduced-motion-aware micro-transitions. - Chart layers: optional volume columns and an OHLCV legend, plus empty, loading and error states that adapt to any pane size. - Event streams: more than fifty typed events across the viewport, crosshair, drawings, history, alerts, replay, order lines, paper trading, indicators and data gaps. - History adjustments: split and dividend corrections (`adjustBars`) and a calendar event lane that places dividends, splits and reports onto the bar axis. - Formula studio: validate and preview custom formulas with position-aware feedback before saving them (Pro). - Paper strategies: rule-based strategies over replay with a session report and a simulation disclaimer (Pro). - Template catalogue: ten starter workspaces with revisions, JSON import and export, and compact share codes (Pro). - Pane primitive plugins: register your own canvas geometry above or below the series. - Kazakh locale across the core and the kit; catalogues and panels speak Russian, English and Kazakh. - Core subpath imports (`@unifin/chart-core/data`, `/render`, `/drawings`, `/trading`, `/studies`, `/orderflow`) for layer-by-layer bundling. - Editions and budgets: Standard 8 KB, complete root 42 KB, Pro 40 KB, core 140 KB gzip. - Drawing layer motion, pinned tooltips, selection synchronization over LINK, replay ticks and book heatmaps, session DST transitions, short share links and a legacy datafeed adapter. ## 26.10.1 - Interactive charts out of the box: value readout strip, crosshair and bar-click events, kinetic scroll, price-scale drag and marquee zoom. - Order lines: pending orders as draggable lines on the chart with a version journal (`setOrderLine`, `order:*` events); stop and take lines share the same drag maths. - UI kit for the Pro surface: toolbar, buttons, inputs, selects, dialogs, menus and tooltips on one control language; every panel control moved onto the kit. - Motion and TV-parity controls: motion policy with reduced-motion refusal, zoom easing and timeframe crossfade, symbol/indicator/settings dialogs, DOM ladder, sessions and timezone panel. - Design tokens: dark, light, orange and system palettes; the theme also reads `--ud-info`, `--ud-density`, `--ud-radius` and `--ud-font`/`--ud-sans`; guards enforce the token canon. - Editions: `@unifin/chart-react/standard` entry point and real size budgets (core 135 KB, root 30 KB, light 7 KB, standard 12 KB, pro 28 KB gzip). - Documentation portal rebuilt for external developers; Android WebView bridge example shipped. ## 26.10.0 - Documentation portal rebuilt for external developers: English only, series catalogue, product comparison, AI-assisted development page, API overview and versioned pages. - Interactive series catalogue example covering all 13 chart types with theme and language switches. - Editions documented as shipped: Standard (`light`), Pro (`pro`) and the complete root entry point. ## 26.6.0 - Professional workspace layouts: multi-chart grid, synchronized panels, command palette. - Market replay with recording serialization, ticks and book snapshots. - Order flow: footprint clusters, ladder and tape, cumulative delta, book heatmap. - Alerts: group editor, condition defaults, message templates, retry policy. - Trading UI: paper broker, session report, risk ruler, draggable stops. - Accessibility pass: focus order, contrast, screen-reader names on the custom element. - Performance: decimation and tile ranges for very large histories, worker rendering, experimental WASM acceleration for the heaviest studies. ## 24.0.1 - First public preview: rendering core, time and price scales, eight series types, data layer, indicator engine, drawing engine, four presentation profiles. ## See also - Versions (/docs/versions) - the version every page is verified against. - Features (/docs/standard/features) - what the current release contains. - Getting started (/docs/standard/getting-started) - install and first chart.