Chartsv26.10.18
API reference

React API (@unifin/chart-react)

Generated reference of 75 public symbols of @unifin/chart-react plus 15 symbols of its subpaths, grouped by kind and ordered as in the sources.

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)

SymbolWhat it does
resolveThemeByNamePalette 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.
activeBindingsNumber of bindings created and not yet disposed (leak-test witness).
createChartBinding-
resolveBrowserThemeReads 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, ).
prefersReducedMotionReads prefers-reduced-motion from the host window, defaulting to false.
UnifinChartReact 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).
ChartGridDashboard 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-
attachChartInputBinds 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.
MiniChartDashboard mini panel (FR-RENDER-06, §4): price scale and time labels stay, the toolbar and the grid go away.
quoteSpreadSpread of a two-sided quote; a crossed or incomplete book yields nulls.
quoteToneDirection of the change; an unknown or flat change stays neutral.
quoteChangePercentChange against the previous close in percent; null without a valid base.
QuoteHeader-
captureChartPngRepaints the binding and returns a PNG data URL of the canvas, or null when the canvas cannot export (no context, no toDataURL, disposed binding).
copyChartPngToClipboardCopies the repainted canvas to the clipboard as image/png. Returns false when the environment has no clipboard API or the host denies the write.
shareChartPngShares 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.
SparklineDashboard sparkline (FR-RENDER-06, §4): no axes, no grid, no labels - the minimal trend line for tables and KPI tiles.
createSyncGroup-
useChartWires 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)

SymbolWhat it does
BarCore market data model: bars, ticks, instruments and timeframes. No DOM and no framework dependencies here.
Tick-
Instrument-
Timeframe22 timeframes from a second to a month ( §2).
SeriesRenderTypeSeries 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.
LineOverlayHost-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.
ReadoutModelReadout 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-
CrosshairLeaveEventThe pointer left the plot area; the crosshair is hidden.
CrosshairPinEvent-
BarClickEvent-
InteractionEventName-
InteractionEvent-
ChartThemeChart 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).
ThemeNameNames of the selectable palettes plus the system alias.
BuiltInThemeNameNames of the six palettes the library ships, in menu order.
AttributionInputCorner mark of the chart: where it points and what it says.
CrosshairModeCrosshair behaviour of the binding: hidden, free or magnet to the close.
ChartBindingOptions-
ChartBinding-
ThemeHostElementNarrow 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-
ShareEnvEnvironment of the Web Share API, injected for tests and SSR safety.
ShareResultOutcome of shareChartPng: nothing is thrown at the host.
ShareChartOptions-
SparklineProps-
SyncRange-
SyncPanel-
SyncGroupOptions-
SyncDrawingOp-
SyncSelectionHandler-
SyncDrawingHandler-
SyncGroup-
UseChartOptions-
UseChartResult-

Constants (5)

SymbolWhat it does
CHART_THEMESNamed registry of the six shipped palettes (`` attribute accepts, so the menu order, the attribute values and the registry cannot drift apart.
BUILT_IN_THEMESThe six palettes shipped by the library, in menu order.
THEME_NAMESSelectable palette names, system included, in menu order (ThemeName).
ATTRIBUTION_HREFSite of the library, opened by the mark.
ATTRIBUTION_LABELLabel 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)

SymbolWhat it does
useDrawingLayersEffective state of the drawings after the layer rules.
useLayerGroupsDrawing layers with their members, ready for a tree view.
useHeaderValuesValues of the configured header fields.
useAlignInstrumentLayersSeries of several instruments on one time axis.
usePaneLayoutPane actions that return the next layout; the host keeps the state.
useAlertFeedAlert feed with grouping and the badges of the panes.
useExportLegendLegend rows of an export, with the hidden series last.
useAuditRowsRows of the audit overlay.
useFrameNarrationNarration sentence of the current frame.
useFrameBudgetRows of the frame budget panel and the worker decision behind them.
useWorkerDecisionDecision whether the calculation leaves the frame.
useAssistantDraftDraft of the assistant: calls of the catalogue plus the words it did not know.
useTimeNotesNotes pinned to their bars.
useReplayScenarioScenario of a replay: ordered steps a host shows, exports or turns into a test.
useTimeSliderPosition of the time slider: the bar index of a share, snapped to a session edge.

On this page