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

Chart loading takes 6 to 8 secs for about 900 data points #2475

Closed
nagabhushant opened this issue May 15, 2020 · 7 comments
Closed

Chart loading takes 6 to 8 secs for about 900 data points #2475

nagabhushant opened this issue May 15, 2020 · 7 comments
Labels

Comments

@nagabhushant
Copy link

I am using amcharts for loading Stock data of about 900 data points. It includes Candle information of a stock and another 3 lineseries. When i load the page it takes about 6 to 8 seconds to load.

I have disabled

// am4core.useTheme(am4themes_animated);
and using
am4core.options.minPolylineStep = 5;
am4core.options.onlyShowOnViewport = true;
chart.hiddenState.properties.opacity = 0;
series.showOnInit = false;
series.defaultState.transitionDuration = 0;

I have tried all these options to reduce the time loading but still it takes time to load.

I was using Google charts and it loads with in 1 or 2 seconds. I found very useful with amcharts to use in my site but due to this performance issue i couldn't able to migrate from Google charts.

I am using free version of amcharts and i am not sure if only paid version has performance improvement. If that is the case i need to test before migrating to amcharts. I don't want our users to face this issue.

Please help me to resolve this issue.

I am using amCharts 4 version in Chrome browser

<script src="//www.amcharts.com/lib/4/core.js"></script> <script src="//www.amcharts.com/lib/4/charts.js">
@nagabhushant
Copy link
Author

image

This is how my chart looks like. Its very simple one

@martynasma
Copy link
Collaborator

Can you post your chart online where we can test it? 900 data pints does not sound like something that would take 8 seconds to render.

@nagabhushant
Copy link
Author

Thank you for looking in to it.

Here is the example

https://jsfiddle.net/nagat/3kn5tgLa/10/

Right now this will take 7 to 8 secs

But if i add more series then it will take more time

@martynasma
Copy link
Collaborator

Thanks.

So the main issue is use of skipEmptyPeriods. It is a hugely costly operation. I strongly suggest getting rid of it.

I also suggest making use of data item grouping:
https://www.amcharts.com/docs/v4/concepts/axes/date-axis/#Dynamic_data_item_grouping

@martynasma
Copy link
Collaborator

One other thing about data: if you can you should set the data right away before chart init, so you don't waste CPU cycles on initial data-less render of the chart.

Also, invalidateData() call is redundant since setting data on a chart will invalidate data automatically. Not that it has any effect on performance, just a tip for cleaner code.

@nagabhushant
Copy link
Author

Thats really nice suggestions and my charts are loading faster than before. One more question

how to get rid of weekend dates ? i don't want charts to display space between friday and monday data points. Can i use skipEmptyTimeUnits? or any suggestions?

@martynasma
Copy link
Collaborator

Sorry, not possible without enabling skipEmptyPeriod which slows everything down :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants