adopted-ember-addons / adopted-ember-addons/ember-cli-chart

Chart not working from model

オープン
#108 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
138
フォーク
76
PR マージ指標
30日以内にマージされた PR はありません

説明

I just started using this. I'm using the [screencast](https://www.emberscreencasts.com/posts/46-bar-charts-with-ember-cli-chart) from the [README](https://github.com/aomran/ember-cli-chart/blob/master/README.md) as a reference.

In my case, using `mapBy` on a model causes the chart to show no data. Just the background grid lines. When I hard-code the same data from my models, the chart _does_ work.

I'm guessing this might have something to do with the async nature of models and calculations. Perhaps the data is passed to the chart before the promises are resolved. How do you guys work around this?

I've tried doing the `await` thing, but this adaption from the example screencast does not work either:

```
numberData: computed('model', async function() {
const model = await this.get('model')
const labels = await model.mapBy('label')
const data = await model.mapBy('value')

return {
labels,
datasets: [{
label: 'Hours',
data
}]
}
})
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。