vue-charts icon indicating copy to clipboard operation
vue-charts copied to clipboard

Changing the options won't properly redraw the chart

Open timeu opened this issue 8 years ago • 2 comments

If the options props is changed the chart is redrawn, however the changes in the options are not reflected in the redrawn chart because the draw method on the ChartWrapper is using the old options instance.

I guess a fix would be to call chartWrapper.setOptions (see docs) when the chart is redrawn or the options props is changed

timeu avatar Nov 15 '16 17:11 timeu

have you handled a workaround for this?

terion-name avatar Mar 04 '17 14:03 terion-name

My workaround is to substitude original component with an extended:

import Chart from 'vue-charts/src/components/chart'

export default Object.assign(Chart, {
  watch: {
    options() {
      if (this.wrapper) {
        this.wrapper.setOptions(this.options)
      }
    }
  }
});

terion-name avatar Mar 04 '17 14:03 terion-name