Skip to content

Stage 4: React, DX & Ecosystem

Target versions: v2.2.0 → v2.9.0
Prerequisite: Stages 2 and 3 substantially complete
Next stage: 05-v3-stable-platform.md


Goal

Make velo-plot as pleasant to integrate as any modern chart library. First-class React components, reactive hooks, accessibility, polished touch UX, and developer tooling that reduces boilerplate by 50%+.


Current state

React integration (src/react/)

ExportFileStatus
VeloPlotVeloPlot.tsx✅ Declarative single chart
useVeloPlotuseVeloPlot.ts✅ Lifecycle hook
useStackedPlotuseStackedPlot.ts⚠️ Mount-only — does not react to prop changes

Gaps

GapImpact
No StackedPlot componentUsers must wire useStackedPlot manually
Hooks not reactive to options/theme/panesChanging props requires manual destroy/recreate
No useIndicator hookManual calculate + buildIndicatorPane
No useChartGroup hookSync groups only via imperative API
VeloPlotSeries props limitedNo candlestick, indicator, heatmap in declarative props
./react export missing (Stage 0)Broken import path in README
No SSR guidanceCanvas/WebGL assumes browser
Basic touch onlyNo documented pinch-zoom
No accessibilityNo ARIA, keyboard chart navigation, screen reader
No plugin scaffolding CLIPlugins created by copy-paste
No online playgroundDocs have examples but no editable sandbox

Work items

P0 — React components

IDTaskPriorityComplexityDefinition of done
4.1<StackedPlot /> componentP0MediumDeclarative panes, indicators, sync props
4.2Reactive useStackedPlotP0HighChanging panes, theme, sync updates chart without full remount
4.3Reactive useVeloPlotP0HighSame for single chart
4.4useIndicator(chart, 'rsi', options)P0MediumWraps Stage 2 addIndicator()
4.5useChartSync(charts, options)P1MediumHook for non-stacked sync
4.6Extend VeloPlot series typesP1Mediumcandlestick, bar, indicator in props

P0 — Export and types

IDTaskPriorityComplexityDefinition of done
4.7velo-plot/react entry with full typesP0LowBuilds and publishes (Stage 0 prerequisite)
4.8Strict React 18+ typesP1Lowref forwarding on components

P1 — Accessibility

IDTaskPriorityComplexityDefinition of done
4.9ARIA roles on chart containerP1Mediumrole="img", aria-label with data summary
4.10Keyboard navigationP1HighTab focus, arrow pan, +/- zoom, Escape reset
4.11Screen reader data table fallbackP2MediumHidden table with visible range data
4.12High contrast theme presetP1LowWCAG AA contrast ratios
4.13prefers-reduced-motion supportP1LowDisable animations when requested

P1 — Touch and mobile

IDTaskPriorityComplexityDefinition of done
4.14Pinch-to-zoomP1HighTwo-finger pinch on InteractionManager
4.15Double-tap reset zoomP1LowCommon mobile pattern
4.16Touch-optimized hit areasP1LowExtend src/core/responsive/
4.17Mobile trading exampleP2LowResponsive stacked chart demo

P1 — Developer experience

IDTaskPriorityComplexityDefinition of done
4.18velo-plot create-plugin CLIP1MediumScaffolds plugin with tests and docs template
4.19VS Code snippets packageP2Lowchart, series, stacked, indicator snippets
4.20StackBlitz / CodeSandbox templateP1LowOne-click starter linked from docs
4.21TypeDoc or equivalent API docs generationP2MediumComplements VitePress narrative docs
4.22Error messages improvement passP1MediumActionable errors for common mistakes

P2 — Framework expansion

IDTaskPriorityComplexityDefinition of done
4.23Vue composables (useVeloPlot)P2MediumDocs already use Vue in VitePress — dogfood
4.24Svelte actions / storesP3MediumEvaluate community demand
4.25SSR-safe dynamic import patternP2LowDocument typeof window guard pattern

React API sketch (v2.5+)

tsx
import { StackedPlot } from 'velo-plot/react'

<StackedPlot
  theme="midnight"
  sync={{ axis: 'x', syncCursor: true }}
  panes={[
    { id: 'price', type: 'candlestick', data: ohlc },
    { id: 'volume', type: 'bar', data: volume },
  ]}
  indicators={[
    { type: 'rsi', period: 14 },
    { type: 'macd', fast: 12, slow: 26, signal: 9 },
  ]}
  onCrosshairMove={(e) => setPrice(e.price)}
  drawingTools={['trendline', 'horizontal']}
/>

DX metrics (targets for v2.9.0)

MetricCurrent (v1.12)Target (v2.9)
Lines to render price+volume+RSI+MACD~80–120≤30
React prop change → chart updateManual remountAutomatic
Lighthouse a11y score (chart page)Unknown≥85
Time to first chart (new dev)~30 min≤10 min with template

Risks

RiskMitigation
Reactive hooks cause render loopsDeep-compare options; use refs for chart instance
a11y for canvas is inherently limitedData table fallback + keyboard alternatives
Multi-framework support dilutes focusReact first; Vue second; others on demand
CLI maintenance burdenMinimal template; versioned with library

Exit checklist (v2.9.0)

  • [x] <StackedPlot /> shipped with docs and example
  • [x] useStackedPlot and useVeloPlot reactive to prop changes
  • [x] useIndicator hook shipped
  • [x] velo-plot/react export stable
  • [x] Keyboard navigation for pan/zoom/reset
  • [x] Pinch-to-zoom on touch devices
  • [x] High contrast theme
  • [x] Plugin scaffolding CLI
  • [x] Online starter template linked from docs
  • [x] Framework bindings: Vue, Svelte, SolidJS, Angular, Astro
  • [x] Vitest coverage for React/shared bindings tests

Released under the MIT License.