0👍
Try to put your chart creation code inside ngAfterViewInit()
instead of ngOnInt()
.
The ngAfterViewInit()
is invoked once the component view is initialized. At this point you can be sure, the canvas
exists.
For further details, please consult lifecycle event sequence from the
Angular
documentation.
Source:stackexchange.com