Candlestick.

PRO

Show four prices per period in a candlestick.

Live preview24 feature examples

LIVE EXAMPLE

OHLC candles

Match the page theme
Interact with the chart to see selection and range-change results here.
OptionsChanges are reflected in the preview and code.
Appearance and style10
Axes and grid lines11
Legend and interaction13
Title and dimensions3

Represent open, high, low, and close prices as candles. All values are sample data.

View code
Current preview
<div id="chart-container" style="width: 100%; min-width: 0;"></div>

<script type="module">
  import { defineCustomElement as define0 } from '@syidax/advanced-pro/components/sy-candlestick-chart.js';
  define0();

  // Pro: complete registerLicense at app startup using your issued certificate.
  // The website preview certificate is not for use in customer apps.
  const specs = [
    {
      "id": "example-chart",
      "tag": "sy-candlestick-chart",
      "props": {
        "data": [
          {
            "time": 1767225600000,
            "open": 100,
            "close": 95,
            "high": 103,
            "low": 92,
            "volume": 1200
          },
          {
            "time": 1767312000000,
            "open": 104,
            "close": 106,
            "high": 109,
            "low": 101,
            "volume": 1337
          },
          {
            "time": 1767398400000,
            "open": 107,
            "close": 105,
            "high": 110,
            "low": 102,
            "volume": 1474
          },
          {
            "time": 1767484800000,
            "open": 109,
            "close": 114,
            "high": 117,
            "low": 106,
            "volume": 1611
          },
          {
            "time": 1767571200000,
            "open": 108,
            "close": 109,
            "high": 112,
            "low": 105,
            "volume": 1748
          },
          {
            "time": 1767657600000,
            "open": 106,
            "close": 103,
            "high": 109,
            "low": 100,
            "volume": 1885
          },
          {
            "time": 1767744000000,
            "open": 102,
            "close": 106,
            "high": 109,
            "low": 99,
            "volume": 2022
          },
          {
            "time": 1767830400000,
            "open": 100,
            "close": 100,
            "high": 103,
            "low": 97,
            "volume": 2159
          },
          {
            "time": 1767916800000,
            "open": 98,
            "close": 94,
            "high": 101,
            "low": 91,
            "volume": 2296
          },
          {
            "time": 1768003200000,
            "open": 99,
            "close": 102,
            "high": 105,
            "low": 96,
            "volume": 2433
          },
          {
            "time": 1768089600000,
            "open": 101,
            "close": 100,
            "high": 104,
            "low": 97,
            "volume": 2570
          },
          {
            "time": 1768176000000,
            "open": 105,
            "close": 100,
            "high": 108,
            "low": 97,
            "volume": 2707
          },
          {
            "time": 1768262400000,
            "open": 109,
            "close": 111,
            "high": 114,
            "low": 106,
            "volume": 2844
          },
          {
            "time": 1768348800000,
            "open": 113,
            "close": 111,
            "high": 116,
            "low": 108,
            "volume": 2981
          },
          {
            "time": 1768435200000,
            "open": 115,
            "close": 120,
            "high": 123,
            "low": 112,
            "volume": 1318
          },
          {
            "time": 1768521600000,
            "open": 115,
            "close": 116,
            "high": 119,
            "low": 112,
            "volume": 1455
          },
          {
            "time": 1768608000000,
            "open": 114,
            "close": 111,
            "high": 117,
            "low": 108,
            "volume": 1592
          },
          {
            "time": 1768694400000,
            "open": 111,
            "close": 115,
            "high": 118,
            "low": 108,
            "volume": 1729
          },
          {
            "time": 1768780800000,
            "open": 108,
            "close": 108,
            "high": 111,
            "low": 105,
            "volume": 1866
          },
          {
            "time": 1768867200000,
            "open": 105,
            "close": 101,
            "high": 108,
            "low": 98,
            "volume": 2003
          },
          {
            "time": 1768953600000,
            "open": 105,
            "close": 108,
            "high": 111,
            "low": 102,
            "volume": 2140
          },
          {
            "time": 1769040000000,
            "open": 107,
            "close": 106,
            "high": 110,
            "low": 103,
            "volume": 2277
          },
          {
            "time": 1769126400000,
            "open": 110,
            "close": 105,
            "high": 113,
            "low": 102,
            "volume": 2414
          },
          {
            "time": 1769212800000,
            "open": 114,
            "close": 116,
            "high": 119,
            "low": 111,
            "volume": 2551
          },
          {
            "time": 1769299200000,
            "open": 119,
            "close": 117,
            "high": 122,
            "low": 114,
            "volume": 2688
          },
          {
            "time": 1769385600000,
            "open": 121,
            "close": 126,
            "high": 129,
            "low": 118,
            "volume": 2825
          },
          {
            "time": 1769472000000,
            "open": 123,
            "close": 124,
            "high": 127,
            "low": 120,
            "volume": 2962
          },
          {
            "time": 1769558400000,
            "open": 121,
            "close": 118,
            "high": 124,
            "low": 115,
            "volume": 1299
          },
          {
            "time": 1769644800000,
            "open": 119,
            "close": 123,
            "high": 126,
            "low": 116,
            "volume": 1436
          },
          {
            "time": 1769731200000,
            "open": 116,
            "close": 116,
            "high": 119,
            "low": 113,
            "volume": 1573
          },
          {
            "time": 1769817600000,
            "open": 113,
            "close": 109,
            "high": 116,
            "low": 106,
            "volume": 1710
          },
          {
            "time": 1769904000000,
            "open": 112,
            "close": 115,
            "high": 118,
            "low": 109,
            "volume": 1847
          }
        ],
        "timeScale": "ordinal",
        "volume": "off",
        "width": 640,
        "height": 360,
        "brandPosition": "bottom-right",
        "brandLogo": ""
      }
    }
  ];
  const container = document.querySelector('#chart-container');
  const elements = specs.map(({ tag, id, props }) => {
    const element = document.createElement(tag);
    element.id = id;
    Object.assign(element, props);
    element.setAttribute('aria-label', 'candlestick example chart');
    return element;
  });
  container.replaceChildren(...elements);
  const chart = elements.at(-1);
  const onEvent = event => {
    console.log('pointClick', event.detail);
  };
  chart.addEventListener('pointClick', onEvent);
  const observer = new ResizeObserver(([entry]) => {
    const width = Math.max(160, Math.floor(entry.contentRect.width));
    elements.forEach(element => { element.width = width; });
  });
  observer.observe(container);

  // In an SPA, call this function when the view is disposed.
  function disposeChart() {
    observer.disconnect();
    chart.removeEventListener('pointClick', onEvent);
    container.replaceChildren();
  }
