A
A
adizh2022-03-18 09:15:38
Vue.js
adizh, 2022-03-18 09:15:38

How to update series data in highcharts vue?

How to update data dynamically with highcharts vue? All examples and documentation show only static options, but how can I update them on click?

<highcharts :options="chartOptions"></highcharts>
<button @click='updateChart'>update</button>

data() {
    return {
       chartOptions: {
        series: [{
          data: [1,2,3] 
        }],
  
      },
method: updateChart(){
      this.chartOptions.update(
        this.series.data[0]= 4
      )
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2022-03-18
@0xD34F Vue.js

this.$set(this.chartOptions.series[0].data, индекс, значение);

https://codesandbox.io/s/for-https-qna-habr-com-q-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question