Ember Js,Ember-Highcharts 不更新对 chartData 的更改
Ember Js, Ember-Highcharts not updating changes to chartData
我正在使用 Ember-CLI 和 ember-highcharts 绘制一些数据。该库可以很好地处理测试数据,但当我尝试从 API 中提取数据时失败,因此我相信可能存在某种竞争条件。但是,我可以很好地从我的组件中打印系列,所以我不确定为什么 highcharts 组件没有监听对 chartData 的更改并相应地更新。
这是我的赋值语句:
this.get('chartData')[0].data.setObjects(barItems);
我的 charData 元素:
chartData: [{
name: 'Temperature',
type: 'column',
color: '#8fb1e8',
data: []
},
{
name: 'Humidity %',
type: 'line',
color: '#393a3d',
data: []
}],
此模板全部用于:
<p id="res"></p>
<div class="graph">
{{high-charts chartOptions=chartOptions content=chartData}}
</div>
{{yield}}
导航离开并返回页面后,图表确实填充了数据。我还有一些 jquery 附加项,它们会在图表填充时消失。
如有任何关于如何解决此问题、如何强制组件同步加载等的想法,我们将不胜感激。
ember-highcharts
使用 content.[]
as a dependent key meaning that it only updates if you change the length of your provided array. To workaround this you could use notifyPropertyChange.
我正在使用 Ember-CLI 和 ember-highcharts 绘制一些数据。该库可以很好地处理测试数据,但当我尝试从 API 中提取数据时失败,因此我相信可能存在某种竞争条件。但是,我可以很好地从我的组件中打印系列,所以我不确定为什么 highcharts 组件没有监听对 chartData 的更改并相应地更新。
这是我的赋值语句:
this.get('chartData')[0].data.setObjects(barItems);
我的 charData 元素:
chartData: [{
name: 'Temperature',
type: 'column',
color: '#8fb1e8',
data: []
},
{
name: 'Humidity %',
type: 'line',
color: '#393a3d',
data: []
}],
此模板全部用于:
<p id="res"></p>
<div class="graph">
{{high-charts chartOptions=chartOptions content=chartData}}
</div>
{{yield}}
导航离开并返回页面后,图表确实填充了数据。我还有一些 jquery 附加项,它们会在图表填充时消失。
如有任何关于如何解决此问题、如何强制组件同步加载等的想法,我们将不胜感激。
ember-highcharts
使用 content.[]
as a dependent key meaning that it only updates if you change the length of your provided array. To workaround this you could use notifyPropertyChange.