DocsChartsScalar field
ContourChart
React example follows below.
ts
import { ContourChart } from "@grassroot/charts-react"; const rasterCells = Array.from({ length: 24 }, (_, index) => ({ x: index % 6, y: Math.floor(index / 6), value: 2 + (index * 7) % 19 })); <ContourChart cells={rasterCells} />ts
<script setup lang="ts">import { ContourChart } 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> <ContourChart :cells='rasterCells' /></template>ts
import { ChangeDetectionStrategy, Component } from "@angular/core";import { GrassrootContourChart } from "@grassroot/charts-angular"; @Component({ selector: "app-contour-chart-chart-demo", standalone: true, imports: [GrassrootContourChart], changeDetection: ChangeDetectionStrategy.OnPush, template: `<grassroot-contour-chart [cells]='rasterCells' />`,})export class ContourChartDemoComponent { readonly rasterCells = Array.from({ length: 24 }, (_, index) => ({ x: index % 6, y: Math.floor(index / 6), value: 2 + (index * 7) % 19 }));} export default ContourChartDemoComponent;ts
<script lang="ts"> import { ContourChart } 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> <ContourChart cells={rasterCells} />ts
/** @jsxImportSource solid-js */import { ContourChart } 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 ContourChartDemo() { return <ContourChart cells={rasterCells} />;}Installation
bash
pnpm dlx grassroot add chart/contour-chartbash
npx grassroot@latest add chart/contour-chartbash
yarn dlx grassroot add chart/contour-chartbash
bunx grassroot add chart/contour-chartAPI Reference
| Prop | Type | Default |
|---|---|---|
cellsrequired | readonly RasterHeatmapCell[] | — |
thresholds | readonly number[] | undefined | — |