</script>

Usage and data

#

Explore changes in opening, high, low, and closing prices.

The example uses fictional prices. Match time zones, trading sessions, and adjusted-price conventions to your actual data.

Data contract

PropertyInput format
dataAn array of { time, open, high, low, close, volume? }.
timeScaleordinal reflects trading order; linear reflects elapsed time.
volumeSelect pane to display volume alongside prices.

Updating data

Assign a new array or object to the property instead of mutating values inside an array. Chart events provide selection results through event.detail. When disposing of the view, clean up ResizeObserver and event listeners registered by your app.

Feature examples

#

Try 24 interactive feature examples and inspect their code. Select “Edit in preview” to combine more options in the settings panel above.

Hollow candlesPRO

Leave rising candle bodies unfilled to distinguish direction.

Interact with the chart to see results here.
View code

Prices and volumePRO

Show a volume panel below the prices.

Interact with the chart to see results here.
View code

Inspect values with the pointerPRO

Point to data to view the value at that location.

Interact with the chart to see results here.
View code

Crosshair trackingPRO

Move the pointer to read horizontal and vertical coordinates alongside values.

Interact with the chart to see results here.
View code

Drag to zoom and panPRO

Drag to zoom and hold Shift to pan. Use Ctrl + wheel to zoom in or out.

Interact with the chart to see results here.
View code

Replay animationPRO

Redraw the same example to inspect its initial display animation.

Interact with the chart to see results here.
View code

AnimationPRO

Compare 1 examples of Animation. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

AxisPRO

Compare 5 examples of Axis. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

BandsPRO

Compare 5 examples of Bands. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

CrosshairPRO

Compare 5 examples of Crosshair. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Data inputPRO

Compare 1 examples of Data input. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Moving AveragesPRO

Compare 4 examples of Moving Averages. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Large datasetsPRO

