hamza
Posts: 1
Joined: Tue May 10, 2022 5:52 pm

Destroy and redraw chart using Angular

Hello

i want to destroy and redraw my candlestick chart
but i m only able to destroy it

Code: Select all

chartOptions!: Highcharts.Options;
createChart(){

 this.chartOptions = {
      chart: {
        events: {

           load: async function () {
// the rest of my code here 
}
}
}
}
All i want is to destroy previous chart and create new one
Language : Angular 12
thank you
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Destroy and redraw chart using Angular

Hi hamza,

Welcome to our forum and thanks for contacting us with your question!

Here is a demo showing how to destroy and create chart again in angular:
https://stackblitz.com/edit/highcharts- ... mponent.ts

Here you can find related github topic with more information:
https://github.com/highcharts/highchart ... issues/218

Let me know if it was what you were looking for.

Regards!
Mateusz Bernacik
Highcharts Developer
Takwa
Posts: 3
Joined: Wed Nov 09, 2022 10:42 am

Re: Destroy and redraw chart using Angular

Thank you saved med
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Destroy and redraw chart using Angular

Hello Takwa,

Welcome to our forum and thanks for contacting us with your question!

That's great to hear that this answer also helped you to solve the problem.

In case of any further questions, feel free to contact us again.
Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
Takwa
Posts: 3
Joined: Wed Nov 09, 2022 10:42 am

Re: Destroy and redraw chart using Angular

michal.f wrote: Wed Nov 09, 2022 10:54 am Hello Takwa,

Welcome to our forum and thanks for contacting us with your question!

That's great to hear that this answer also helped you to solve the problem.

In case of any further questions, feel free to contact us again.
Best regards!
Thank you
I have a question please why if i have two highchart i can't do two destroy in the same time it works with the first highchart but i get this error (Cannot read properties of undefined (reading 'forExport')) with the second pleaase help me
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Destroy and redraw chart using Angular

Hi,

Could you reproduce the issue in an online editor that I could work on?
Now it is hard to tell you what could be the problem without taking a look at your code.

Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/

Return to “Highcharts Stock”