DocsChartsSpecialty
ComposedChart
React example follows below.
ts
import { ComposedChart } from "@grassroot/charts-react"; const xy = [ { x: "Jan", y: 14 }, { x: "Feb", y: 21 }, { x: "Mar", y: 18 }, { x: "Apr", y: 27 },]; <ComposedChart layers={[{ kind: "bar", data: xy }, { kind: "line", data: xy }]} />ts
<script setup lang="ts">import { ComposedChart } from "@grassroot/charts-vue"; const xy = [ { x: "Jan", y: 14 }, { x: "Feb", y: 21 }, { x: "Mar", y: 18 }, { x: "Apr", y: 27 },];</script> <template> <ComposedChart :layers='[{ kind: "bar", data: xy }, { kind: "line", data: xy }]' /></template>ts
import { ChangeDetectionStrategy, Component } from "@angular/core";import { GrassrootComposedChart } from "@grassroot/charts-angular"; @Component({ selector: "app-composed-chart-chart-demo", standalone: true, imports: [GrassrootComposedChart], changeDetection: ChangeDetectionStrategy.OnPush, template: `<grassroot-composed-chart [layers]='[{ kind: "bar", data: xy }, { kind: "line", data: xy }]' />`,})export class ComposedChartDemoComponent { readonly xy = [ { x: "Jan", y: 14 }, { x: "Feb", y: 21 }, { x: "Mar", y: 18 }, { x: "Apr", y: 27 }, ];} export default ComposedChartDemoComponent;ts
<script lang="ts"> import { ComposedChart } from "@grassroot/charts-svelte"; const xy = [ { x: "Jan", y: 14 }, { x: "Feb", y: 21 }, { x: "Mar", y: 18 }, { x: "Apr", y: 27 }, ];</script> <ComposedChart layers={[{ kind: "bar", data: xy }, { kind: "line", data: xy }]} />ts
/** @jsxImportSource solid-js */import { ComposedChart } from "@grassroot/charts-solid"; const xy = [ { x: "Jan", y: 14 }, { x: "Feb", y: 21 }, { x: "Mar", y: 18 }, { x: "Apr", y: 27 },]; export default function ComposedChartDemo() { return <ComposedChart layers={[{ kind: "bar", data: xy }, { kind: "line", data: xy }]} />;}Installation
bash
pnpm dlx grassroot add chart/composed-chartbash
npx grassroot@latest add chart/composed-chartbash
yarn dlx grassroot add chart/composed-chartbash
bunx grassroot add chart/composed-chartAPI Reference
| Prop | Type | Default |
|---|---|---|
layersrequired | readonly ComposedChartLayer[] | — |