Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[shape][demo] add <Stack />, add /streamgraph #153

Merged
merged 2 commits into from
Sep 20, 2017
Merged

[shape][demo] add <Stack />, add /streamgraph #153

merged 2 commits into from
Sep 20, 2017

Conversation

hshoff
Copy link
Member

@hshoff hshoff commented Sep 20, 2017

screen shot 2017-09-19 at 5 37 02 pm

There are two ways of handling the stack series data + path

<Stack
  data={cityTemperature}
  keys={keys}
  offset="wiggle"
  curve={curveBasis}
  x={d => xScale(x(d.data))}
  y0={d => yScale(d[0])}
  y1={d => yScale(d[1])}
  fill={d => zScale(d.series.key)}
/>

or you can use a render prop for total control of what gets rendered

<Stack
  data={layers}
  keys={keys}
  offset="wiggle"
  x={(d, i) => xScale(i)}
  y0={d => yScale(d[0])}
  y1={d => yScale(d[1])}
  render={({ seriesData, path }) => {
    return seriesData.map((series, i) => {
      return (
        <g key={`series-${series.key}`}>
          <path
            d={path(series)}
            fill={zScale(series.key)}
          />
          <path
            d={path(series)}
            fill={`url(#${patternScale(series.key)})`}
          />
        </g>
      );
    });
  }}
/>

@hshoff hshoff added this to the v0.0.139 milestone Sep 20, 2017
@hshoff hshoff merged commit 2db02f4 into master Sep 20, 2017
@hshoff hshoff deleted the harry-stack branch September 20, 2017 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant