markoza
Posts: 3
Joined: Tue Aug 29, 2023 2:44 pm

Subtasks arrow not updating after I update series

It might be a little bit difficult for me to reproduce this code, but I i wll try to explain. I am using Gantt with subtasks and I keep my options in a React useState.
When my data changes I update my series array like this:

Code: Select all

  setOptions({
                series: [
                    {
                        name: activeOrganization?.Organization,
                        data: seriesArray,
                    },
                ],
            });
It seems to be updating it correctly, except my points are not updated correctly and Subtasks arrows are placed in wrong places.
like this: https://we.tl/t-KjHvtLjJnn (also see attachment)

Is there a way to update points, or redraw chart, or whatever
tnx,
Marko
jakub.j
Posts: 1091
Joined: Tue Jan 24, 2023 11:14 am

Re: Subtasks arrow not updating after I update series

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

You need to first clear the series data and than set new data and the subtasks will be rendered correctly, see:

Demo: https://stackblitz.com/edit/react-tzvtrx?file=index.js

I hope you will find it useful
Kind regards
Jakub
markoza
Posts: 3
Joined: Tue Aug 29, 2023 2:44 pm

Re: Subtasks arrow not updating after I update series

Hi Jakub,

that actually works in a way.
There was no way to do it with events on load, render or redraw?

it seems to me that the solution falls back on React.

tnx
jakub.j
Posts: 1091
Joined: Tue Jan 24, 2023 11:14 am

Re: Subtasks arrow not updating after I update series

Hey!

What do you mean by saying that it falls back on React?

I'm not sure how do you want to handle this on any of the events, could you please elaborate on this?

Kind regards
Jakub
markoza
Posts: 3
Joined: Tue Aug 29, 2023 2:44 pm

Re: Subtasks arrow not updating after I update series

I just tried so many different stuff with resetting it with events I expected the solution would be in that line, but this works perfectly fine

Thanks again.

Return to “Highcharts Gantt”