Lattice Grid Buy a licence

demo D214

Candlestick

Open, high, low and close, one row a day

type: 'candlestick', measures: [open, high, low, close]

Building…
Loading a live grid…

The configuration

import * as ng from '@angular/core';
import { Component, ViewChild, AfterViewInit } 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 createLatticeGrid from '@toclocoinc/lattice-grid/modules/angular';

const { LatticeGridComponent } = createLatticeGrid({ ng, createGrid });

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" style="display:block;height:320px;margin-top:14px"></lattice-grid>',
})
export class AppComponent implements AfterViewInit {
  @ViewChild(LatticeGridComponent) gridRef!: LatticeGridComponent;

  grid = {
    rowKey: 'id',
    columns: columns,
    rows: rows,
  };

  ngAfterViewInit() {
    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);