Lattice Grid

blog

Candlestick Chart of a Daily Price Series

Building…
Loading a live grid…

If you trade from a blotter, the question you ask of a price at the end of each day is how it moved: where it opened, how far it ran in either direction, where it closed, and how much changed hands on the way. Five columns of numbers per day hold all of that, but you cannot see a run of lower closes by reading down them.

A candlestick chart answers that. Each day is one candle, with a body from open to close and a wick out to the high and the low, and the volume traded sits in a pane beneath. The chart above is bound to the grid under it, one row per day, so filtering the rows redraws the chart. Filter the Week column to one week and the candles and volume bars shrink to the days left.

Why a candlestick and not a line

A line chart of the close throws away three of the four prices. A candlestick keeps all of them in one mark, so a day that opened high, fell, and recovered looks different from a day that drifted flat, even when both closed at the same figure.

The chart over a grid

The candlestick takes four measures in open, high, low, close order. The volume option names the column of traded volume and draws it in a pane under the price, on the same x axis, with each bar in the colour of its candle. Because the dates are drawn in bands, weekends leave no gap. Here is the example in plain JavaScript, with sample rows inline in place of your own.

import { createGrid } from '@toclocoinc/lattice-grid';
import '@toclocoinc/lattice-grid/css';
import { createChart } from '@toclocoinc/lattice-grid/modules/charts';

const rows = [
  { id: 1, day: '2026-09-28', open: 120.0, high: 121.8, low: 119.2, close: 121.1, volume: 52000 },
  { id: 2, day: '2026-09-29', open: 121.1, high: 123.0, low: 120.6, close: 122.7, volume: 61000 },
  { id: 3, day: '2026-09-30', open: 122.7, high: 123.1, low: 120.9, close: 121.4, volume: 58000 },
  { id: 4, day: '2026-10-01', open: 121.4, high: 121.9, low: 118.8, close: 119.3, volume: 74000 },
  { id: 5, day: '2026-10-02', open: 119.3, high: 121.2, low: 119.0, close: 120.8, volume: 49000 },
];
const gridEl = document.createElement('div');
const chartEl = document.createElement('div');
gridEl.style.height = '240px';
chartEl.style.height = '420px';
document.body.append(gridEl, chartEl);

const grid = createGrid(gridEl, {
  rowKey: 'id', rows,
  columns: [
    { field: 'day', title: 'Day', type: 'date' },
    ...['open', 'high', 'low', 'close'].map((field) =>
      ({ field, title: field, type: 'number', format: { decimals: 2 } })),
    { field: 'volume', title: 'Volume', type: 'number' },
  ],
});
createChart({ grid, container: chartEl, type: 'candlestick', x: 'day',
  measures: ['open', 'high', 'low', 'close'], volume: 'volume',
  axis: { y: { position: 'right' } }, cursor: true });

The same thing in React

The React adapter is a factory, so you build the component once at module scope. The ref’s grid is the real grid, which is what the chart binds to.

import React, { useEffect, useRef } from 'react';
import { createGrid } from '@toclocoinc/lattice-grid';
import '@toclocoinc/lattice-grid/css';
import { createLatticeGrid } from '@toclocoinc/lattice-grid/modules/react';
import { createChart } from '@toclocoinc/lattice-grid/modules/charts';

const LatticeGrid = createLatticeGrid({ React, createGrid });
const rows = [
  { id: 1, day: '2026-09-28', open: 120.0, high: 121.8, low: 119.2, close: 121.1, volume: 52000 },
  { id: 2, day: '2026-09-29', open: 121.1, high: 123.0, low: 120.6, close: 122.7, volume: 61000 },
  { id: 3, day: '2026-09-30', open: 122.7, high: 123.1, low: 120.9, close: 121.4, volume: 58000 },
];
const columns = [
  { field: 'day', title: 'Day', type: 'date' },
  ...['open', 'high', 'low', 'close'].map((field) => ({ field, title: field, type: 'number' })),
  { field: 'volume', title: 'Volume', type: 'number' },
];

export function PriceBoard() {
  const gridRef = useRef(null);
  const chartRef = useRef(null);
  useEffect(() => {
    const chart = createChart({ grid: gridRef.current.grid, container: chartRef.current,
      type: 'candlestick', x: 'day', measures: ['open', 'high', 'low', 'close'],
      volume: 'volume' });
    return () => chart.destroy();
  }, []);
  return (<>
    <LatticeGrid ref={gridRef} rowKey="id" columns={columns} rows={rows}
      style={{ height: 200 }} />
    <div ref={chartRef} style={{ height: 400 }} />
  </>);
}

The options used

These are the rows of the charts reference for the options in the listings above.

Option Type What it does
grid Grid Required. The grid to read.
container Element or string Required. Where to draw.
type string 'candlestick' here, one candle per period.
x string The date column. A candlestick over dates draws them in bands.
measures ChartMeasure[] Four measures, in open, high, low, close order.
volume string The column of traded volume, summed per period and drawn in a pane under the price.
volumePane { height? } The volume pane’s share of the plot, 0.25 by default.
axis { x?, y? } y.position moves the price axis to the right.
cursor boolean or object A hairline that snaps to the nearest day and lists open, high, low and close in the tooltip.

Reading the board

Read the colour first: a run of falling candles is a run of closes below opens. Then read the bar beneath. A fall on heavy volume says more than a fall on thin volume, and the pane puts both on one x axis so you do not match them by eye. To check a figure, hover a day and read the tooltip against the same row in the grid.

Next

See candlesticks beside the other specialist charts in the specialist charts family demo, try the candlestick demo, read the full list of chart types on the charts page, or follow the how-to for a chart that follows the grid.

Read next

  • Funnel Chart for a Sales Pipeline

    Bind a funnel chart to a grid of pipeline counts: leads, qualified, proposal, won. Filter the rows by region to redraw the drop at each stage.

  • Gauge Chart of Warehouse Utilisation

    Bind a gauge chart to a grid of warehouse zones and read utilisation against its bands. Filter the rows and the needle moves.

  • Radar Chart for Supplier Scorecards

    Bind a radar chart to a grid of supplier scores: one spoke per criterion, one shape per supplier. Filter the rows to redraw it.

All posts RSS