Skip to content

feat: support Recharts (React) charting library #542

@jooyoungseo

Description

@jooyoungseo

Summary

Add support for Recharts as a third-party charting library that maidr can work with.

Background

Recharts is one of the most popular React-based charting libraries, built on D3 and rendering SVG. It is widely used in React applications and dashboards. chart2music provides a Recharts integration example. chart2music's React documentation notes that many React charting libraries handle tooltip interactions internally, which can limit visual syncing.

What This Involves

  • Binder/Adapter: Create a React-compatible adapter (hook or wrapper component) that extracts data from Recharts components and generates the MAIDR JSON schema.
  • SVG Highlighting: Recharts renders standard SVG elements, which can be targeted with CSS selectors for highlighting.
  • React Integration: Since maidr already has a React component entry point (react-entry.ts), the Recharts adapter should integrate naturally with React's component lifecycle.
  • Chart Types: Recharts supports line, bar, area, scatter, pie, radar, treemap, funnel, and composed charts.

Considerations

  • Recharts manages its own internal state for tooltips and hover interactions, which may complicate visual synchronization.
  • The adapter could work as a wrapper component or a custom hook that sits alongside the Recharts chart.
  • Recharts' declarative component API (e.g., <BarChart>, <LineChart>) makes it relatively easy to intercept data props.

Reference

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions