Skip to content

Commit

Permalink
feat(stack): make line areas stack in front of each other visibly #152
Browse files Browse the repository at this point in the history
  • Loading branch information
niharikasingh authored and Raphaël Benitte committed Apr 5, 2018
1 parent 50d6fd5 commit 8ec91a6
Showing 1 changed file with 34 additions and 28 deletions.
62 changes: 34 additions & 28 deletions packages/nivo-line/src/LineAreas.js
Expand Up @@ -25,15 +25,18 @@ const LineAreas = ({
if (animate !== true) {
return (
<g>
{lines.map(({ id, color: areaColor, points }) => (
<path
key={id}
d={areaGenerator(points)}
fill={areaColor}
fillOpacity={areaOpacity}
strokeWidth={0}
/>
))}
{lines
.slice(0)
.reverse()
.map(({ id, color: areaColor, points }) => (
<path
key={id}
d={areaGenerator(points)}
fill={areaColor}
fillOpacity={areaOpacity}
strokeWidth={0}
/>
))}
</g>
)
}
Expand All @@ -45,25 +48,28 @@ const LineAreas = ({

return (
<g>
{lines.map(({ id, color: areaColor, points }) => (
<SmartMotion
key={id}
style={spring => ({
d: spring(areaGenerator(points), springConfig),
fill: spring(areaColor, springConfig),
})}
>
{style => (
<path
key={id}
d={style.d}
fill={areaColor}
fillOpacity={areaOpacity}
strokeWidth={0}
/>
)}
</SmartMotion>
))}
{lines
.slice(0)
.reverse()
.map(({ id, color: areaColor, points }) => (
<SmartMotion
key={id}
style={spring => ({
d: spring(areaGenerator(points), springConfig),
fill: spring(areaColor, springConfig),
})}
>
{style => (
<path
key={id}
d={style.d}
fill={areaColor}
fillOpacity={areaOpacity}
strokeWidth={0}
/>
)}
</SmartMotion>
))}
</g>
)
}
Expand Down

0 comments on commit 8ec91a6

Please sign in to comment.