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.

utils/chart/echarts-options.ts
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.

utils/chart/sparkline-options.ts
buildSparklineOption(input: SparklineBuildInput): ChartOptions
Returns...basegridxAxisyAxisseries

buildMiniBarsOption()

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.

utils/chart/mini-bars-options.ts
buildMiniBarsOption(input: MiniBarsBuildInput): ChartOptions
ReturnsanimationanimationDurationariagridxAxisyAxisseries

normalizeSeries()

Wraps a plain array as a single series.

utils/chart/echarts-options.ts
normalizeSeries(series: ChartSeriesInput): ChartSeries[]

isCircularChart()

Whether a type is donut, pie or radial.

utils/chart/echarts-options.ts
isCircularChart(type: ChartType): boolean

chartPreset()

Maps a BaseChartCard preset to a chart type and stacking.

utils/chart/presets.ts
chartPreset(preset: ChartPreset): ChartPresetConfig
Returnstypestacked

toRgba()

Adds transparency to a hex colour.

utils/chart/color.ts
toRgba(color: string, alpha: number): string

sparklinePoints()

Projects values to SVG points (used by the chart skeleton wave).

utils/sparkline.ts
sparklinePoints(values: number[], domain: SparklineDomain): SparklinePoint[]

monotonePath()

A smooth path that never overshoots the data.

utils/sparkline.ts
monotonePath(points: SparklinePoint[], scaleX = 1, scaleY = 1): string

straightPath()

A straight-segment path.

utils/sparkline.ts
straightPath(points: SparklinePoint[], scaleX = 1, scaleY = 1): string

edgeToEdgePath()

A path that bleeds to both edges of the card.

utils/sparkline.ts
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.

utils/sparkline.ts
sparklineDomain(values: number[], type: SparklineType): SparklineDomain
Returnsminmax

firstSeries()

The values of the first series.

utils/sparkline.ts
firstSeries(series: ChartSeriesInput = []): { name: string | undefined; data: number[]; }
Returnsnamedata

skeletonWaveMaskStyle()

The mask style of the chart skeleton wave.

utils/sparkline.ts
skeletonWaveMaskStyle(): { maskImage: string; maskSize: string; maskRepeat: string; }
ReturnsmaskImagemaskSizemaskRepeat
© 2026 melsami UI.
Developer documentation for melsami UI.