Docs Charts Core charts

LineChart

React example follows below.
ts
import { useState, type ComponentProps } from "react";
import { t6LineChartFixture } from "@grassroot/demo-fixtures";
import { LineChart } from "@grassroot/charts-react";
import type { CurveKind } from "@grassroot/charts-react";
/** Ordered loosest-to-tightest fit, so stepping through the toggles reads as a
* progression rather than an arbitrary list. */
const CURVES: readonly CurveKind[] = ["linear", "monotone-x", "catmull-rom", "basis", "step"];
const FIXTURE = t6LineChartFixture.props() as unknown as ComponentProps<typeof LineChart>;
export default function LineChartDemo() {
const [curve, setCurve] = useState<CurveKind>("linear");
return (
<div>
<div className="gr-demo-toggles" role="group" aria-label="Curve interpolation">
{CURVES.map((kind) => (
<button
key={kind}
type="button"
aria-pressed={curve === kind}
onClick={() => setCurve(kind)}
>
{kind}
</button>
))}
</div>
<LineChart {...FIXTURE} ariaLabel="Line chart" curve={curve} />
</div>
);
}
ts
<script setup lang="ts">
import { ref } from "vue";
import { t6LineChartFixture } from "@grassroot/demo-fixtures";
import { LineChart } from "@grassroot/charts-vue";
import type { CurveKind } from "@grassroot/charts-vue";
import type { ChartXDomain } from "@grassroot/ui-machines/chart-shell";
const props = defineProps<{
onSelectedIdsChange?: (ids: readonly string[]) => void;
onBrushDomainChange?: (domain: ChartXDomain) => void;
onZoomDomainChange?: (domain: ChartXDomain) => void;
}>();
const CURVES: readonly CurveKind[] = ["linear", "monotone-x", "catmull-rom", "basis", "step"];
const curve = ref<CurveKind>("linear");
</script>
<template>
<div>
<div class="gr-demo-toggles" role="group" aria-label="Curve interpolation">
<button
v-for="kind in CURVES"
:key="kind"
type="button"
:aria-pressed="curve === kind"
@click="curve = kind"
>
{{ kind }}
</button>
</div>
<LineChart
v-bind="{ ...t6LineChartFixture.props(), ariaLabel: 'Line chart', ...$attrs }"
:curve="curve"
@selected-ids-change="props.onSelectedIdsChange?.($event)"
@brush-domain-change="props.onBrushDomainChange?.($event)"
@zoom-domain-change="props.onZoomDomainChange?.($event)"
/>
</div>
</template>
ts
import { ChangeDetectionStrategy, Component, signal } from "@angular/core";
import { t6LineChartFixture } from "@grassroot/demo-fixtures";
import { GrassrootLineChart } from "@grassroot/charts-angular";
import type { CurveKind } from "@grassroot/charts-angular";
const CURVES: readonly CurveKind[] = ["linear", "monotone-x", "catmull-rom", "basis", "step"];
@Component({
selector: "app-line-chart-chart-demo",
standalone: true,
imports: [GrassrootLineChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `<div>
<div class="gr-demo-toggles" role="group" aria-label="Curve interpolation">
@for (kind of curves; track kind) {
<button type="button" [attr.aria-pressed]="curve() === kind" (click)="curve.set(kind)">
{{ kind }}
</button>
}
</div>
<grassroot-line-chart
[series]="fixture.series"
[ariaLabel]="'Line chart'"
[tooltip]="fixture.tooltip"
[legend]="fixture.legend"
[curve]="curve()"
[selectionMode]="fixture.selectionMode"
[selectedIds]="fixture.defaultSelectedIds"
[brushDomain]="fixture.defaultBrushDomain"
[zoomDomain]="fixture.defaultZoomDomain"
[zoomOnBrush]="fixture.zoomOnBrush"
(selectedIdsChange)="selected($event)"
(brushDomainChange)="brushed($event)"
(zoomDomainChange)="zoomed($event)"
/>
</div>`,
})
export class LineChartDemoComponent {
readonly fixture = t6LineChartFixture.props();
readonly curves = CURVES;
readonly curve = signal<CurveKind>("linear");
protected selected(ids: readonly string[]): void { this.callback("onSelectedIdsChange", ids); }
protected brushed(domain: unknown): void { this.callback("onBrushDomainChange", domain); }
protected zoomed(domain: unknown): void { this.callback("onZoomDomainChange", domain); }
private callback(key: string, value: unknown): void {
const callback = this.bind(key);
if (typeof callback === "function") callback(value);
}
}
export default LineChartDemoComponent;
ts
<script lang="ts">
import { t6LineChartFixture } from "@grassroot/demo-fixtures";
import { LineChart } from "@grassroot/charts-svelte";
import type { CurveKind } from "@grassroot/charts-svelte";
const CURVES: readonly CurveKind[] = ["linear", "monotone-x", "catmull-rom", "basis", "step"];
let curve = $state<CurveKind>("linear");
</script>
<div>
<div class="gr-demo-toggles" role="group" aria-label="Curve interpolation">
{#each CURVES as kind (kind)}
<button type="button" aria-pressed={curve === kind} onclick={() => (curve = kind)}>
{kind}
</button>
{/each}
</div>
<LineChart {...t6LineChartFixture.props()} ariaLabel="Line chart" {curve} />
</div>
ts
/** @jsxImportSource solid-js */
import { For, createSignal, type ComponentProps } from "solid-js";
import { t6LineChartFixture } from "@grassroot/demo-fixtures";
import { LineChart } from "@grassroot/charts-solid";
import type { CurveKind } from "@grassroot/charts-solid";
const CURVES: readonly CurveKind[] = ["linear", "monotone-x", "catmull-rom", "basis", "step"];
const FIXTURE = t6LineChartFixture.props() as unknown as ComponentProps<typeof LineChart>;
export default function LineChartDemo() {
const [curve, setCurve] = createSignal<CurveKind>("linear");
return (
<div>
<div class="gr-demo-toggles" role="group" aria-label="Curve interpolation">
<For each={CURVES}>
{(kind) => (
<button type="button" aria-pressed={curve() === kind} onClick={() => setCurve(kind)}>
{kind}
</button>
)}
</For>
</div>
<LineChart {...FIXTURE} ariaLabel="Line chart" curve={curve()} />
</div>
);
}

Installation

API Reference

Import

import { useState, type ComponentProps } from "react";
import { t6LineChartFixture } from "@grassroot/demo-fixtures";
import { LineChart } from "@grassroot/charts-react";
import type { CurveKind } from "@grassroot/charts-react";

Props

Prop
Type
Default
Requirement
Description
curve
CurveKind | undefined
—
optional
Curve interpolation between points.
live
boolean | undefined
—
optional
Adds the live endpoint glow and keeps the streaming state semantic.
series
ChartSeries[]
—
required
—
max
number | undefined
—
optional
—
xDomain
ChartNumericDomain | ChartTimeDomain | undefined
—
optional
—
xScale
"linear" | "log" | undefined
—
optional
—
yDomain
ChartNumericDomain | undefined
—
optional
—
xAxis
ChartAxisOptions<number | Date> | undefined
—
optional
—
yAxis
ChartAxisOptions<number> | undefined
—
optional
—
showGrid
boolean | undefined
—
optional
—
formatXTick
((value: number | Date, index: number) => string) | undefined
—
optional
—
formatYTick
((value: number, index: number) => string) | undefined
—
optional
—
speed
number | undefined
—
optional
Playback-speed multiplier for entrance/ambient motion.
morphDurationMs
number | undefined
—
optional
How long a dataset change tweens, in ms.
Prop
curve
Type
CurveKind | undefined
Default
—
Requirement
optional
Description
Curve interpolation between points.
Prop
live
Type
boolean | undefined
Default
—
Requirement
optional
Description
Adds the live endpoint glow and keeps the streaming state semantic.
Prop
series
Type
ChartSeries[]
Default
—
Requirement
required
Description
—
Prop
max
Type
number | undefined
Default
—
Requirement
optional
Description
—
Prop
xDomain
Type
ChartNumericDomain | ChartTimeDomain | undefined
Default
—
Requirement
optional
Description
—
Prop
xScale
Type
"linear" | "log" | undefined
Default
—
Requirement
optional
Description
—
Prop
yDomain
Type
ChartNumericDomain | undefined
Default
—
Requirement
optional
Description
—
Prop
xAxis
Type
ChartAxisOptions<number | Date> | undefined
Default
—
Requirement
optional
Description
—
Prop
yAxis
Type
ChartAxisOptions<number> | undefined
Default
—
Requirement
optional
Description
—
Prop
showGrid
Type
boolean | undefined
Default
—
Requirement
optional
Description
—
Prop
formatXTick
Type
((value: number | Date, index: number) => string) | undefined
Default
—
Requirement
optional
Description
—
Prop
formatYTick
Type
((value: number, index: number) => string) | undefined
Default
—
Requirement
optional
Description
—
Prop
speed
Type
number | undefined
Default
—
Requirement
optional
Description
Playback-speed multiplier for entrance/ambient motion.
Prop
morphDurationMs
Type
number | undefined
Default
—
Requirement
optional
Description
How long a dataset change tweens, in ms.
Prop
replayToken
Type
string | number | undefined
Default
—
Requirement
optional
Description
Changing this value replays the entrance animation.
Prop
selectionMode
Type
SelectionMode | undefined
Default
—
Requirement
optional
Description
Enables the shared selection child.
Prop
selectedIds
Type
SelectionValue | undefined
Default
—
Requirement
optional
Description
—
Prop
defaultSelectedIds
Type
SelectionValue | undefined
Default
—
Requirement
optional
Description
—
Prop
onSelectedIdsChange
Type
((ids: readonly string[]) => void) | undefined
Default
—
Requirement
optional
Description
—
Prop
brushDomain
Type
ChartXDomain | undefined
Default
—
Requirement
optional
Description
—
Prop
defaultBrushDomain
Type
ChartXDomain | undefined
Default
—
Requirement
optional
Description
—
Prop
onBrushDomainChange
Type
((domain: ChartXDomain) => void) | undefined
Default
—
Requirement
optional
Description
—
Prop
zoomDomain
Type
ChartXDomain | undefined
Default
—
Requirement
optional
Description
—
Prop
defaultZoomDomain
Type
ChartXDomain | undefined
Default
—
Requirement
optional
Description
—
Prop
onZoomDomainChange
Type
((domain: ChartXDomain) => void) | undefined
Default
—
Requirement
optional
Description
—
Prop
zoomOnBrush
Type
boolean | undefined
Default
—
Requirement
optional
Description
Commits a brush as a zoom request.
Prop
formatXValue
Type
((value: number | Date | string, index: number) => string) | undefined
Default
—
Requirement
optional
Description
—
Prop
formatYValue
Type
((value: number, index: number) => string) | undefined
Default
—
Requirement
optional
Description
—
Prop
locale
Type
string | readonly string[] | undefined
Default
—
Requirement
optional
Description
—
Prop
timeZone
Type
string | undefined
Default
—
Requirement
optional
Description
—
Prop
invalidData
Type
LineChartInvalidDataPolicy | undefined
Default
—
Requirement
optional
Description
—
Prop
referenceLines
Type
readonly ReferenceLine[] | undefined
Default
—
Requirement
optional
Description
—
Prop
referenceBands
Type
readonly ReferenceBand[] | undefined
Default
—
Requirement
optional
Description
—
Prop
renderer
Type
import("@grassroot/core").ChartRenderer | undefined
Default
—
Requirement
optional
Description
—
Prop
className
Type
string | undefined
Default
—
Requirement
optional
Description
—
Prop
theme
Type
import("@grassroot/theme").PartialChartTheme | undefined
Default
—
Requirement
optional
Description
—
Prop
animation
Type
import("@grassroot/theme").ChartAnimationInput | undefined
Default
—
Requirement
optional
Description
—
Prop
title
Type
string | undefined
Default
—
Requirement
optional
Description
—
Prop
description
Type
string | undefined
Default
—
Requirement
optional
Description
—
Prop
ariaLabel
Type
string | undefined
Default
—
Requirement
optional
Description
—
Prop
keyboardNavigation
Type
boolean | undefined
Default
—
Requirement
optional
Description
—
Prop
interactive
Type
boolean | undefined
Default
—
Requirement
optional
Description
—
Prop
tooltip
Type
boolean | import("../../types").TooltipConfig<ChartXYDatum> | undefined
Default
—
Requirement
optional
Description
—
Prop
crosshair
Type
boolean | import("../../types").CrosshairConfig | undefined
Default
—
Requirement
optional
Description
—
Prop
legend
Type
boolean | LegendConfig | undefined
Default
—
Requirement
optional
Description
—
Prop
activePoint
Type
ActivePoint<ChartXYDatum> | null | undefined
Default
—
Requirement
optional
Description
—
Prop
defaultActivePoint
Type
ActivePoint<ChartXYDatum> | null | undefined
Default
—
Requirement
optional
Description
—
Prop
onActivePointChange
Type
((point: ActivePoint<ChartXYDatum> | null) => void) | undefined
Default
—
Requirement
optional
Description
—
Prop
hiddenSeries
Type
readonly string[] | undefined
Default
—
Requirement
optional
Description
—
Prop
defaultHiddenSeries
Type
readonly string[] | undefined
Default
—
Requirement
optional
Description
—
Prop
onHiddenSeriesChange
Type
((hidden: readonly string[]) => void) | undefined
Default
—
Requirement
optional
Description
—

Events

EventPayload
onSelectedIdsChange((ids: readonly string[]) => void) | undefined
onBrushDomainChange((domain: ChartXDomain) => void) | undefined
onZoomDomainChange((domain: ChartXDomain) => void) | undefined
onActivePointChange((point: ActivePoint<ChartXYDatum> | null) => void) | undefined
onHiddenSeriesChange((hidden: readonly string[]) => void) | undefined

Content regions

  • children
  • dataSummary

Native attributes

Standard DOM and ARIA attributes not listed above spread onto the root element.

Import

import { ref } from "vue";
import { t6LineChartFixture } from "@grassroot/demo-fixtures";
import { LineChart } from "@grassroot/charts-vue";
import type { CurveKind } from "@grassroot/charts-vue";
import type { ChartXDomain } from "@grassroot/ui-machines/chart-shell";

Props

Prop
Type
Default
Requirement
series
readonly ChartSeries[]
—
required
max
number | undefined
—
optional
xDomain
ChartNumericDomain | ChartTimeDomain | undefined
—
optional
xScale
"linear" | "log" | undefined
—
optional
yDomain
ChartNumericDomain | undefined
—
optional
xAxis
ChartAxisOptions<number | Date> | undefined
—
optional
yAxis
ChartAxisOptions<number> | undefined
—
optional
showGrid
boolean | undefined
false
optional
curve
CurveKind | undefined
—
optional
live
boolean | undefined
false
optional
formatXTick
((value: number | Date, index: number) => string) | undefined
—
optional
formatYTick
((value: number, index: number) => string) | undefined
—
optional
formatXValue
((value: number | Date | string, index: number) => string) | undefined
—
optional
formatYValue
((value: number, index: number) => string) | undefined
—
optional
Prop
series
Type
readonly ChartSeries[]
Default
—
Requirement
required
Prop
max
Type
number | undefined
Default
—
Requirement
optional
Prop
xDomain
Type
ChartNumericDomain | ChartTimeDomain | undefined
Default
—
Requirement
optional
Prop
xScale
Type
"linear" | "log" | undefined
Default
—
Requirement
optional
Prop
yDomain
Type
ChartNumericDomain | undefined
Default
—
Requirement
optional
Prop
xAxis
Type
ChartAxisOptions<number | Date> | undefined
Default
—
Requirement
optional
Prop
yAxis
Type
ChartAxisOptions<number> | undefined
Default
—
Requirement
optional
Prop
showGrid
Type
boolean | undefined
Default
false
Requirement
optional
Prop
curve
Type
CurveKind | undefined
Default
—
Requirement
optional
Prop
live
Type
boolean | undefined
Default
false
Requirement
optional
Prop
formatXTick
Type
((value: number | Date, index: number) => string) | undefined
Default
—
Requirement
optional
Prop
formatYTick
Type
((value: number, index: number) => string) | undefined
Default
—
Requirement
optional
Prop
formatXValue
Type
((value: number | Date | string, index: number) => string) | undefined
Default
—
Requirement
optional
Prop
formatYValue
Type
((value: number, index: number) => string) | undefined
Default
—
Requirement
optional
Prop
locale
Type
string | readonly string[] | undefined
Default
—
Requirement
optional
Prop
timeZone
Type
string | undefined
Default
—
Requirement
optional
Prop
invalidData
Type
LineChartInvalidDataPolicy | undefined
Default
—
Requirement
optional
Prop
referenceLines
Type
readonly ReferenceLine[] | undefined
Default
—
Requirement
optional
Prop
referenceBands
Type
readonly ReferenceBand[] | undefined
Default
—
Requirement
optional
Prop
renderer
Type
ChartRenderer | undefined
Default
—
Requirement
optional
Prop
ariaLabel
Type
string | undefined
Default
—
Requirement
optional
Prop
className
Type
string | undefined
Default
—
Requirement
optional
Prop
title
Type
string | undefined
Default
—
Requirement
optional
Prop
description
Type
string | undefined
Default
—
Requirement
optional
Prop
theme
Type
PartialChartTheme | undefined
Default
—
Requirement
optional
Prop
animation
Type
ChartAnimationInput | undefined
Default
—
Requirement
optional
Prop
interactive
Type
boolean | undefined
Default
true
Requirement
optional
Prop
crosshair
Type
boolean | CrosshairBehaviorConfig | undefined
Default
true
Requirement
optional
Prop
keyboardNavigation
Type
boolean | undefined
Default
true
Requirement
optional
Prop
tooltip
Type
boolean | TooltipBehaviorConfig | undefined
Default
true
Requirement
optional
Prop
legend
Type
boolean | LegendConfig | undefined
Default
false
Requirement
optional
Prop
hiddenSeries
Type
readonly string[] | undefined
Default
—
Requirement
optional
Prop
defaultHiddenSeries
Type
readonly string[] | undefined
Default
() => []
Requirement
optional
Prop
activePoint
Type
ActivePoint<ChartXYDatum> | null | undefined
Default
—
Requirement
optional
Prop
defaultActivePoint
Type
ActivePoint<ChartXYDatum> | null | undefined
Default
null
Requirement
optional
Prop
selectionMode
Type
SelectionMode | undefined
Default
"none"
Requirement
optional
Prop
selectedIds
Type
readonly string[] | undefined
Default
—
Requirement
optional
Prop
defaultSelectedIds
Type
readonly string[] | undefined
Default
—
Requirement
optional
Prop
brushDomain
Type
ChartXDomain | undefined
Default
—
Requirement
optional
Prop
defaultBrushDomain
Type
ChartXDomain | undefined
Default
—
Requirement
optional
Prop
zoomDomain
Type
ChartXDomain | undefined
Default
—
Requirement
optional
Prop
defaultZoomDomain
Type
ChartXDomain | undefined
Default
—
Requirement
optional
Prop
zoomOnBrush
Type
boolean | undefined
Default
false
Requirement
optional
Prop
speed
Type
number | undefined
Default
—
Requirement
optional
Prop
morphDurationMs
Type
number | undefined
Default
—
Requirement
optional
Prop
replayToken
Type
string | number | undefined
Default
—
Requirement
optional

Events

EventPayload
activePointChange[point: ActivePoint<ChartXYDatum> | null]
hiddenSeriesChange[ids: readonly string[]]
selectedIdsChange[ids: readonly string[]]
brushDomainChange[domain: ChartXDomain]
zoomDomainChange[domain: ChartXDomain]

Content regions

  • dataSummary
  • default

Import

import { ChangeDetectionStrategy, Component, signal } from "@angular/core";
import { t6LineChartFixture } from "@grassroot/demo-fixtures";
import { GrassrootLineChart } from "@grassroot/charts-angular";
import type { CurveKind } from "@grassroot/charts-angular";

Props

Prop
Type
Default
Requirement
renderer
ChartRenderer
—
optional
gpuBackend
ChartGpuBackend
—
optional
rendererStrategy
Partial<ChartRendererStrategy>
—
optional
renderPlanMode
"svg" | "host"
"host"
optional
ariaLabel
string
—
optional
title
string
—
optional
description
string
—
optional
theme
PartialChartTheme
—
optional
animation
ChartAnimationInput
—
optional
interactive
boolean
true
optional
keyboardNavigation
boolean
true
optional
tooltip
boolean | TooltipBehaviorConfig
true
optional
legend
boolean | LegendConfig
—
optional
hiddenSeries
readonly string[]
—
optional
Prop
renderer
Type
ChartRenderer
Default
—
Requirement
optional
Prop
gpuBackend
Type
ChartGpuBackend
Default
—
Requirement
optional
Prop
rendererStrategy
Type
Partial<ChartRendererStrategy>
Default
—
Requirement
optional
Prop
renderPlanMode
Type
"svg" | "host"
Default
"host"
Requirement
optional
Prop
ariaLabel
Type
string
Default
—
Requirement
optional
Prop
title
Type
string
Default
—
Requirement
optional
Prop
description
Type
string
Default
—
Requirement
optional
Prop
theme
Type
PartialChartTheme
Default
—
Requirement
optional
Prop
animation
Type
ChartAnimationInput
Default
—
Requirement
optional
Prop
interactive
Type
boolean
Default
true
Requirement
optional
Prop
keyboardNavigation
Type
boolean
Default
true
Requirement
optional
Prop
tooltip
Type
boolean | TooltipBehaviorConfig
Default
true
Requirement
optional
Prop
legend
Type
boolean | LegendConfig
Default
—
Requirement
optional
Prop
hiddenSeries
Type
readonly string[]
Default
—
Requirement
optional
Prop
defaultHiddenSeries
Type
readonly string[]
Default
[]
Requirement
optional
Prop
activeDatum
Type
string | null
Default
—
Requirement
optional
Prop
defaultActiveDatum
Type
string | null
Default
null
Requirement
optional
Prop
speed
Type
number
Default
—
Requirement
optional
Prop
morphDurationMs
Type
number
Default
—
Requirement
optional
Prop
replayToken
Type
string | number
Default
—
Requirement
optional
Prop
series
Type
readonly ChartSeries[]
Default
—
Requirement
required
Prop
max
Type
number
Default
—
Requirement
optional
Prop
xDomain
Type
LineChartOptions["xDomain"]
Default
—
Requirement
optional
Prop
xScale
Type
LineChartOptions["xScale"]
Default
—
Requirement
optional
Prop
yDomain
Type
LineChartOptions["yDomain"]
Default
—
Requirement
optional
Prop
xAxis
Type
LineChartOptions["xAxis"]
Default
—
Requirement
optional
Prop
yAxis
Type
LineChartOptions["yAxis"]
Default
—
Requirement
optional
Prop
showGrid
Type
boolean
Default
false
Requirement
optional
Prop
curve
Type
CurveKind | undefined
Default
undefined
Requirement
optional
Prop
live
Type
boolean
Default
false
Requirement
optional
Prop
formatXTick
Type
LineChartOptions["formatXTick"]
Default
—
Requirement
optional
Prop
formatYTick
Type
LineChartOptions["formatYTick"]
Default
—
Requirement
optional
Prop
formatXValue
Type
LineChartOptions["formatXValue"]
Default
—
Requirement
optional
Prop
formatYValue
Type
LineChartOptions["formatYValue"]
Default
—
Requirement
optional
Prop
locale
Type
LineChartOptions["locale"]
Default
—
Requirement
optional
Prop
timeZone
Type
LineChartOptions["timeZone"]
Default
—
Requirement
optional
Prop
invalidData
Type
LineChartOptions["invalidData"]
Default
—
Requirement
optional
Prop
referenceLines
Type
readonly ReferenceLine[]
Default
—
Requirement
optional
Prop
referenceBands
Type
readonly ReferenceBand[]
Default
—
Requirement
optional
Prop
selectionMode
Type
SelectionMode
Default
"none"
Requirement
optional
Prop
selectedIds
Type
SelectionValue
Default
—
Requirement
optional
Prop
defaultSelectedIds
Type
SelectionValue
Default
—
Requirement
optional
Prop
onSelectedIdsChange
Type
(ids: SelectionValue) => void
Default
—
Requirement
optional
Prop
brushDomain
Type
ChartXDomain
Default
—
Requirement
optional
Prop
defaultBrushDomain
Type
ChartXDomain
Default
—
Requirement
optional
Prop
onBrushDomainChange
Type
(domain: ChartXDomain) => void
Default
—
Requirement
optional
Prop
zoomDomain
Type
ChartXDomain
Default
—
Requirement
optional
Prop
defaultZoomDomain
Type
ChartXDomain
Default
null
Requirement
optional
Prop
onZoomDomainChange
Type
(domain: ChartXDomain) => void
Default
—
Requirement
optional
Prop
zoomOnBrush
Type
boolean
Default
false
Requirement
optional
Prop
className
Type
string
Default
—
Requirement
optional
Prop
crosshair
Type
boolean | CrosshairBehaviorConfig
Default
true
Requirement
optional
Prop
activePoint
Type
ActivePoint<ChartXYDatum> | null
Default
—
Requirement
optional
Prop
defaultActivePoint
Type
ActivePoint<ChartXYDatum> | null
Default
null
Requirement
optional

Events

EventPayload
activeDatumChangestring | null
hiddenSeriesChangereadonly string[]
selectedIdsChangereadonly string[]
brushDomainChangeChartXDomain
zoomDomainChangeChartXDomain
activePointChangeActivePoint<ChartXYDatum> | null

Content regions

  • dataSummary
  • default

Import

import { t6LineChartFixture } from "@grassroot/demo-fixtures";
import { LineChart } from "@grassroot/charts-svelte";
import type { CurveKind } from "@grassroot/charts-svelte";

Props

Prop
Type
Default
Requirement
series
readonly ChartSeries[]
—
required
max
number
—
optional
xDomain
LineChartOptions["xDomain"]
—
optional
xScale
LineChartOptions["xScale"]
—
optional
yDomain
LineChartOptions["yDomain"]
—
optional
xAxis
LineChartOptions["xAxis"]
—
optional
yAxis
LineChartOptions["yAxis"]
—
optional
showGrid
boolean
false
optional
curve
CurveKind
—
optional
live
boolean
false
optional
formatXTick
LineChartOptions["formatXTick"]
—
optional
formatYTick
LineChartOptions["formatYTick"]
—
optional
formatXValue
LineChartOptions["formatXValue"]
—
optional
formatYValue
LineChartOptions["formatYValue"]
—
optional
Prop
series
Type
readonly ChartSeries[]
Default
—
Requirement
required
Prop
max
Type
number
Default
—
Requirement
optional
Prop
xDomain
Type
LineChartOptions["xDomain"]
Default
—
Requirement
optional
Prop
xScale
Type
LineChartOptions["xScale"]
Default
—
Requirement
optional
Prop
yDomain
Type
LineChartOptions["yDomain"]
Default
—
Requirement
optional
Prop
xAxis
Type
LineChartOptions["xAxis"]
Default
—
Requirement
optional
Prop
yAxis
Type
LineChartOptions["yAxis"]
Default
—
Requirement
optional
Prop
showGrid
Type
boolean
Default
false
Requirement
optional
Prop
curve
Type
CurveKind
Default
—
Requirement
optional
Prop
live
Type
boolean
Default
false
Requirement
optional
Prop
formatXTick
Type
LineChartOptions["formatXTick"]
Default
—
Requirement
optional
Prop
formatYTick
Type
LineChartOptions["formatYTick"]
Default
—
Requirement
optional
Prop
formatXValue
Type
LineChartOptions["formatXValue"]
Default
—
Requirement
optional
Prop
formatYValue
Type
LineChartOptions["formatYValue"]
Default
—
Requirement
optional
Prop
locale
Type
LineChartOptions["locale"]
Default
—
Requirement
optional
Prop
timeZone
Type
LineChartOptions["timeZone"]
Default
—
Requirement
optional
Prop
invalidData
Type
LineChartOptions["invalidData"]
Default
—
Requirement
optional
Prop
referenceLines
Type
readonly ReferenceLine[]
Default
—
Requirement
optional
Prop
referenceBands
Type
readonly ReferenceBand[]
Default
—
Requirement
optional
Prop
selectionMode
Type
SelectionMode
Default
"none"
Requirement
optional
Prop
selectedIds
Type
SelectionValue
Default
—
Requirement
optional
Prop
defaultSelectedIds
Type
SelectionValue
Default
—
Requirement
optional
Prop
onSelectedIdsChange
Type
(ids: SelectionValue) => void
Default
—
Requirement
optional
Prop
brushDomain
Type
ChartXDomain
Default
—
Requirement
optional
Prop
defaultBrushDomain
Type
ChartXDomain
Default
—
Requirement
optional
Prop
onBrushDomainChange
Type
(domain: ChartXDomain) => void
Default
—
Requirement
optional
Prop
zoomDomain
Type
ChartXDomain
Default
—
Requirement
optional
Prop
defaultZoomDomain
Type
ChartXDomain
Default
null
Requirement
optional
Prop
onZoomDomainChange
Type
(domain: ChartXDomain) => void
Default
—
Requirement
optional
Prop
zoomOnBrush
Type
boolean
Default
false
Requirement
optional
Prop
renderer
Type
ChartRenderer
Default
—
Requirement
optional
Prop
ariaLabel
Type
string
Default
—
Requirement
optional
Prop
title
Type
string
Default
—
Requirement
optional
Prop
description
Type
string
Default
—
Requirement
optional
Prop
keyboardNavigation
Type
boolean
Default
true
Requirement
optional
Prop
interactive
Type
boolean
Default
true
Requirement
optional
Prop
crosshair
Type
boolean | CrosshairBehaviorConfig
Default
true
Requirement
optional
Prop
tooltip
Type
boolean | TooltipBehaviorConfig
Default
true
Requirement
optional
Prop
legend
Type
boolean | LegendConfig
Default
false
Requirement
optional
Prop
activePoint
Type
ActivePoint<ChartXYDatum> | null
Default
—
Requirement
optional
Prop
defaultActivePoint
Type
ActivePoint<ChartXYDatum> | null
Default
null
Requirement
optional
Prop
onActivePointChange
Type
(point: ActivePoint<ChartXYDatum> | null) => void
Default
—
Requirement
optional
Prop
hiddenSeries
Type
readonly string[]
Default
—
Requirement
optional
Prop
defaultHiddenSeries
Type
readonly string[]
Default
—
Requirement
optional
Prop
onHiddenSeriesChange
Type
(ids: readonly string[]) => void
Default
—
Requirement
optional
Prop
theme
Type
PartialChartTheme
Default
—
Requirement
optional
Prop
animation
Type
ChartAnimationInput
Default
—
Requirement
optional
Prop
class
Type
string
Default
—
Requirement
optional
Prop
style
Type
string
Default
—
Requirement
optional
Prop
speed
Type
number
Default
—
Requirement
optional
Prop
morphDurationMs
Type
number
Default
—
Requirement
optional
Prop
replayToken
Type
string | number
Default
—
Requirement
optional

Events

EventPayload
onSelectedIdsChange(ids: SelectionValue) => void
onBrushDomainChange(domain: ChartXDomain) => void
onZoomDomainChange(domain: ChartXDomain) => void
onActivePointChange(point: ActivePoint<ChartXYDatum> | null) => void
onHiddenSeriesChange(ids: readonly string[]) => void

Content regions

  • children
  • dataSummary

Import

import { For, createSignal, type ComponentProps } from "solid-js";
import { t6LineChartFixture } from "@grassroot/demo-fixtures";
import { LineChart } from "@grassroot/charts-solid";
import type { CurveKind } from "@grassroot/charts-solid";

Props

Prop
Type
Default
Requirement
series
readonly ChartSeries[]
—
required
max
number
—
optional
xDomain
LineChartOptions["xDomain"]
—
optional
xScale
LineChartOptions["xScale"]
—
optional
yDomain
LineChartOptions["yDomain"]
—
optional
xAxis
LineChartOptions["xAxis"]
—
optional
yAxis
LineChartOptions["yAxis"]
—
optional
showGrid
boolean
false
optional
curve
CurveKind
—
optional
live
boolean
—
optional
formatXTick
LineChartOptions["formatXTick"]
—
optional
formatYTick
LineChartOptions["formatYTick"]
—
optional
formatXValue
LineChartOptions["formatXValue"]
—
optional
formatYValue
LineChartOptions["formatYValue"]
—
optional
Prop
series
Type
readonly ChartSeries[]
Default
—
Requirement
required
Prop
max
Type
number
Default
—
Requirement
optional
Prop
xDomain
Type
LineChartOptions["xDomain"]
Default
—
Requirement
optional
Prop
xScale
Type
LineChartOptions["xScale"]
Default
—
Requirement
optional
Prop
yDomain
Type
LineChartOptions["yDomain"]
Default
—
Requirement
optional
Prop
xAxis
Type
LineChartOptions["xAxis"]
Default
—
Requirement
optional
Prop
yAxis
Type
LineChartOptions["yAxis"]
Default
—
Requirement
optional
Prop
showGrid
Type
boolean
Default
false
Requirement
optional
Prop
curve
Type
CurveKind
Default
—
Requirement
optional
Prop
live
Type
boolean
Default
—
Requirement
optional
Prop
formatXTick
Type
LineChartOptions["formatXTick"]
Default
—
Requirement
optional
Prop
formatYTick
Type
LineChartOptions["formatYTick"]
Default
—
Requirement
optional
Prop
formatXValue
Type
LineChartOptions["formatXValue"]
Default
—
Requirement
optional
Prop
formatYValue
Type
LineChartOptions["formatYValue"]
Default
—
Requirement
optional
Prop
locale
Type
LineChartOptions["locale"]
Default
—
Requirement
optional
Prop
timeZone
Type
LineChartOptions["timeZone"]
Default
—
Requirement
optional
Prop
invalidData
Type
LineChartOptions["invalidData"]
Default
—
Requirement
optional
Prop
referenceLines
Type
LineChartOptions["referenceLines"]
Default
—
Requirement
optional
Prop
referenceBands
Type
LineChartOptions["referenceBands"]
Default
—
Requirement
optional
Prop
renderer
Type
ChartRenderer
Default
—
Requirement
optional
Prop
ariaLabel
Type
string
Default
—
Requirement
optional
Prop
interactive
Type
boolean
Default
—
Requirement
optional
Prop
crosshair
Type
boolean | CrosshairBehaviorConfig
Default
true
Requirement
optional
Prop
tooltip
Type
boolean | TooltipBehaviorConfig
Default
—
Requirement
optional
Prop
legend
Type
boolean | LegendConfig
Default
—
Requirement
optional
Prop
activePoint
Type
ActivePoint<ChartXYDatum> | null
Default
—
Requirement
optional
Prop
defaultActivePoint
Type
ActivePoint<ChartXYDatum> | null
Default
null
Requirement
optional
Prop
onActivePointChange
Type
(point: ActivePoint<ChartXYDatum> | null) => void
Default
—
Requirement
optional
Prop
hiddenSeries
Type
readonly string[]
Default
—
Requirement
optional
Prop
defaultHiddenSeries
Type
readonly string[]
Default
—
Requirement
optional
Prop
onHiddenSeriesChange
Type
(ids: readonly string[]) => void
Default
—
Requirement
optional
Prop
selectionMode
Type
SelectionMode
Default
—
Requirement
optional
Prop
selectedIds
Type
readonly string[]
Default
—
Requirement
optional
Prop
defaultSelectedIds
Type
readonly string[]
Default
—
Requirement
optional
Prop
onSelectedIdsChange
Type
(ids: readonly string[]) => void
Default
—
Requirement
optional
Prop
brushDomain
Type
ChartXDomain
Default
—
Requirement
optional
Prop
defaultBrushDomain
Type
ChartXDomain
Default
—
Requirement
optional
Prop
onBrushDomainChange
Type
(domain: ChartXDomain) => void
Default
—
Requirement
optional
Prop
zoomDomain
Type
ChartXDomain
Default
—
Requirement
optional
Prop
defaultZoomDomain
Type
ChartXDomain
Default
null
Requirement
optional
Prop
onZoomDomainChange
Type
(domain: ChartXDomain) => void
Default
—
Requirement
optional
Prop
zoomOnBrush
Type
boolean
Default
—
Requirement
optional
Prop
title
Type
string
Default
—
Requirement
optional
Prop
description
Type
string
Default
—
Requirement
optional
Prop
keyboardNavigation
Type
boolean
Default
—
Requirement
optional
Prop
theme
Type
PartialChartTheme
Default
—
Requirement
optional
Prop
animation
Type
ChartAnimationInput
Default
—
Requirement
optional
Prop
speed
Type
number
Default
—
Requirement
optional
Prop
morphDurationMs
Type
number
Default
—
Requirement
optional
Prop
replayToken
Type
string | number
Default
—
Requirement
optional
Prop
class
Type
string
Default
—
Requirement
optional
Prop
style
Type
JSX.CSSProperties
Default
—
Requirement
optional

Events

EventPayload
onActivePointChange(point: ActivePoint<ChartXYDatum> | null) => void
onHiddenSeriesChange(ids: readonly string[]) => void
onSelectedIdsChange(ids: readonly string[]) => void
onBrushDomainChange(domain: ChartXDomain) => void
onZoomDomainChange(domain: ChartXDomain) => void

Content regions

  • children
  • dataSummary