artakserkses
Posts: 51
Joined: Tue Feb 23, 2021 11:23 am

Chart height doesn' update after update'ing chart options

Hi again :)

I have another iteresting problem :) Cause i have sth like here:
https://jsfiddle.net/fLhn2t76/2/

And I would like to update series in gantt, but when i'm trying to update it with chart.update(HighchartOptions) chart height doesn't update (and when i have 2 or 3 series more this isn't a huge problem, but when i get from server 50 series more this is starting to be a little awkward :mrgreen: )
Can you please tell me how should i update chart, so row height is constant, and not the overall chart height?

Thanks :)
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Chart height doesn' update after update'ing chart options

Hi,
Thanks for the message and sorry for the late reply.

If you want to update series, you can remove the actual and add new like on this example.

Live demo:
https://jsfiddle.net/BlackLabel/j2k5vezL/

Let me know if this solution is useful.
Best regards.
Sebastian Hajdus
Highcharts Developer
artakserkses
Posts: 51
Joined: Tue Feb 23, 2021 11:23 am

Re: Chart height doesn' update after update'ing chart options

Hi Sebastian,
Your solution is not quite good for me, cause i want to add couple series at once (and by couple i mean between 30 and 300 :mrgreen: ), so with:

Code: Select all

chart.series.forEach(serie => serie.remove)
And then:

Code: Select all

chartOptions.series.foreach(serie => chart.addSerie(serie))
It will take ages :)

So far I'm doing it like:

Code: Select all

chartOptions.chart.height = 224 + 40*chartOptions.series.length; //224 cause I have navigator, so that is 144 for header, and 80 for footer
chart.update(chartOptions, true, true);
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Chart height doesn' update after update'ing chart options

Hi,
Thanks for share with your interesting solution.

At this moment update looks like the best approach.

Best regards.
Sebastian Hajdus
Highcharts Developer

Return to “Highcharts Gantt”