Compare 1 examples of Large datasets. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

SizePRO

Compare 1 examples of Size. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

StylePRO

Compare 6 examples of Style. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Time ScalePRO

Compare 4 examples of Time Scale. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

TooltipPRO

Compare 13 examples of Tooltip. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

VolumePRO

Compare 3 examples of Volume. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Zoom and panPRO

Compare 6 examples of Zoom and pan. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Context menuPRO

Compare 1 examples of Context menu. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Data context menuPRO

Compare 1 examples of Data context menu. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Read coordinates and dataPRO

Compare 1 examples of Read coordinates and data. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

OverviewPRO

Compare 4 examples of Overview. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Streaming · Add and update live dataPRO

Compare 6 examples of Add and update live data. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

API reference

#

The full public API for sy-candlestick-chart. Pass objects and arrays as JavaScript properties. Select a name to view usage code and type definitions.

Key properties

Attribute / PropertyType / DefaultDescription
CandlestickDataDefault: undefinedAn array of { time, open, high, low, close, volume? }.
numberDefault: 900Chart width in pixels. Update with ResizeObserver when the container changes.
numberDefault: 360Chart height in pixels.
brandLogostringDefault: undefinedThe default is the Syidax logo. With the Pro chart.branding entitlement, use none or a PNG, JPEG, or WebP data URL.
brandPosition'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'Default: 'bottom-right'The corner where the logo is anchored. Applies equally to Community and Pro, on screen and in image exports.
xAxisCartesianAxisInputDefault: undefinedThe time axis (kind `time` by default; `min` / `max` in epoch ms set the visible window).
yAxisYAxisInputDefault: undefinedThe price axis, or `[left, right]` slots (the second a relabelled unit of the same price).
gridLinesCartesianGridLinesInputDefault: undefinedAllowed values: auto, off. Default: undefined.
CartesianCrosshairInputDefault: undefinedCrosshair that follows the cursor across the plot.
CartesianZoomInputDefault: undefinedSettings for zooming and the visible range.
upColorstringDefault: DEFAULT_UP_COLORSet as an HTML attribute or JavaScript property. type: string.
downColorstringDefault: DEFAULT_DOWN_COLORSet as an HTML attribute or JavaScript property. type: string.
candleWidthnumberDefault: CANDLE_DEFAULT_WIDTH_RATIOThe body's share of the bar pitch (0 … 1; default 0.7).
wickWidthnumberDefault: 1The wick width in CSS px.
barStyleCandlestickBarStyleDefault: 'candle'Allowed values: candle, ohlc, hlc, hilo. Default: 'candle'.
bodyStyleCandlestickBodyStyleDefault: 'solid'Allowed values: solid, hollow, hollow-up. Default: 'solid'.
timeScaleCandlestickTimeScaleDefault: 'ordinal'ordinal reflects trading order; linear reflects elapsed time.
CandlestickVolumeModeDefault: 'off'Select pane to display volume alongside prices.
volumeHeightnumberDefault: 0.25Set as an HTML attribute or JavaScript property. type: number.
volumeAlphanumberDefault: 0.45Set as an HTML attribute or JavaScript property. type: number.
chartTitlestringDefault: undefinedThe title inside the chart. Explain the data's unit and meaning alongside it.
chartSubtitlestringDefault: undefinedThe subtitle inside the chart.
CartesianTooltipInputDefault: undefinedTooltip settings for pointer-driven values, position, and content.
tooltipEnabledbooleanDefault: trueSet as an HTML attribute or JavaScript property. type: boolean.
animatedbooleanDefault: falseWhether to animate initial display and data changes.
animationDurationnumberDefault: 600Animation duration in milliseconds.
animationEasingCandlestickEasingDefault: 'ease-out'Allowed values: linear, ease-out, ease-in, ease-in-out. Default: 'ease-out'.
animationTypeCandlestickAnimationTypeDefault: undefinedAllowed values: initial, update. Default: undefined.
Other properties 27
Attribute / PropertyType / DefaultDescription
xMinnumberDefault: undefinedExplicit domain ends (an omitted end follows the bars; `x-axis` / `y-axis` `min` / `max` also set them).
xMaxnumberDefault: undefinedSet as an HTML attribute or JavaScript property. type: number.
yMinnumberDefault: undefinedSet as an HTML attribute or JavaScript property. type: number.
yMaxnumberDefault: undefinedSet as an HTML attribute or JavaScript property. type: number.
numberDefault: 0.05The price padding above and below the bars (a fraction of the span; default 0.05).
flatColorstringDefault: DEFAULT_FLAT_COLORSet as an HTML attribute or JavaScript property. type: string.
candleMinPxnumberDefault: CANDLE_DEFAULT_MIN_PXSet as an HTML attribute or JavaScript property. type: number.
candleMaxPxnumberDefault: CANDLE_DEFAULT_MAX_PXSet as an HTML attribute or JavaScript property. type: number.
bodyMinPxnumberDefault: 1The minimum body height in CSS px (a doji stays visible).
tickLengthnumberDefault: undefinedSet as an HTML attribute or JavaScript property. type: number.
fillAlphanumberDefault: undefinedSet as an HTML attribute or JavaScript property. type: number.
bodyBorderPxnumberDefault: 1Set as an HTML attribute or JavaScript property. type: number.
wickColorstringDefault: 'auto'Set as an HTML attribute or JavaScript property. type: string.
CandlestickAntialiasDefault: 'auto'Allowed values: auto, off, on. Default: 'auto'.
pixelSnapbooleanDefault: trueSet as an HTML attribute or JavaScript property. type: boolean.
CandlestickSessionInput | stringDefault: '24x7'Pass as a JavaScript property. type: CandlestickSessionInput | string.
labelLocalestringDefault: 'en-US'Set as an HTML attribute or JavaScript property. type: string.
volumeUpColorstringDefault: 'auto'Set as an HTML attribute or JavaScript property. type: string.
volumeDownColorstringDefault: 'auto'Set as an HTML attribute or JavaScript property. type: string.
CandlestickOverlayInput | stringDefault: undefinedPass as a JavaScript property. type: CandlestickOverlayInput | string.
enableMouseTrackingbooleanDefault: trueSet as an HTML attribute or JavaScript property. type: boolean.
tooltipFormat(detail: CandlestickPointEventDetail) => stringDefault: undefinedPass as a JavaScript property. type: (detail: CandlestickPointEventDetail) => string.
streamSourceCandlestickStreamSourceDefault: undefinedA stream source for live data. Check the contract for the specific type.
streamMaxnumberDefault: undefinedThe maximum number of streaming data points to retain.
streamWindownumberDefault: undefinedThe streaming data range to keep visible.
CandlestickEngineModeDefault: 'auto'Renderer selection: auto, standard, or pro. Engine selection is separate from permission to use a Pro chart type.
CandlestickUnavailableBehaviourDefault: 'fallback'Allowed values: fallback, error. Default: 'fallback'.
Events 14
EventsDetail typeDescription
CandlestickRenderResult & { tier: CandlestickEngineTier; engine?: ChartEngineStatus }Emits rendering results in detail when chart drawing completes.
CandlestickPointEventDetailA point selection event. Read the selected data and index from CustomEvent.detail.
CandlestickPointEventDetail | nullCustomEvent.detail type: CandlestickPointEventDetail | null. Event names are case-sensitive.
CartesianCrosshairEventDetail | nullCustomEvent.detail type: CartesianCrosshairEventDetail | null. Event names are case-sensitive.
ChartPointContextMenuEventDetail<CandlestickPointEventDetail>CustomEvent.detail type: ChartPointContextMenuEventDetail<CandlestickPointEventDetail>. Event names are case-sensitive.
{ count: number; replaced: number }CustomEvent.detail type: { count: number; replaced: number }. Event names are case-sensitive.
{ dropped: number }CustomEvent.detail type: { dropped: number }. Event names are case-sensitive.
CartesianTooltipEventDetailWhether to display the built-in tooltip.
voidCustomEvent.detail type: void. Event names are case-sensitive.
CartesianTooltipActionEventDetailCustomEvent.detail type: CartesianTooltipActionEventDetail. Event names are case-sensitive.
voidCustomEvent.detail type: void. Event names are case-sensitive.
voidCustomEvent.detail type: void. Event names are case-sensitive.
voidCustomEvent.detail type: void. Event names are case-sensitive.
CartesianZoomChangeEventDetailFired after every zoom change (drag / pan / wheel / pinch / keyboard / api / reset) with the new state.
Methods 35

