jameslaneconkling / yard3

Yet Another React-D3 Integration Library
https://jameslaneconkling.github.io/yard3/
2 stars 3 forks source link

Use react context for yScale/xScale? #21

Closed skeate closed 7 years ago

skeate commented 7 years ago

Seems a little awkward to have to pass that into every child component manually, since probably 99% of the time it's going to be all the same.

skeate commented 7 years ago

goal being something like

<Chart xScale={xScale} yScale={yScale} width="600" height="300">
  <YGrid strokeDasharray={'2, 3'} />
  <XAxis />
  <YAxis />
  <AreaChart
    data={data}
    x0={d => new Date(d.date)}
    y0={d => d.high}
    y1={d => d.low}
    fill="#607D8B"
    stroke={d3.color('#607D8B').darker(1).toString()}
    strokeWidth="0.5"
  />
</Chart>

from the first example in the styleguide