我在用ng2-google-chart
而且效果很好。现在我想使用一些复选框来选择图表中显示哪些数据。
我的图已连接到数组chartData
,选择后更新正确。但图表没有改变。这是我的图表
<div #graph [chartData]="this.chartData" chartType="AreaChart" GoogleChart></div>
有没有办法在数据更改后重新渲染它?
同时我解决了这个问题:
In angular2-google/directives/angular2-google-chart.directive.ts import OnChanges
并像这样实现它:
ngOnChanges(changes) {
if (googleLoaded)
{
this.drawGraph(this.chartOptions,this.chartType,this.chartData,this._element);
}
}
//编辑:这现已在最新的库版本中修复。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)