Chartjs-Load data into chartjs using promises in vue.js

0👍

It doesn’t work because this expression returns a Promise:

apiData.getData()
      .then(function(result){
        return result;
      })

and you’re assigning it to the labels property, which expects an array (not a Promise).
In the ‘then’ callback, what you should do (instead of simply returning the result) is to assign the result to the relevant data source (in this case: contaminacion.data.labels), and make the UI render the new data (in correlation with the Vue.js API and life-cycle).

Leave a comment