API reference
Charts
The pure side of the chart components: ECharts options, presets, colours and sparkline geometry.
Everything in utils/ is a pure function: it takes data and returns data, with no Vue and no global state. Pass the current date as now so results are deterministic. Each file has its unit tests in tests/unit/.
buildChartOption()
Turns the props of BaseChart into an ECharts option.
buildChartOption(input: ChartBuildInput): ChartOptions
buildSparklineOption()
Turns the props of BaseSparkline into an ECharts option: the line bleeds to both edges of the card, the highlighted point gets the end marker and an active point adds the hover guide.
buildSparklineOption(input: SparklineBuildInput): ChartOptions
...basegridxAxisyAxisseriesbuildMiniBarsOption()
Turns the bars of BaseMiniBars into an ECharts option: values on a 0–100 scale, 4px gaps and every bar dimmed except the highlighted one.
buildMiniBarsOption(input: MiniBarsBuildInput): ChartOptions
animationanimationDurationariagridxAxisyAxisseriesnormalizeSeries()
Wraps a plain array as a single series.
normalizeSeries(series: ChartSeriesInput): ChartSeries[]
isCircularChart()
Whether a type is donut, pie or radial.
isCircularChart(type: ChartType): boolean
chartPreset()
Maps a BaseChartCard preset to a chart type and stacking.
chartPreset(preset: ChartPreset): ChartPresetConfig
typestackedtoRgba()
Adds transparency to a hex colour.
toRgba(color: string, alpha: number): string
sparklinePoints()
Projects values to SVG points (used by the chart skeleton wave).
sparklinePoints(values: number[], domain: SparklineDomain): SparklinePoint[]
monotonePath()
A smooth path that never overshoots the data.
monotonePath(points: SparklinePoint[], scaleX = 1, scaleY = 1): string
straightPath()
A straight-segment path.
straightPath(points: SparklinePoint[], scaleX = 1, scaleY = 1): string
edgeToEdgePath()
A path that bleeds to both edges of the card.
edgeToEdgePath(points: SparklinePoint[], scaleX: number, scaleY: number, bleed: number, curve: SparklineCurve = 'smooth'): string
sparklineDomain()
The min and max of the values for a sparkline type.
sparklineDomain(values: number[], type: SparklineType): SparklineDomain
minmaxfirstSeries()
The values of the first series.
firstSeries(series: ChartSeriesInput = []): { name: string | undefined; data: number[]; }namedataskeletonWaveMaskStyle()
The mask style of the chart skeleton wave.
skeletonWaveMaskStyle(): { maskImage: string; maskSize: string; maskRepeat: string; }maskImagemaskSizemaskRepeat