# How can i aggregate data for better performance

**URL:** <https://community.plotly.com/t/how-can-i-aggregate-data-for-better-performance/2042>\
**Category:** plotly.js\
**Created:** [September 5, 2016, 10:04am UTC](https://community.plotly.com/t/how-can-i-aggregate-data-for-better-performance/2042 "2016-09-05T10:04:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jahn](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@jahn](https://community.plotly.com/u/jahn)\
**Post date:** [September 5, 2016, 10:04am UTC](https://community.plotly.com/t/how-can-i-aggregate-data-for-better-performance/2042/1 "2016-09-05T10:04:21Z")

</div>

i have tried out scattergl to get better performance but it is not working right.  
My axes from chart are fix , i cant move them anymore. If i Zoom , the axis tickfont is not refreshed its stacking up till there are so many numbers you cant read it.

I use `Plotly.addTraces` to add Traces  
and `Plotly.relayout` to restyle my layout

Now i thought about aggregation.  
how can i aggregate data and plot more when zoomed?

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [September 6, 2016, 1:52pm UTC](https://community.plotly.com/t/how-can-i-aggregate-data-for-better-performance/2042/2 "2016-09-06T13:52:57Z")

</div>

Yikes.

Can you share a reproducible example of what you’re trying to do?

---

<div class="post-metadata">

**Author:** ![jahn](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@jahn](https://community.plotly.com/u/jahn)\
**Post date:** [September 6, 2016, 2:14pm UTC](https://community.plotly.com/t/how-can-i-aggregate-data-for-better-performance/2042/3 "2016-09-06T14:14:36Z")

</div>

I can try to explain what my problem is.

https://codepen.io/plotly/embed/preview/qdvYKO?height=300&slug-hash=qdvYKO&default-tabs=js,result&host=https://codepen.io&embed-version=2

check this tutorial with multiple axes. Change scatter to scattergl, Now u cant move the axis.

I thought i can have a better performance with scattergl. But its not working right, am i doing something wrong?

I thought that if i have 500.000 datapoints i can plot the average instead of plotting all. So how can i do this?  
I wanted to plot more of the data when i zoom in.
