superman66 / vue-highcharts

The Component of Vue 2.x for highcharts
https://codesandbox.io/s/jjyqvv0k13
MIT License
115 stars 48 forks source link

setCategories for xAxis... #14

Closed Truman55 closed 7 years ago

Truman55 commented 7 years ago

How I can use native Highchart method for xAxis - setCategories? I've tried using delegateMethod, but it is not work. Thanks.

superman66 commented 7 years ago

according to highcharts setCategories Demo, you can find out use chart.xAxis[0].setCategories(); to update categories. so in the component, you can do that:

lineCharts.getChart().xAxis[0].setCategories(['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D']);

I alos update the demo. you can check it out.

Truman55 commented 7 years ago

Thanks for your reply. I also was able to make it using delegateMethod. chartName.delegateMethod('update', ({ xAxis: { categories: [] } }));

But maybe your method is more correct

superman66 commented 7 years ago

anyway, it works