cinderblock / cinderblock/react-smoothie

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

Open
#30 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
43
Forks
2
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/StreamChartController.ts:336-342 and inspect SeriesConfig at lines 9-24, then read deepMerge at lines 477-487 and structuralSignature. Implement the suggested per-series scale flow while preserving generated series mappings, and ensure function-valued uplot options can affect rebuilds; verify that custom scales and axes work without requiring a second chart.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.