Skip to content

v2: per-series scales and axis configuration (SeriesConfig.scale) #30

Description

@cinderblock

2.0.0-alpha.1 hardcodes a single y scale in StreamChartController.build() (src/StreamChartController.ts:336-342), SeriesConfig (:9-24) has no scale field, and axes is never configured — the only occurrence in src/ is a doc comment on StreamChart.tsx:113.

That means series with different units cannot share a chart. Concretely: plotting motor phase current (~2 A) alongside DC bus voltage (~24 V) on one autoscaled y flattens the current into the baseline. The workaround is a second chart, which then needs the two to stay aligned in time — see the geometry-alignment issue.

The uplot escape hatch doesn't quite get there: scales and axes merge/replace fine, but attaching series to custom scales means supplying the whole series array, and deepMerge treats arrays as scalars (isPlainObject is false for arrays, :477-487), so that replaces the generated stroke/width/paths/spanGaps mapping wholesale.

Related, and worth fixing regardless: structuralSignature JSON-stringifies config.uplot, so function-valued options (a custom range, tick formatters) drop out of the signature and changing them doesn't trigger a rebuild.

Suggested shape: scale?: string on SeriesConfig, passed through in build(), with uplot.scales / uplot.axes supplying the rest.

This was the primary blocker for a real streaming-scope consumer, which hand-rolled on raw uPlot instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions