I`m trying to show a chart in ember with data loaded from an API. The data to be shown in the chart is calculated from different values coming from the API. So my first approach to show a chart on a route which is containing the API data as a model was to add example chart-data to the existing model. Following is the code of the approach:
model(params){
return this.store.findRecord('histogram', params.name).then((result) => {
result.set('chartData',{
labels: ['Value 1', 'Value 2', 'Value 3'],
series: [[71, 46, 59]]});
});
}
So my question is:
Why is the example above not working, when the same code without the existing model (the following example) is working without problems?
model: function () {
return {
chartData: {
labels: ['Value 1', 'Value 2', 'Value 3'],
series: [[71, 46, 59]]
}
};
}
Many thanks in advance.
Aucun commentaire:
Enregistrer un commentaire