I am currently using angular 9 with Highcharts.
Link to the code :
https://stackblitz.com/edit/angular-ivy-wdejxk
Some instructions for running on application-side / test-side :
- Test - side : inside
angular.json
file on line number 18, change
"main": "src/main.ts",
to
"main": "src/main-testing.ts",
and do a refresh of the browser.
- Application - side : Change exactly the opposite of previous.
"main": "src/main-testing.ts",
to
"main": "src/main.ts",
Here are a few issues i am stuck upon :
- I have used chart callback to get the chart instance , but it is not working ( inside
hello.component.ts
,
line numbers 38 to 40 ). How should i call it and when does actually the callback happens in Highcharts ?
- If suppose somehow i am able to assign the chart instance to chartCreated variable. Can i control the
chart now, like line numbers 60 to 62 ( if i uncomment that ), will it work ? Basically i wanted to
know the
usefulness of updateFlag
in Highcharts.
- Unable to addSeries when ngOnChanges is called inside
hello.component.ts
- Inside the spec file
hello.component.spec.ts
i wanted to test the chart by putting a numeric data / adding a series
on my own , like i did when onClick() is called. But jasmine shows error
TypeError : Cannot read series of undefined
TypeError : Cannot read property 'addSeries' of undefined
How to resolve these ?
EDIT 1 : Implemented ngOnChanges and ngOnInit and removed most of the code from app.component.ts to hello.component.ts
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…