diff --git a/src/stacked-area-chart.js b/src/stacked-area-chart.js index 0d3839ef..62de378e 100644 --- a/src/stacked-area-chart.js +++ b/src/stacked-area-chart.js @@ -84,7 +84,7 @@ class AreaStack extends PureComponent { .range([ height - bottom, top ]) const x = scale.scaleLinear() - .domain([ 0, keys.length - 1 ]) + .domain([ 0, data.length - 1 ]) .range([ left, width - right ]) const areas = series.map((serie, index) => { @@ -93,7 +93,7 @@ class AreaStack extends PureComponent { .y0(d => y(d[ 0 ])) .y1(d => y(d[ 1 ])) .curve(curve) - (keys.map((_, index) => serie[ index ])) + (data.map((_, index) => serie[ index ])) return { path, @@ -140,7 +140,7 @@ class AreaStack extends PureComponent { ) ) } { series.map((serie) => { - return keys.map((key, index) => { + return data.map((key, index) => { return renderDecorator({ x, y, index, value: serie[ index ][ 1 ] }) }) }) }