Esc
Documentation
On this page

Props

PropTypeDefaultDescription
sourceDataSourceNoneResource binding that supplies the series. Use either source or points.
pointsreadonly ChartPoint[]NonePoints the page already holds, as { time, value } with time in milliseconds since the epoch
windowsreadonly ChartWindow[]NoneTime windows the viewer can choose. The first is selected.
kindChartKind"line"Line or filled area
exaggeratebooleanfalseTighten the value axis so small movements fill the height
lineWidthnumber2Stroke width of the plotted line
showValuebooleanNonePrint the latest value over the chart
labelstringNoneAccessible description of what is plotted
scaleChartScale"higher-is-worse"Which end of the value axis is bad
referenceLine{ value: number; label?: string }NoneOne fixed value to mark, such as a threshold
referenceLinesreadonly { value: number; label?: string }[]NoneSeveral fixed values to mark
yRange{ min: number; max: number; unit?: string }NoneFixed value axis range. Samples outside the range are clipped.

Example

ts
Chart({
  source: loadAverage(),
  windows: [
    { label: "1 hour", secs: 3600 },
    { label: "24 hours", secs: 86400 },
  ],
  scale: "higher-is-worse",
  referenceLine: { value: 4, label: "CPU count" },
  label: "Load average",
})

Supporting types

ChartPoint
export interface ChartPoint {
  readonly time: number;
  readonly value: number;
}
ChartWindow
export interface ChartWindow {
  readonly label: string;
  readonly secs: number;
}
ChartScale
export type ChartScale = "higher-is-better" | "higher-is-worse";
ChartKind
export type ChartKind = "line" | "area";

View the source on GitHub