Home › Forums › Chart Support › Using CanvasJS with Angular 2 › Reply To: Using CanvasJS with Angular 2
@brianali,
Creating the chart within ngOnInit() should work fine. Also, if your div-id is chartContainer, the same ID has to be passed as container-id to CanvasJS as const chart = new CanvasJS.Chart("chartContainer", {. Please take a look at this sample project on using CanvasJS charts with AngularJS-2.
chartContainer
const chart = new CanvasJS.Chart("chartContainer", {
__ Priyanka M S Team CanvasJS