StackedAreaChart doesn't properly render all data points
See original GitHub issueWhat is the problem?
StackedAreaChart doesn’t properly render all the data points. In particular, it only renders the first keys.length
data points.
When does it happen?
The following code should render a StackedAreaChart that looks like the one from the examples, but with one additional data point (making five total).
class StackedAreaExample extends React.PureComponent {
render() {
const data = [
{
month: new Date(2015, 0, 1),
apples: 3840,
bananas: 1920,
cherries: 960,
dates: 400,
},
{
month: new Date(2015, 1, 1),
apples: 1600,
bananas: 1440,
cherries: 960,
dates: 400,
},
{
month: new Date(2015, 2, 1),
apples: 640,
bananas: 960,
cherries: 3640,
dates: 400,
},
{
month: new Date(2015, 3, 1),
apples: 3320,
bananas: 480,
cherries: 640,
dates: 400,
},
{
month: new Date(2015, 4, 1),
apples: 2320,
bananas: 780,
cherries: 440,
dates: 400,
},
]
const colors = [ '#ED5314', '#FFB92A', '#FEEB51', '#9BCA3E' ]
const keys = [ 'apples', 'bananas', 'cherries', 'dates' ]
return (
<StackedAreaChart
style={ { height: 200, paddingVertical: 16 } }
data={ data }
keys={ keys }
colors={ colors }
curve={ shape.curveNatural }
showGrid={ false }
/>
)
}
}
However, this code only renders the first four data points.
What platform?
Occurs on both iOS and Android platforms.
Additional comments
I think the problem has something to do with this line, which seems to be using keys.length
when it should be using data.length
. However, changing that line alone does not fix the issue, so there must be another place where the number of data points is being calculated incorrectly.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
ggplotly rendering issues due to too many data points
My actual data has 9500 data points across the stacked area chart. When I remove the custom text tooltips, it plots fine.
Read more >Stacked Area Chart - starting data point not plotted on last ...
We use stacked area charts to display data. I have noticed, since 13.2, that stacked area charts that have more than 3 series...
Read more >Rendering Artifacts in Stacked Area Chart with Gaps-Highcharts
Could be a bug in highcharts, a workaround is to use step , like this: plotOptions: { series: { stacking: 'percent', gapSize: 1,...
Read more >Stacked Area Chart is misleading if all groups don't have values
This is causing my stacked area chart to have odd jumps in the data. Here's an example where position "Jrny" had values in...
Read more >Build and style a chart with the new Swift Charts framework
Screenshot of a stacked area chart showing US baby names over time. NOTE: It's very important to sort the data points by name....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looks good to me. Thanks!
Released in v.2.2.2. Thank you for reporting the issue and helping with the fix 🥇