demo D214
Candlestick in Angular
Open, high, low and close, one row a day
type: 'candlestick', measures: [open, high, low, close]
This draws a candlestick chart, one candle a day from open, high, low and close, with a price axis on the right, zoom and pan, and a drawing rail for trend lines, channels, Fibonacci retracements and measuring a range. It shows a market's daily range and direction in the form traders read, straight from the grid's rows.
This is the Angular version. A standalone component takes the whole configuration through one config input, surfaces grid events as outputs, and exposes the live grid on a getter for anything the inputs do not cover.
The configuration
import { Component, ViewChild } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import { createGrid } from '@toclocoinc/lattice-grid';
import '@toclocoinc/lattice-grid/css';
import { createChart } from '@toclocoinc/lattice-grid/modules/charts';
import { LatticeGridComponent, provideLattice } from '@toclocoinc/lattice-grid/angular';
const columns = [
{ field: 'day', title: 'Day', type: 'date', layout: { width: 120 } },
{ field: 'open', title: 'Open', type: 'number', format: { decimals: 2 } },
{ field: 'high', title: 'High', type: 'number', format: { decimals: 2 } },
{ field: 'low', title: 'Low', type: 'number', format: { decimals: 2 } },
{ field: 'close', title: 'Close', type: 'number', format: { decimals: 2 } },
];
// e.g. [{ id: 1, day: '2026-01-02', open: 100, high: 101.2, low: 99.3, close: 100.8 }, ...]
const rows = [/* one row a day */];
@Component({
selector: 'app-root',
standalone: true,
imports: [LatticeGridComponent],
template:
'<div id="chart" style="height:320px"></div>' +
'<lattice-grid [config]="grid" (grid-ready)="onGridReady()" style="display:block;height:320px;margin-top:14px"></lattice-grid>',
})
export class AppComponent {
@ViewChild(LatticeGridComponent) gridRef!: LatticeGridComponent;
grid = {
rowKey: 'id',
columns: columns,
rows: rows,
};
// The grid is created once the view has rendered, so the live instance
// arrives on grid-ready rather than in ngAfterViewInit.
onGridReady() {
const grid = this.gridRef.grid;
// Candlestick takes four measures, in open, high, low, close order.
createChart({ grid, container: '#chart', type: 'candlestick', x: 'day',
measures: [{ col: 'open' }, { col: 'high' }, { col: 'low' }, { col: 'close' }],
title: 'Daily range' });
}
}
bootstrapApplication(AppComponent, {
providers: [provideLattice({ createGrid })],
});