Stock chart options

StockChartOptions API. Configure candles, volume, indicators, ranges, labels, and market layers.

Importar
import type { StockChartOptions } from "@sixtyfold/stock";

Usa el punto de entrada público indicado arriba. Las importaciones solo de tipos se eliminan del JavaScript de la aplicación.

BollingerBandsIndicatorConfig

Bollinger bands indicator options.

Import @sixtyfold/stockinterface

interface BollingerBandsIndicatorConfig extends StockIndicatorStyle
MemberDefinitionDescription
color?string | undefinedBollinger bands indicator color.
deviation?number | undefinedStandard-deviation multiplier. Defaults to 2.
fillColor?string | undefinedFill color.
fillOpacity?number | undefinedFill opacity from 0 to 1.
id?string | undefinedUnique identifier for this bollinger bands indicator.
includeInScale?boolean | undefinedWhether this layer affects automatic Y-axis scaling.
label?string | undefinedBollinger bands indicator label.
lineDash?StockIndicatorLineDash | undefinedCanvas dash pattern in CSS pixels.
lineWidth?number | undefinedLine width in CSS pixels.
lowerColor?string | undefinedLower color.
middleColor?string | undefinedMiddle color.
periodnumberLookback period in raw candles.
source?StockPriceSource | undefinedDefaults to close.
type"bollinger"Selects the type.
upperColor?string | undefinedUpper color.
visible?boolean | undefinedWhether to render the bollinger bands indicator.

CandleColors

Candle colors.

Import @sixtyfold/stockinterface

interface CandleColors
MemberDefinitionDescription
down?string | undefinedColor used when close < open.
up?string | undefinedColor used when close >= open.
wickDown?string | undefinedWick color for down candles (defaults to down color)
wickUp?string | undefinedWick color for up candles (defaults to up color)

EMAIndicatorConfig

EMA indicator options.

Import @sixtyfold/stockinterface

interface EMAIndicatorConfig extends StockIndicatorStyle
MemberDefinitionDescription
color?string | undefinedEMA indicator color.
id?string | undefinedUnique identifier for this EMA indicator.
includeInScale?boolean | undefinedWhether this layer affects automatic Y-axis scaling.
label?string | undefinedEMA indicator label.
lineDash?StockIndicatorLineDash | undefinedCanvas dash pattern in CSS pixels.
lineWidth?number | undefinedLine width in CSS pixels.
periodnumberLookback period in raw candles.
source?StockPriceSource | undefinedDefaults to close.
type"ema"Selects the type.
visible?boolean | undefinedWhether to render the EMA indicator.

SMAIndicatorConfig

SMA indicator options.

Import @sixtyfold/stockinterface

interface SMAIndicatorConfig extends StockIndicatorStyle
MemberDefinitionDescription
color?string | undefinedSMA indicator color.
id?string | undefinedUnique identifier for this SMA indicator.
includeInScale?boolean | undefinedWhether this layer affects automatic Y-axis scaling.
label?string | undefinedSMA indicator label.
lineDash?StockIndicatorLineDash | undefinedCanvas dash pattern in CSS pixels.
lineWidth?number | undefinedLine width in CSS pixels.
periodnumberLookback period in raw candles.
source?StockPriceSource | undefinedDefaults to close.
type"sma"Selects the type.
visible?boolean | undefinedWhether to render the SMA indicator.

StockAddCandlesOptions

Options for stock add candles.

Import @sixtyfold/stockinterface

interface StockAddCandlesOptions
MemberDefinitionDescription
initialTimeRange?"1D" | "5D" | "1M" | "3M" | "6M" | "YTD" | "1Y" | "5Y" | "ALL" | undefinedApply a preset before the initial streamed dataset can render.

StockAppearanceOptions

Stock chart appearance — base appearance + stock-specific visual fields

Import @sixtyfold/stockinterface

interface StockAppearanceOptions extends BaseAppearanceOptions
MemberDefinitionDescription
axis?AxisAppearanceOptions | undefinedRuntime appearance options for axis.
candleColors?CandleColors | undefinedColors used for candle bodies and wicks.
candleStrokeWidth?number | undefinedCandle outline and OHLC-bar width in CSS pixels.
chartBackground?BackgroundOptions | undefinedRuntime appearance options for chart background.
crosshairStyle?CrosshairOptions | undefinedRuntime appearance options for crosshair style.
grid?GridOptions | undefinedRuntime appearance options for grid.
labels?ChartLabels | undefinedRuntime appearance options for labels.
overlay?OverlayOptions | undefinedRuntime appearance options for overlay.
padding?PaddingOptions | undefinedRuntime appearance options for padding.
previewLineColor?string | undefinedLine color used by the range-selector preview.
rangeSelector?RangeSelectorAppearanceOptions | undefinedRuntime appearance options for range selector.
selection?SelectionOptions | undefinedRuntime appearance options for selection.
textDirection?TextDirection | undefinedRuntime appearance options for text direction.
tooltip?TooltipOptions | undefinedRuntime appearance options for tooltip.

