我在angular2应用程序中使用zingchart并且遇到了这个问题.我的图表数据已经改变,我需要重新渲染图表,我只是不知道该怎么做?这是zing chart团队提供的rerender按钮的傻瓜.我不知道如何重新渲染图表. https://plnkr.co/edit/OjqvVPiyKBUJbKgcLi6A?p=preview
import {bootstrap} from 'angular2/platform/browser';
import {Component, NgZone, AfterView, OnDestroy} from 'angular2/core'
class Chart {
id: String;
data: Object;
height: any;
width: any;
constructor(config: Object) {
this.id = config['id'];
this.data = config['data'];
this.height = config['height'] || 300;
this.width = config['width'] || 600;
}
}
@Component({
selector : 'zingchart',
inputs : ['chart'],
template : `
<div id='{{chart.id}}'></div>
`
})
class ZingChart implements AfterView, OnDestroy {
chart : Chart;
constructor(private zone:NgZone) {
}
ngAfterViewInit() {
this.zone.runOutsideAngular(() => {
zingchart.render({
id …Run Code Online (Sandbox Code Playgroud)