Lattice Grid Buy a licence

demo D215

Gantt

A row label with a start and an end, coloured by phase

type: 'gantt', label, start, end

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: 'task',  title: 'Task', layout: { width: 160 } },
  { field: 'phase', title: 'Phase', filter: { type: 'set' } },
  { field: 'start', title: 'Start', type: 'date' },
  { field: 'end',   title: 'End',   type: 'date' },
];

// e.g. [{ id: 1, task: 'Discovery', phase: 'Plan', start: '2026-01-06', end: '2026-01-14' }, ...]
const rows = [/* one row a task */];



@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;
    // Gantt reads a row label and a start and end date; series colours the bars.
    createChart({ grid, container: '#chart', type: 'gantt',
      label: 'task', start: 'start', end: 'end', series: 'phase', legend: true,
      title: 'Schedule by phase' });
  }
}

bootstrapApplication(AppComponent);