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

DocsChartsInterval & uncertainty

ConfidenceBandChart

React example follows below.
ts
import { ConfidenceBandChart } from "@grassroot/charts-react";
const xy = [
{ x: "Jan", y: 14 },
{ x: "Feb", y: 21 },
{ x: "Mar", y: 18 },
{ x: "Apr", y: 27 },
];
const bands = xy.map((item, index) => ({ ...item, low: item.y - 3 - index, high: item.y + 4 + index }));
<ConfidenceBandChart data={bands} />
ts
<script setup lang="ts">
import { ConfidenceBandChart } from "@grassroot/charts-vue";
const xy = [
{ x: "Jan", y: 14 },
{ x: "Feb", y: 21 },
{ x: "Mar", y: 18 },
{ x: "Apr", y: 27 },
];
const bands = xy.map((item, index) => ({ ...item, low: item.y - 3 - index, high: item.y + 4 + index }));
</script>
<template>
<ConfidenceBandChart :data='bands' />
</template>
ts
import { ChangeDetectionStrategy, Component } from "@angular/core";
import { GrassrootConfidenceBandChart } from "@grassroot/charts-angular";
@Component({
selector: "app-confidence-band-chart-chart-demo",
standalone: true,
imports: [GrassrootConfidenceBandChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `<grassroot-confidence-band-chart [data]='bands' />`,
})
export class ConfidenceBandChartDemoComponent {
readonly xy = [
{ x: "Jan", y: 14 },
{ x: "Feb", y: 21 },
{ x: "Mar", y: 18 },
{ x: "Apr", y: 27 },
];
readonly bands = this.xy.map((item, index) => ({ ...item, low: item.y - 3 - index, high: item.y + 4 + index }));
}
export default ConfidenceBandChartDemoComponent;
ts
<script lang="ts">
import { ConfidenceBandChart } from "@grassroot/charts-svelte";
const xy = [
{ x: "Jan", y: 14 },
{ x: "Feb", y: 21 },
{ x: "Mar", y: 18 },
{ x: "Apr", y: 27 },
];
const bands = xy.map((item, index) => ({ ...item, low: item.y - 3 - index, high: item.y + 4 + index }));
</script>
<ConfidenceBandChart data={bands} />
ts
/** @jsxImportSource solid-js */
import { ConfidenceBandChart } from "@grassroot/charts-solid";
const xy = [
{ x: "Jan", y: 14 },
{ x: "Feb", y: 21 },
{ x: "Mar", y: 18 },
{ x: "Apr", y: 27 },
];
const bands = xy.map((item, index) => ({ ...item, low: item.y - 3 - index, high: item.y + 4 + index }));
export default function ConfidenceBandChartDemo() {
return <ConfidenceBandChart data={bands} />;
}

Installation

bash
pnpm dlx grassroot add chart/confidence-band-chart
bash
npx grassroot@latest add chart/confidence-band-chart
bash
yarn dlx grassroot add chart/confidence-band-chart
bash
bunx grassroot add chart/confidence-band-chart

API Reference

ConfidenceBandChartProps
PropTypeDefault
datarequiredreadonly BandDatum[]