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

DocsChartsPrimitives

Polygon

React example follows below.
ts
import { Polygon } from "@grassroot/charts-react";
<Polygon points={[[34, 170], [92, 62], [154, 138], [236, 48], [314, 164]]} fill="var(--accent)" stroke="var(--vs-chart-axis)" />
ts
<script setup lang="ts">
import { Polygon } from "@grassroot/charts-vue";
</script>
<template>
<Polygon :points='[[34, 170], [92, 62], [154, 138], [236, 48], [314, 164]]' fill="var(--accent)" stroke="var(--vs-chart-axis)" />
</template>
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: `<grassroot-polygon [points]='[[34, 170], [92, 62], [154, 138], [236, 48], [314, 164]]' fill="var(--accent)" stroke="var(--vs-chart-axis)" />`,
})
export class PolygonDemoComponent {
}
export default PolygonDemoComponent;
ts
<script lang="ts">
import { Polygon } from "@grassroot/charts-svelte";
</script>
<Polygon points={[[34, 170], [92, 62], [154, 138], [236, 48], [314, 164]]} fill="var(--accent)" stroke="var(--vs-chart-axis)" />
ts
/** @jsxImportSource solid-js */
import { Polygon } from "@grassroot/charts-solid";
export default function PolygonDemo() {
return <Polygon points={[[34, 170], [92, 62], [154, 138], [236, 48], [314, 164]]} fill="var(--accent)" stroke="var(--vs-chart-axis)" />;
}

Installation

bash
pnpm dlx grassroot add chart/polygon
bash
npx grassroot@latest add chart/polygon
bash
yarn dlx grassroot add chart/polygon
bash
bunx grassroot add chart/polygon

API Reference

PolygonProps
PropTypeDefault
pointsrequiredreadonly (readonly [number, number])[]