#20

Add curve prop for monotone area/line interpolation

OpenKyleKreuterwants to merge intofrom

What

Adds an opt-in curve prop to <Area> / <Line> so continuous series can be drawn with monotone-cubic interpolation instead of the straight-segment default.

<Area dataKey="visits" curve="monotone" />
<Line dataKey="mobile" curve="monotone" />

The default stays "linear", so existing charts render exactly as before — this is non-breaking.

Why

The value line is resampled to the backing columns with a linear pass (resample in dither-paint.ts), so with few data points the fill and outline show hard kinks at every point. resampleMonotone smooths the line while staying honest: Fritsch–Carlson tangents guarantee monotonicity, so no false peaks or valleys are introduced between data points (unlike Catmull-Rom / natural cubics).

How

  • dither-paint.ts — add resampleMonotone (pure, no new dependency).
  • chart-context.tsx — Curve type + optional curve on SeriesSpec.
  • area.tsx — thread the curve prop through series registration.
  • cartesian-canvas.tsx — pick the resampler per series; top and floor use the same one so the band stays consistent.
  • index.ts — export Curve.

Bars are unaffected (curve is optional and never set for <Bar>).

Tests

tests/dither-paint.test.ts covers node pass-through, sample count, the single-value case, no-overshoot on monotonic input, and endpoint parity with resample. Full suite: 33 passing.

Registry regenerated with npm run build:registry (r/core.json, r/area-chart.json, r/dither-kit.json).

Summary by Comp AI

No blocking issues found.

Written for commit b1d0aea. New commits will trigger a re-review. Generated by Comp AI.

Activity

5
comp-ai-code-review[bot]4mo ago

✅ Comp AI code review complete — no issues found.

Reviewed commit b1d0aea.

Posted by Comp AI Code Reviews.

tripwire-dev[bot]4mo ago

passed — nothing tripped. good to merge.

comp-ai-code-review[bot]reviewed4mo ago
comp-ai-code-review[bot]4mo ago

No blocking issues found across the changed files.

Posted by Comp AI Code Reviews.

KyleKreuter4mo ago