- Prop
points- Type
readonly { x: number; y: number; id?: string; }[]- Default
- —
- Requirement
- required
VoronoiOverlay
React example follows below.
Vue example follows below.
Angular example follows below.
Svelte example follows below.
Solid example follows below.
- surface
- —
- marks
- —
- size
- —
- value
- —
ts
import { VoronoiOverlay } from "@grassroot/charts-react"; const demandSites = [ { id: "highlands", x: 42, y: 36, }, { id: "north", x: 58, y: 78, }, { id: "northwest", x: 88, y: 48, }, { id: "west", x: 112, y: 142, }, { id: "central", x: 174, y: 94, }, { id: "midlands", x: 196, y: 128, }, { id: "east", x: 238, y: 62, }, { id: "south", x: 274, y: 152, }, { id: "southwest", x: 248, y: 178, }, { id: "coast", x: 320, y: 108, },]; export default function VoronoiOverlayDemo() { return ( <div> <svg viewBox="0 0 360 220" width="360" height="220" style={{ maxWidth: "100%" }} role="img" aria-label="Nearest-site interaction zones for ten regional demand centres" > <title>Regional demand centres with nearest-point hit areas</title> {demandSites.map((site) => ( <circle key={site.id} cx={site.x} cy={site.y} r={6} fill="var(--accent)" /> ))} <VoronoiOverlay points={demandSites} width={360} height={220} aria-label="Nearest demand centre hit areas" /> </svg> </div> );}- surface
- —
- marks
- —
- size
- —
- value
- —
ts
<script setup lang="ts">import { VoronoiOverlay } from "@grassroot/charts-vue"; const demandSites = [ { id: "highlands", x: 42, y: 36, }, { id: "north", x: 58, y: 78, }, { id: "northwest", x: 88, y: 48, }, { id: "west", x: 112, y: 142, }, { id: "central", x: 174, y: 94, }, { id: "midlands", x: 196, y: 128, }, { id: "east", x: 238, y: 62, }, { id: "south", x: 274, y: 152, }, { id: "southwest", x: 248, y: 178, }, { id: "coast", x: 320, y: 108, },];</script> <template> <svg viewBox="0 0 360 220" width="360" height="220" style="max-width: 100%" role="img" aria-label="Nearest-site interaction zones for ten regional demand centres" > <title>Regional demand centres with nearest-point hit areas</title> <circle v-for="site in demandSites" :key="site.id" :cx="site.x" :cy="site.y" r="6" fill="var(--accent)" /> <VoronoiOverlay :points="demandSites" :width="360" :height="220" aria-label="Nearest demand centre hit areas" /> </svg></template>- surface
- —
- marks
- —
- size
- —
- value
- —
ts
import { ChangeDetectionStrategy, Component } from "@angular/core";import { GrassrootVoronoiOverlay } from "@grassroot/charts-angular"; @Component({ selector: "app-voronoi-overlay-chart-demo", standalone: true, imports: [GrassrootVoronoiOverlay], changeDetection: ChangeDetectionStrategy.OnPush, template: `<svg viewBox="0 0 360 220" width="360" height="220" style="max-width: 100%" role="img" aria-label="Nearest-site interaction zones for ten regional demand centres" > <title>Regional demand centres with nearest-point hit areas</title> <circle cx="42" cy="36" r="6" fill="var(--accent)" /> <circle cx="58" cy="78" r="6" fill="var(--accent)" /> <circle cx="88" cy="48" r="6" fill="var(--accent)" /> <circle cx="112" cy="142" r="6" fill="var(--accent)" /> <circle cx="174" cy="94" r="6" fill="var(--accent)" /> <circle cx="196" cy="128" r="6" fill="var(--accent)" /> <circle cx="238" cy="62" r="6" fill="var(--accent)" /> <circle cx="274" cy="152" r="6" fill="var(--accent)" /> <circle cx="248" cy="178" r="6" fill="var(--accent)" /> <circle cx="320" cy="108" r="6" fill="var(--accent)" /> <g grassroot-voronoi-overlay [points]="demandSites" [width]="360" [height]="220" aria-label="Nearest demand centre hit areas" ></g> </svg>`,})export class VoronoiOverlayDemoComponent { readonly demandSites = [ { id: "highlands", x: 42, y: 36, }, { id: "north", x: 58, y: 78, }, { id: "northwest", x: 88, y: 48, }, { id: "west", x: 112, y: 142, }, { id: "central", x: 174, y: 94, }, { id: "midlands", x: 196, y: 128, }, { id: "east", x: 238, y: 62, }, { id: "south", x: 274, y: 152, }, { id: "southwest", x: 248, y: 178, }, { id: "coast", x: 320, y: 108, }, ];} export default VoronoiOverlayDemoComponent;- surface
- —
- marks
- —
- size
- —
- value
- —
ts
<script lang="ts"> import { VoronoiOverlay } from "@grassroot/charts-svelte"; const demandSites = [ { id: "highlands", x: 42, y: 36, }, { id: "north", x: 58, y: 78, }, { id: "northwest", x: 88, y: 48, }, { id: "west", x: 112, y: 142, }, { id: "central", x: 174, y: 94, }, { id: "midlands", x: 196, y: 128, }, { id: "east", x: 238, y: 62, }, { id: "south", x: 274, y: 152, }, { id: "southwest", x: 248, y: 178, }, { id: "coast", x: 320, y: 108, }, ];</script> <svg viewBox="0 0 360 220" width="360" height="220" style="max-width: 100%" role="img" aria-label="Nearest-site interaction zones for ten regional demand centres"> <title>Regional demand centres with nearest-point hit areas</title> {#each demandSites as site (site.id)} <circle cx={site.x} cy={site.y} r="6" fill="var(--accent)" /> {/each} <VoronoiOverlay points={demandSites} width={360} height={220} aria-label="Nearest demand centre hit areas" /></svg>- surface
- —
- marks
- —
- size
- —
- value
- —
ts
/** @jsxImportSource solid-js */import { For } from "solid-js";import { VoronoiOverlay } from "@grassroot/charts-solid"; const demandSites = [ { id: "highlands", x: 42, y: 36, }, { id: "north", x: 58, y: 78, }, { id: "northwest", x: 88, y: 48, }, { id: "west", x: 112, y: 142, }, { id: "central", x: 174, y: 94, }, { id: "midlands", x: 196, y: 128, }, { id: "east", x: 238, y: 62, }, { id: "south", x: 274, y: 152, }, { id: "southwest", x: 248, y: 178, }, { id: "coast", x: 320, y: 108, },]; export default function VoronoiOverlayDemo() { return ( <svg viewBox="0 0 360 220" width="360" height="220" style={{ "max-width": "100%" }} role="img" aria-label="Nearest-site interaction zones for ten regional demand centres" > <title>Regional demand centres with nearest-point hit areas</title> <For each={demandSites}> {(site) => <circle cx={site.x} cy={site.y} r="6" fill="var(--accent)" />} </For> <VoronoiOverlay points={demandSites} width={360} height={220} aria-label="Nearest demand centre hit areas" /> </svg> );}Installation
API Reference
Import
import { VoronoiOverlay } from "@grassroot/charts-react";
Props
Prop
Type
Default
Requirement
pointsreadonly { x: number; y: number; id?: string; }[]—
required
widthnumber | undefined—
optional
heightnumber | undefined—
optional
- Prop
width- Type
number | undefined- Default
- —
- Requirement
- optional
- Prop
height- Type
number | undefined- Default
- —
- Requirement
- optional
Content regions
children
Native attributes
Standard DOM and ARIA attributes not listed above spread onto the root element.
Import
import { VoronoiOverlay } from "@grassroot/charts-vue";
Props
Prop
Type
Default
Requirement
pointsreadonly { x: number; y: number; id?: string; }[]—
required
widthnumber | undefinedVORONOI_OVERLAY_DEFAULT_WIDTHoptional
heightnumber | undefinedVORONOI_OVERLAY_DEFAULT_HEIGHToptional
- Prop
points- Type
readonly { x: number; y: number; id?: string; }[]- Default
- —
- Requirement
- required
- Prop
width- Type
number | undefined- Default
VORONOI_OVERLAY_DEFAULT_WIDTH- Requirement
- optional
- Prop
height- Type
number | undefined- Default
VORONOI_OVERLAY_DEFAULT_HEIGHT- Requirement
- optional
Content regions
default
Import
import { ChangeDetectionStrategy, Component } from "@angular/core";
import { GrassrootVoronoiOverlay } from "@grassroot/charts-angular";
Props
Prop
Type
Default
Requirement
pointsreadonly { x: number; y: number; id?: string }[]—
required
widthnumberVORONOI_OVERLAY_DEFAULT_WIDTHoptional
heightnumberVORONOI_OVERLAY_DEFAULT_HEIGHToptional
- Prop
points- Type
readonly { x: number; y: number; id?: string }[]- Default
- —
- Requirement
- required
- Prop
width- Type
number- Default
VORONOI_OVERLAY_DEFAULT_WIDTH- Requirement
- optional
- Prop
height- Type
number- Default
VORONOI_OVERLAY_DEFAULT_HEIGHT- Requirement
- optional
Content regions
default
Import
import { VoronoiOverlay } from "@grassroot/charts-svelte";
Props
Prop
Type
Default
Requirement
pointsreadonly { x: number; y: number; id?: string }[]—
required
widthnumber—
optional
heightnumber—
optional
- Prop
points- Type
readonly { x: number; y: number; id?: string }[]- Default
- —
- Requirement
- required
- Prop
width- Type
number- Default
- —
- Requirement
- optional
- Prop
height- Type
number- Default
- —
- Requirement
- optional
Content regions
children
Import
import { For } from "solid-js";
import { VoronoiOverlay } from "@grassroot/charts-solid";
Props
Prop
Type
Default
Requirement
pointsreadonly { x: number; y: number; id?: string }[]—
required
widthnumber—
optional
heightnumber—
optional
- Prop
points- Type
readonly { x: number; y: number; id?: string }[]- Default
- —
- Requirement
- required
- Prop
width- Type
number- Default
- —
- Requirement
- optional
- Prop
height- Type
number- Default
- —
- Requirement
- optional
Content regions
children
Native attributes
Standard DOM and ARIA attributes not listed above spread onto the root element.