eraka
Posts: 123
Joined: Thu Apr 28, 2022 6:55 am

chartRef.redraw() not working in angular

HI
i am using gantt highchart in angular 13 for me chartRef.redraw( is not working, any help is appreciated.

I have checked the related posts like using reflow and all but that is not working also for me.
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: chartRef.redraw() not working in angular

Hi there,

Thank you for contacting us.

Unfortunately it is hard to tell what could be causing this issue without seeing the live example of it. Maybe you are trying to reference a chartRef in a place where it doesn't not exist (or doesn't exist yet)?

Please reproduce this issue in an online editor so that I can work on a solution for that.
Best regards!
Kamil Musiałowski
Highcharts Developer
eraka
Posts: 123
Joined: Thu Apr 28, 2022 6:55 am

Re: chartRef.redraw() not working in angular

I am using this chartCallback: Highcharts.ChartCallbackFunction = (chart) => {
this.chartRef = chart;
};

and when we say remove a point from series

removeSeries() {

this.service(this.id).subscribe({
next: (response) => {

this.points = this.points.filter(
(point: any) => point.d !== this.id
);

this.chartRef.redraw();

this.chartSet();

},
error: (err) => console.log(err),
complete: () => console.log('oo'),
});


}


this is how i am using it
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: chartRef.redraw() not working in angular

This piece of code does not tell me much without seeing the whole context. As I have asked you in a previous post, reproduce this issue in an online editor so that I can work on it and debug it. We are not able to help our users with more complicated problems without seeing the whole code running live.

As a side note, if you need to remove a series from chart (I'm guessing just by looking at the function name), you can use the Highcharts built in method called Series.remove() with automatically redraws a chart, so maybe that will fix your issue?

Take a look at it: https://api.highcharts.com/class-refere ... ies#remove

Best regards
Kamil Musiałowski
Highcharts Developer

Return to “Highcharts Gantt”