StockChartOptions

Construction, interaction, appearance, range, and market-layer options for a stock chart.

Import @sixtyfold/stockinterface

interface StockChartOptions
MemberDefinitionDescription
animated?boolean | undefinedAnimate data reveal and viewport/axis transitions. When omitted, animation is enabled unless the browser reports prefers-reduced-motion: reduce.
axis?AxisOptions | undefinedAxis customization (line color and label colors)
candleColors?CandleColors | undefinedCustom colors for candles
candleStrokeWidth?number | undefined
= 1
Stroke width for candle outlines and OHLC bars
candleStyle?CandleStyle | undefinedStyle for rendering price data: - 'filled': solid filled candles (default) - 'hollow': candles with stroke outline only - 'ohlc': classic OHLC bars with horizontal ticks
chartBackground?BackgroundOptions | undefined
= #16213e
Chart background (covers entire canvas including preview area). Can be a solid color string, gradient definition, or image.
crosshairMarkerColor?string | undefinedLegacy fallback color for left and right Y-axis cursor labels. Explicit axis cursor-label colors take precedence.
crosshairStyle?CrosshairOptions | undefinedCrosshair lines styling (vertical and horizontal guide lines)
grid?GridOptions | undefinedGrid line customization for main chart
indicators?StockIndicator[] | undefinedBuilt-in worker-rendered technical indicators.
interactive?boolean | undefined
= true
Enable user interactions (pan/zoom/pinch). When false, chart is view-only but still shows crosshair/tooltip on hover.
keepAliveInterval?number | undefined
= 0 (disabled)
Keep-alive interval in seconds to prevent Safari from releasing GPU resources. Safari aggressively cleans up "unused" canvases, causing blank charts.
keyboardActivation?"focus" | "hover" | undefinedHow keyboard controls become active. - "focus" (default): chart must have DOM focus - "hover": chart under the mouse pointer receives keyboard navigation
keyboardAnnouncements?false | KeyboardAnnouncementMessages | undefinedLocalize keyboard-action announcements for assistive technologies, or set false to disable them. Omitted messages use concise English defaults.
keyboardPanSpeed?number | undefined
= 0.1 (10%)
Keyboard pan speed (arrow keys). Fraction of visible range to pan per keypress.1 (10%)
keyboardZoomSpeed?number | undefined
= 0.1 (10% per keypress)
Keyboard zoom speed (+/- keys). Higher values = faster zoom.1 (10% per keypress)
labels?ChartLabels | undefinedText labels around the chart (title, axis labels)
markers?StockMarker[] | undefinedSparse timestamp/price event markers.
minViewportRange?number | undefinedSmallest interactive X viewport span, expressed in the same units as the chart's X values. Invalid or non-positive values retain the chart-type default. This construction option is not part of mutable appearance.
onCrosshairMove?((detail: StockCrosshairMoveDetail | null) => void) | undefinedCalled as the crosshair moves between candles, and with null when it leaves.
onTimeRangeChange?((range: TimeRange | null) => void) | undefinedCalled with the active preset, or null when the viewport no longer matches a named preset.
onVisibleRangeChange?((detail: StockVisibleRangeChangeDetail) => void) | undefinedCalled when the renderer reports a changed visible range or data extent.
overlay?OverlayOptions | undefinedDeclarative overlay primitives rendered above chart content
padding?PaddingOptions | undefined
= { top: 20, right: 80, bottom: 40, left: 80 }
Custom padding in pixels
previewLineColor?string | undefined
= #4a90d9
Color for the preview line in range selector
priceLines?StockPriceLine[] | undefinedHorizontal data-anchored price levels.
priceUnit?UnitOptions | undefinedUnit config for price values (OHLC) in tooltip and axis labels
rangeSelector?RangeSelectorOptions | undefinedRange selector (preview chart) configuration
rendererInitializationTimeout?number | undefined
= 15000
Maximum time in milliseconds allowed for renderer startup. The watchdog starts during chart construction, so it also protects applications that do not await BaseChart.initialize. Set to 0 to disable it.
renderMode?"auto" | "worker" | "main" | undefinedSelecciona el modo de renderizado. auto prefiere Worker + OffscreenCanvas; worker fuerza el worker con respaldo en el hilo principal; main renderiza en el hilo principal del navegador y requiere DOM.
selection?SelectionOptions | undefinedSelection range (drag-to-zoom) styling
showLeftPriceMarker?boolean | undefinedAlias for showLeftAxisLabel - show price marker on left Y-axis
showRightPriceMarker?boolean | undefinedAlias for showRightAxisLabel - show price marker on right Y-axis
showVolume?boolean | undefinedWhether to show volume.
textDirection?TextDirection | undefined
= inherit
Direction used for Canvas2D text. Use "auto" to infer from the first strong character of each string, or "rtl"/"ltr" to force a chart-wide direction.
timeScale?StockTimeScale | undefinedX-axis behavior. market compresses intervals without observations while preserving real timestamps in labels and events.
tooltip?StockTooltipOptions | undefinedTooltip options with stock-specific onRender params
volumeColors?VolumeColors | undefinedCustom colors for volume bars (defaults to candle colors)
volumeHeightRatio?number | undefined
= 0.15
Height of volume area as fraction of chart height (0-1,15)
volumeOpacity?number | undefined
= 0.35
Opacity of volume bars (0-1,35)
volumeProfile?false | VolumeProfileOptions | undefinedEstimated candle-derived visible-range volume-by-price profile, or false to disable it.
volumeUnit?UnitOptions | undefinedUnit config for volume values in tooltip
wheelZoomDirection?"up-in" | "up-out" | undefinedMouse wheel zoom direction. - "up-in" (default): wheel up/backward zooms in, wheel down/forward zooms out - "up-out": wheel up/backward zooms out, wheel down/forward zooms in
wheelZoomSpeed?number | undefined
= 0.1 (10% per wheel tick)
Mouse wheel zoom speed. Higher values = faster zoom.1 (10% per wheel tick)
yDomain?YDomainOptions | undefinedPin either or both edges of the rendered Y domain. Omitted edges continue to auto-scale from visible data. Supplying both finite edges keeps the Y viewport stable across zoom, LOD selection, and streaming updates. The option is disabled by default and is construction configuration rather than mutable appearance.

