- Prop
points- Type
readonly (readonly [number, number])[]- Default
- —
- Requirement
- required
Polygon
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 { Polygon } from "@grassroot/charts-react"; export default function PolygonDemo() { return ( <div> <svg viewBox="0 0 360 220" width="360" height="220" style={{ maxWidth: "100%" }} role="img" aria-label="Weekday electricity demand profile from 00:00 to 22:00, peaking at 18:00" > <title>Weekday electricity demand profile</title> <Polygon points={[ [28, 176], [28, 154], [52, 148], [74, 136], [98, 128], [120, 118], [144, 104], [166, 86], [188, 58], [212, 44], [236, 52], [258, 76], [282, 98], [304, 122], [332, 146], [332, 176], ]} fill="var(--accent)" fillOpacity={0.24} stroke="var(--accent)" /> <text x={220} y={38} fontSize={12} fill="var(--vs-chart-ink)"> Peak demand · 18:00 </text> </svg> </div> );}- surface
- —
- marks
- —
- size
- —
- value
- —
ts
<script setup lang="ts">import { Polygon } from "@grassroot/charts-vue";</script> <template> <svg viewBox="0 0 360 220" width="360" height="220" style="max-width: 100%" role="img" aria-label="Weekday electricity demand profile from 00:00 to 22:00, peaking at 18:00" > <title>Weekday electricity demand profile</title> <Polygon :points="[ [28, 176], [28, 154], [52, 148], [74, 136], [98, 128], [120, 118], [144, 104], [166, 86], [188, 58], [212, 44], [236, 52], [258, 76], [282, 98], [304, 122], [332, 146], [332, 176], ]" fill="var(--accent)" :fill-opacity="0.24" stroke="var(--accent)" /> <text x="220" y="38" font-size="12" fill="var(--vs-chart-ink)">Peak demand · 18:00</text> </svg></template>- surface
- —
- marks
- —
- size
- —
- value
- —
ts
import { ChangeDetectionStrategy, Component } from "@angular/core";import { GrassrootPolygon } from "@grassroot/charts-angular"; @Component({ selector: "app-polygon-chart-demo", standalone: true, imports: [GrassrootPolygon], changeDetection: ChangeDetectionStrategy.OnPush, template: `<svg viewBox="0 0 360 220" width="360" height="220" style="max-width: 100%" role="img" aria-label="Weekday electricity demand profile from 00:00 to 22:00, peaking at 18:00" > <title>Weekday electricity demand profile</title> <polygon grassroot-polygon [points]="[ [28, 176], [28, 154], [52, 148], [74, 136], [98, 128], [120, 118], [144, 104], [166, 86], [188, 58], [212, 44], [236, 52], [258, 76], [282, 98], [304, 122], [332, 146], [332, 176], ]" fill="var(--accent)" [fillOpacity]="0.24" stroke="var(--accent)" ></polygon> <text x="220" y="38" font-size="12" fill="var(--vs-chart-ink)">Peak demand · 18:00</text> </svg>`,})export class PolygonDemoComponent {} export default PolygonDemoComponent;- surface
- —
- marks
- —
- size
- —
- value
- —
ts
<script lang="ts"> import { Polygon } from "@grassroot/charts-svelte";</script> <svg viewBox="0 0 360 220" width="360" height="220" style="max-width: 100%" role="img" aria-label="Weekday electricity demand profile from 00:00 to 22:00, peaking at 18:00"> <title>Weekday electricity demand profile</title> <Polygon points={[ [28, 176], [28, 154], [52, 148], [74, 136], [98, 128], [120, 118], [144, 104], [166, 86], [188, 58], [212, 44], [236, 52], [258, 76], [282, 98], [304, 122], [332, 146], [332, 176], ]} fill="var(--accent)" fillOpacity={0.24} stroke="var(--accent)" /> <text x="220" y="38" font-size="12" fill="var(--vs-chart-ink)">Peak demand · 18:00</text></svg>- surface
- —
- marks
- —
- size
- —
- value
- —
ts
/** @jsxImportSource solid-js */import { Polygon } from "@grassroot/charts-solid"; export default function PolygonDemo() { return ( <svg viewBox="0 0 360 220" width="360" height="220" style={{ "max-width": "100%" }} role="img" aria-label="Weekday electricity demand profile from 00:00 to 22:00, peaking at 18:00" > <title>Weekday electricity demand profile</title> <Polygon points={[ [28, 176], [28, 154], [52, 148], [74, 136], [98, 128], [120, 118], [144, 104], [166, 86], [188, 58], [212, 44], [236, 52], [258, 76], [282, 98], [304, 122], [332, 146], [332, 176], ]} fill="var(--accent)" fillOpacity={0.24} stroke="var(--accent)" /> <text x="220" y="38" font-size="12" fill="var(--vs-chart-ink)"> Peak demand · 18:00 </text> </svg> );}Installation
API Reference
Import
import { Polygon } from "@grassroot/charts-react";
Props
Prop
Type
Default
Requirement
pointsreadonly (readonly [number, number])[]—
required
Native attributes
Standard DOM and ARIA attributes not listed above spread onto the root element.
Import
import { Polygon } from "@grassroot/charts-vue";
Props
Prop
Type
Default
Requirement
pointsreadonly (readonly [number, number])[]—
required
fillstring | undefined"var(--accent, #b5342a)"optional
fillOpacitynumber | undefined0.18optional
strokestring | undefined"var(--accent, #b5342a)"optional
- Prop
points- Type
readonly (readonly [number, number])[]- Default
- —
- Requirement
- required
- Prop
fill- Type
string | undefined- Default
"var(--accent, #b5342a)"- Requirement
- optional
- Prop
fillOpacity- Type
number | undefined- Default
0.18- Requirement
- optional
- Prop
stroke- Type
string | undefined- Default
"var(--accent, #b5342a)"- Requirement
- optional
Import
import { ChangeDetectionStrategy, Component } from "@angular/core";
import { GrassrootPolygon } from "@grassroot/charts-angular";
Props
Prop
Type
Default
Requirement
pointsreadonly (readonly [number, number])[]—
required
fillstring"var(--accent, #b5342a)"optional
fillOpacitynumber0.18optional
strokestring"var(--accent, #b5342a)"optional
- Prop
points- Type
readonly (readonly [number, number])[]- Default
- —
- Requirement
- required
- Prop
fill- Type
string- Default
"var(--accent, #b5342a)"- Requirement
- optional
- Prop
fillOpacity- Type
number- Default
0.18- Requirement
- optional
- Prop
stroke- Type
string- Default
"var(--accent, #b5342a)"- Requirement
- optional
Import
import { Polygon } from "@grassroot/charts-svelte";
Props
Prop
Type
Default
Requirement
pointsreadonly (readonly [number, number])[]—
required
fillstring"var(--accent, #b5342a)"optional
fillOpacitynumber0.18optional
strokestring"var(--accent, #b5342a)"optional
classstring—
optional
- Prop
points- Type
readonly (readonly [number, number])[]- Default
- —
- Requirement
- required
- Prop
fill- Type
string- Default
"var(--accent, #b5342a)"- Requirement
- optional
- Prop
fillOpacity- Type
number- Default
0.18- Requirement
- optional
- Prop
stroke- Type
string- Default
"var(--accent, #b5342a)"- Requirement
- optional
- Prop
class- Type
string- Default
- —
- Requirement
- optional
Import
import { Polygon } from "@grassroot/charts-solid";
Props
Prop
Type
Default
Requirement
pointsreadonly (readonly [number, number])[]—
required
fillstring—
optional
fillOpacitynumber—
optional
strokestring—
optional
classstring—
optional
- Prop
points- Type
readonly (readonly [number, number])[]- Default
- —
- Requirement
- required
- Prop
fill- Type
string- Default
- —
- Requirement
- optional
- Prop
fillOpacity- Type
number- Default
- —
- Requirement
- optional
- Prop
stroke- Type
string- Default
- —
- Requirement
- optional
- Prop
class- Type
string- Default
- —
- Requirement
- optional
Native attributes
Standard DOM and ARIA attributes not listed above spread onto the root element.