weizhenye/vue-highcharts

How to change options in component with vue-cli

Closed this issue · 1 comments

Hi! I think it is just a silly question but I am lost right now.

I use vue-cli and imported vue-highcharts in the main.js where I also create my new Vue({}).

In my component the chart is rendered with the global options from my main.js. Now I want to change options from inside my component.

<highstock :options="options"></highstock>

...

methods: {
  update() {
    const vm = this;
    vm.Highcharts.setOptions({
      navigator: {
        maskFill: 'rgba(43, 43, 55, 1)'
      },
    });
  },
}

No error or something when I call the update function. just nothing happens. What am I doing wrong?

You can change options directly.

// update part of options
vm.$set(vm.options, 'navigator', {});
// or set a new options
vm.options = getNewOptions();