I am using zingchart in my angular2 application and have addressed this problem. My data for the chart has changed, I need to rewrite the chart, and I just donβt know how to do it? this is the plunkr that the zing team supplied my reerender button. I do not know how to redirect the chart. 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 : this.chart['id'], data : this.chart['data'], width : this.chart['width'], height: this.chart['height'] }); }); } ngOnDestroy() { zingchart.exec(this.chart['id'], 'destroy'); } }
source share