highcharts / highcharts-vue

Other
686 stars 150 forks source link

Sorting of loaded data to Highchart using Vue and without jQuery #96

Closed dblinov closed 5 years ago

dblinov commented 5 years ago

Hello to Everyone,

Sorry for asking maybe simple question.

I'm trying to utilise Highchart and I need support on how to sort data on chart in different ways. There is an example on official website https://www.highcharts.com/forum/viewtopic.php?t=40663, but it with jQuery utilisation. Is there any other options?

Thank you very much in advance!!

Denyllon commented 5 years ago

Hi @dblinov ,

Thank you for contacting us. You do not need to use jQuery at all (as Rafał Sebestjański wrote in his answer on forum), but it will be necessary to refactor the code a bit, to make it much closer to Vue conceptions, namely we need to divide current event functions, data, and chart configuration into a component data, computed properties, and methods object. I prepared the example which shows how it could be implemented in Vue, so please take a lok on it. The most important principle is to do not use the Chart.update() or Series.setData() prototype functions. Instead, just need to change a component data.

Live example: https://codesandbox.io/s/highcharts-vue-demo-20xd1

Kind regards!