CLI previewInstall commands shown on this site are not released yet.

DocsChartsScalar field

RasterHeatmap

React example follows below.
ts
import { RasterHeatmap } from "@grassroot/charts-react";
const rasterCells = Array.from({ length: 24 }, (_, index) => ({ x: index % 6, y: Math.floor(index / 6), value: 2 + (index * 7) % 19 }));
<RasterHeatmap cells={rasterCells} />
ts
<script setup lang="ts">
import { RasterHeatmap } from "@grassroot/charts-vue";
const rasterCells = Array.from({ length: 24 }, (_, index) => ({ x: index % 6, y: Math.floor(index / 6), value: 2 + (index * 7) % 19 }));
</script>
<template>
<RasterHeatmap :cells='rasterCells' />
</template>
ts
import { ChangeDetectionStrategy, Component } from "@angular/core";
import { GrassrootRasterHeatmap } from "@grassroot/charts-angular";
@Component({
selector: "app-raster-heatmap-chart-demo",
standalone: true,
imports: [GrassrootRasterHeatmap],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `<grassroot-raster-heatmap [cells]='rasterCells' />`,
})
export class RasterHeatmapDemoComponent {
readonly rasterCells = Array.from({ length: 24 }, (_, index) => ({ x: index % 6, y: Math.floor(index / 6), value: 2 + (index * 7) % 19 }));
}
export default RasterHeatmapDemoComponent;
ts
<script lang="ts">
import { RasterHeatmap } from "@grassroot/charts-svelte";
const rasterCells = Array.from({ length: 24 }, (_, index) => ({ x: index % 6, y: Math.floor(index / 6), value: 2 + (index * 7) % 19 }));
</script>
<RasterHeatmap cells={rasterCells} />
ts
/** @jsxImportSource solid-js */
import { RasterHeatmap } from "@grassroot/charts-solid";
const rasterCells = Array.from({ length: 24 }, (_, index) => ({ x: index % 6, y: Math.floor(index / 6), value: 2 + (index * 7) % 19 }));
export default function RasterHeatmapDemo() {
return <RasterHeatmap cells={rasterCells} />;
}

Installation

bash
pnpm dlx grassroot add chart/raster-heatmap
bash
npx grassroot@latest add chart/raster-heatmap
bash
yarn dlx grassroot add chart/raster-heatmap
bash
bunx grassroot add chart/raster-heatmap

API Reference

RasterHeatmapProps
PropTypeDefault
cellsrequiredreadonly RasterHeatmapCell[]
columnsnumber | undefined
rowsnumber | undefined