3👍
✅
The solution was using @ViewChild on the directive directly and forcing a redraw with each new data. Dataadding and removing itself was done on the @Input object lineChartData
which is defined in the html like this: [datasets]="lineChartData"
Code:
import { BaseChartDirective } from 'ng2-charts/charts/charts';
export class Example{
@ViewChild(BaseChartDirective) baseChartDir: BaseChartDirective;
public lineChartData: Array<any>;
//call this function whenever you want an updated version of your chart
this.baseChartDir.ngOnChanges({});
Source:stackexchange.com