I'm using highstock of Highcharts JS.

I get data from my server (array of facets like ["some_string", some_int] ) and then sort them by first element(int).

For example if i get [ ["oone", 1], ["one", 3], ["ooone", 2] ], after sort it becomes [ ["one", 1], ["two", 2], ["three", 3] ].

Plot works good nothing are lag. Data array is about 176000 elements.

When I try sort by second element(string), plot becomes lag, browser becomes lag, all becomes lag and slow.

When I try sort by first symbol of second element of facet, plot works better, but whatever bad.

What's a problem?

P.S. Sorry for my bad english :(

有帮助吗?

解决方案

You are trying to do a lot of heavy lifting on the browser. Though lots of optimizations are possible by writing your own versions of sorting algorithms, but with number of elements of order 100K, and each being an object, a custom sort is going to be slow on the browser.

What I would recommend is doing a new ajax request to the browser, with the sort mode as a parameter,sort the data on the server, and return sorted response.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top