StockChartStatsOptions

Controls how frequently stock telemetry is published.

Import @sixtyfold/stockinterface

interface StockChartStatsOptions
MemberDefinitionDescription
intervalMs?number | undefined
= 250
Minimum interval between stats updates in milliseconds

StockIndicatorStyle

Renderer-facing metadata shared by all indicators. Calculations ignore it.

Import @sixtyfold/stockinterface

interface StockIndicatorStyle
MemberDefinitionDescription
color?string | undefinedStock indicator style color.
id?string | undefinedUnique identifier for this stock indicator style.
includeInScale?boolean | undefinedWhether this layer affects automatic Y-axis scaling.
label?string | undefinedStock indicator style label.
lineDash?StockIndicatorLineDash | undefinedCanvas dash pattern in CSS pixels.
lineWidth?number | undefinedLine width in CSS pixels.
visible?boolean | undefinedWhether to render the stock indicator style.

StockMarker

A sparse event/trade marker anchored to a timestamp and optionally a price.

Import @sixtyfold/stockinterface

interface StockMarker
MemberDefinitionDescription
color?string | undefinedMarker fill color.
id?string | undefinedIdentificador opcional, estable y definido por la aplicación, conservado con el marcador.
label?string | undefinedOptional short marker label.
position?StockMarkerPosition | undefinedPlace above/below the nearest candle or at an explicit price.
price?number | undefinedExplicit price anchor. Required when position is price.
shape?StockMarkerShape | undefinedMarker glyph.
size?number | undefinedMarker radius/half-size in CSS pixels.
textColor?string | undefinedMarker label color.
timestampnumberMarker timestamp, in the same units as the chart data.

StockPriceLine

A horizontal, data-anchored price level rendered over the stock chart.

Import @sixtyfold/stockinterface

interface StockPriceLine
MemberDefinitionDescription
axisLabelBackground?string | undefinedBackground color for the optional axis label.
axisLabelColor?string | undefinedText color for the optional axis label.
color?string | undefinedLine color.
extendScale?boolean | undefinedInclude this price when calculating the visible Y scale.
id?string | undefinedIdentificador opcional, estable y definido por la aplicación, conservado con la línea de precio.
label?string | undefinedOptional text rendered alongside the line.
lineDash?number[] | undefinedCanvas dash pattern. An empty array renders a solid line.
lineWidth?number | undefinedLine width in CSS pixels.
pricenumberPrice represented by the horizontal line.
showAxisLabel?boolean | undefinedShow a value label on the price axis.

StockTooltipOptions

Tooltip options for stock charts - overrides onRender with stock-specific params

Import @sixtyfold/stockinterface

interface StockTooltipOptions extends Omit<TooltipOptions, "onRender">
MemberDefinitionDescription
backdropBlur?number | undefined
= 0
Backdrop blur radius in pixels
backgroundColor?string | undefined
= rgba(22, 33, 62, 0.95)
Background color with transparency')
borderColor?string | undefined
= #4a6fa1
Border color
borderRadius?number | undefined
= 0
Border radius in pixels
borderStyle?"solid" | "dashed" | "dotted" | undefined
= solid
Border style
borderWidth?number | undefined
= 1
Border width in pixels
candleBorder?boolean | undefined
= false
Stock chart: use candle color (green/red) for tooltip border
direction?TextDirection | undefinedText direction for tooltip text. Defaults to the chart-level textDirection.
fieldLabels?Partial<Record<StockTooltipField, string>> | undefinedStock chart: display labels for built-in tooltip fields. Defaults to blank labels.
fields?StockTooltipField[] | undefinedStock chart: which fields to show and in what order. Default: ['open', 'high', 'low', 'close', 'change', 'changePercent', 'volume']
labelFont?FontStyle | undefinedFont style for row labels (series names)
onLeave?(() => void) | undefinedCalled when mouse leaves the chart area (useful for hiding custom HTML tooltips)
onRender?((params: StockTooltipRenderParams) => StockTooltipRenderResult) | undefinedCustom render callback for stock tooltip content (called on main thread)
padding?{ top?: number; right?: number; bottom?: number; left?: number; } | undefined
= 8
Inner padding in pixels
position?"cursor-top" | "cursor-bottom" | "cursor" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined
= cursor-top
Tooltip position - 'cursor-top'/'cursor-bottom': horizontally follows crosshair, pinned to top/bottom edge - 'cursor': follows mouse position - 'top-left'/'top-right'/'bottom-left'/'bottom-right': fixed in corner
shadow?boolean | TooltipShadowOptions | undefined
= disabled
Drop shadow around tooltip box
showSwatch?boolean | undefined
= true
Show color swatch next to each series label
titleFont?FontStyle | undefinedFont style for the tooltip title line
titleFormat?XAxisFormat | undefined
= auto
Format for the tooltip title (X-axis value). - 'time': format as date/time - 'number': format as plain number - UnitOptions: custom formatting with prefix/suffix/decimals Note: auto-detection is heuristic and can classify large non-time values as time. Use explicit titleFormat when X values are large numeric quantities.
valueFont?FontStyle | undefinedFont style for row values. When color is omitted, each value uses its row/series color.
visibleSeries?number[] | undefined
= all series
Line chart: which series indices to show in tooltip. Controls both visibility and order. E.g. [0, 2] shows only series 0 and 2.
width?number | undefinedFixed tooltip width in pixels. - Exact: the box is always this width, regardless of content - No auto-fit: content that exceeds this width will overflow/clip - When omitted: the tooltip auto-sizes with a ratchet that prevents shrinking during a hover session

VolumeColors

Volume colors.

Import @sixtyfold/stockinterface

interface VolumeColors
MemberDefinitionDescription
down?string | undefinedVolume color used when close < open.
up?string | undefinedVolume color used when close >= open.

VolumeProfileOptions

Estimated visible-range volume-by-price histogram configuration. The renderer distributes each OHLCV candle's volume uniformly across its reported low-to-high range. This is a candle-derived approximation, not exact trades-at-price or order-flow data.

Import @sixtyfold/stockinterface

interface VolumeProfileOptions
MemberDefinitionDescription
downColor?string | undefinedColor assigned to bearish volume.
opacity?number | undefinedProfile opacity in the inclusive range 0..1.
placement?"left" | "right" | undefinedSide of the price pane on which the profile is anchored.
pointOfControlColor?string | undefinedPoint-of-control highlight color.
rows?number | undefinedNumber of estimated price buckets.
showPointOfControl?boolean | undefinedHighlight the point-of-control row.
upColor?string | undefinedColor assigned to bullish volume.
valueAreaPercent?number | undefinedPercentage of volume included in the value area.
visible?boolean | undefinedWhether the profile is rendered. Defaults to true when configured.
width?number | undefinedMaximum profile width in CSS pixels.

VWAPIndicatorConfig

VWAP indicator options.

Import @sixtyfold/stockinterface

interface VWAPIndicatorConfig extends VWAPCalculationOptions, StockIndicatorStyle
MemberDefinitionDescription
color?string | undefinedVWAP indicator color.
id?string | undefinedUnique identifier for this VWAP indicator.
includeInScale?boolean | undefinedWhether this layer affects automatic Y-axis scaling.
label?string | undefinedVWAP indicator label.
lineDash?StockIndicatorLineDash | undefinedCanvas dash pattern in CSS pixels.
lineWidth?number | undefinedLine width in CSS pixels.
reset?VWAPReset | undefinedUTC-aligned accumulation window. Defaults to day.
resetOffsetMs?number | undefinedMoves the UTC reset boundary by this many milliseconds. Defaults to 0.
source?StockPriceSource | undefinedDefaults to the typical price, hlc3.
type"vwap"Selects the type.
visible?boolean | undefinedWhether to render the VWAP indicator.