Expose consistent `data` prop
In 2.0.0, we've started to add data directly to hierarchy and graph layout components instead of using <Chart {data}>. This simplifies the typing of <Chart {data}> and removes unnecessary indirection.
- Graph
- [x]
<ForceSimulation {data}> - [x]
<Dagre {data}> - [ ]
<Sankey>- needsdatapassed directly
- [x]
- Hierarchy
- [ ]
<Pack {hierarchy}>- needs renamed todata - [ ]
<Partition {hierarchy}>- needs renamed todata - [ ]
<Tree {hierarchy}>- needs renamed todata - [ ]
<Treemap {hierarchy}>- needs renamed todata
- [ ]
It would also be useful to add data to many other marks such as Axis. Some components already support this, such as
-
Bars -
Hull -
Labels -
Link -
Pie -
Points -
Spline
This is currently leveraged for series support in simplified charts like BarChart and LineChart, but would be useful is most all marks.
Lastly, adding data via marks would then be useful to register it with the chart context to be used to determine overall scale domains (similar to Observable Plot, SveltePlot, visx XYChart, data-ui, and others)
d3-hierarchy's stratify converts a flat array to a hierarchy and not just pure nested structure like hierarchy(data, children) which might complicate taking in <Treemap {daa}> instead of <Treemap {hierarchy}> although we might consider applying stratify internally as well if an Array vs object/tree is passed 🤔.