Currently, I am utilizing Highcharts with angular 9.
Here is the link to the code :
https://stackblitz.com/edit/angular-ivy-wdejxk
For running on the application side or test side, follow these instructions:
- Test Side: In the
angular.json
file at line number 18, change
to"main": "src/main.ts",
"main": "src/main-testing.ts",
Then refresh the browser.
- Application Side: Change exactly the opposite of the previous step.
to"main": "src/main-testing.ts",
"main": "src/main.ts",
Some issues I am facing include:
- I have utilized a chart callback to get the chart instance, but it's not functioning properly (inside
hello.component.ts
, lines 38 to 40). How do I call it and when does the callback happen in Highcharts? - If by some means I can assign the chart instance to the chartCreated variable, can I now control the chart like lines 60 to 62 (if I uncomment that)? Essentially, I want to understand the
usefulness of updateFlag
in Highcharts. - Unable to addSeries when ngOnChanges is called inside
hello.component.ts
- In the spec file
hello.component.spec.ts
, I wanted to test the chart by adding a series or numeric data on my own, as I did when onClick() is called. Butjasmine shows an error
How can I resolve these issues?TypeError: Cannot read series of undefined TypeError: Cannot read property 'addSeries' of undefined
EDIT 1: Implemented ngOnChanges and ngOnInit, and transferred most of the code from app.component.ts to hello.component.ts