GimmyHchs / vue-charts

Base on Vue2.0 wrapper for ChartJs. (Deprecated)
MIT License
357 stars 85 forks source link

Data updating not working #27

Open ortizvinicius opened 7 years ago

ortizvinicius commented 7 years ago

Hello, I am using this library, and I wrote this code for a doughnut chart:

<chartjs-doughnut
  :height="100"
  :scalesdisplay="false"
  :bind="true"
  :labels="['A', 'B', 'C']"
  :datasets="[{
    data: [a.val, b.val, c.val],
    borderWidth: [0, 0, 0],
    backgroundColor: ['#2AA806', '#FF9917', '#FF4D4D']
  }]"
  :option="{
    cutoutPercentage: 75,
    legend: { display: false },
    maintainAspectRatio: false
  }">
</chartjs-doughnut>

But, for eg., when I change the value of a.val, the chart do the render animation, but its values dont change.

Shekesh commented 7 years ago

Confirmed. Issue's source is the watched dataset property. It redraws the chart but actually the chart data is not set to the new value. chart_data.datasets = val; missing at https://github.com/hchstera/vue-charts/blob/master/src/vue-chartjs-lib.js#L105

phamels commented 6 years ago

Same problem, adding this.chart_data.datasets = val; didn't fix it for me.

sirb0rab0g1 commented 6 years ago

did you guys solved this ?

mech01nc01 commented 6 years ago

giving <chartjs-line ref="chart" and a watcher on datasets-variable with this.$refs.chart.chart_data.datasets=this.chartData; was my only solution