Stencil methods return Promises. Use await within an async function to read the result.

Method / ArgumentsReturn typeDescription
Promise<ChartDataTable>Current normalized table, including the retained stream; independent of GPU availability.
Promise<CandlestickRenderResult>Draws a frame now; rejects with the SyidaxLicenseError while the type is not entitled or the chart is frozen.
Promise<CandlestickEngineTier>An asynchronous method. Check the argument and return types below.
Promise<string | undefined>An asynchronous method. Check the argument and return types below.
data: CandlestickDataPromise<void>An asynchronous method. Check the argument and return types below.
bar: CandlestickBarInputPromise<void>Upsert one bar (a matching time replaces — the live candle).
bars: ReadonlyArray<CandlestickBarInput>Promise<void>An asynchronous method. Check the argument and return types below.
count: numberPromise<void>Drop the oldest streamed bars (the `data` bars are not the stream).
bars: ReadonlyArray<CandlestickBarInput>Promise<void>An asynchronous method. Check the argument and return types below.
Promise<CandlestickStreamSource | undefined>An asynchronous method. Check the argument and return types below.
options: { duration?: number; easing?: CandlestickEasing; enabled?: boolean; type?: CandlestickAnimationType }Promise<void>An asynchronous method. Check the argument and return types below.
Promise<void>An asynchronous method. Check the argument and return types below.
Promise<void>An asynchronous method. Check the argument and return types below.
Promise<void>An asynchronous method. Check the argument and return types below.
cssX: number, cssY: numberPromise<CandlestickPointEventDetail | null>The bar under a host-local point (the nearest bar within half a pitch, anywhere inside the plot's height).
index: numberPromise<CandlestickBar | null>The normalised bar at an index (null outside).
time: numberPromise<(CandlestickBar & { index: number }) | null>The bar nearest to a time (null for an empty series).
Promise<number>An asynchronous method. Check the argument and return types below.
Promise<CandlestickExtent>An asynchronous method. Check the argument and return types below.
Promise<CandlestickDomain>An asynchronous method. Check the argument and return types below.
Promise<CandlestickVisibleRange>The bars the plot shows: the `x-axis` window, narrowed by the zoom when one is in place.
index: numberPromise<CartesianTooltipEventDetail | null>An asynchronous method. Check the argument and return types below.
Promise<void>An asynchronous method. Check the argument and return types below.
index: numberPromise<CandlestickPointEventDetail | null>An asynchronous method. Check the argument and return types below.
Promise<CandlestickOverlayState[]>An asynchronous method. Check the argument and return types below.
index: numberPromise<Record<string, number | null>>An asynchronous method. Check the argument and return types below.
Promise<CandlestickPaneRects>An asynchronous method. Check the argument and return types below.
Promise<CandlestickTimeScaleState>An asynchronous method. Check the argument and return types below.
request: CartesianZoomRequestPromise<CartesianZoomChangeEventDetail | null>Zoom to explicit windows: `x` / `y` as `{ min, max }` or `[min, max]` (`null` clears that orientation; x in slots under the ordinal scale — bar i sits at i — or epoch ms under linear, y in price); `xAxis` / `yAxis` name the axis by id or slot index (default: the primary axis).
factor: number, anchorFraction?: numberPromise<CartesianZoomChangeEventDetail | null>Scale the current windows by `factor` (< 1 zooms in) around `anchorFraction` (0..1, default centre).
delta: { x?: number; y?: number }Promise<CartesianZoomChangeEventDetail | null>Slide the zoomed windows by data units (`{ x?, y? }` — x in slots or ms, y in price); a no-op at the full extent.
Promise<CartesianZoomChangeEventDetail | null>Back to the full extent.
Promise<CartesianZoomState | null>The current zoom state (`null` = full extent).
request?: CartesianZoomExtentRequestPromise<CartesianZoomExtentDetail | null>The full extent (and key) of the primary — or the named — master axes (x: the visible slot range −0.5 … n − 0.5 under ordinal, the ms window under linear; y: the fitted price domain).
Promise<ChartEngineStatus>Requested engine vs what runs, and why (CHART-ADD-08): the decision for the current inputs, read without side effects (ProChartLicense.engineStatus); a renderer that failed at run time reports engine-unsupported.