highcharts / highcharts-vue

Other
686 stars 150 forks source link

How to get all selected points? #77

Closed scryptoking closed 5 years ago

scryptoking commented 5 years ago

Hello,

In a map, how can I get all the selected regions for example? in jQuery I would do this like this:

var chart = $('#ti_map_tp').highcharts(); var selectedPoints = chart.getSelectedPoints(); if (selectedPoints.length == 0) { selectedPointsStr += '0,'; } else { $.each(selectedPoints, function(i, value) { selectedPointsStr += value.value + ','; }); }

How can this be achieved when using the wrapper?

scryptoking commented 5 years ago

Found out that you can just put a ref on the highchart wrapper:

<highcharts :constructor-type="'mapChart'" :options="zpSimChart" ref="zpsimchart"></highcharts>

Then you can access the prototype functions like this:

let points = this.$refs.zpsimchart.chart.getSelectedPoints();

As for me: this issue can be closed.