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

Get coordinates of the bar when update or delete a bar from gantt chart

Hi

Can you please help me to get the start and end coordinates of a bar on gantt chart with x axis as datetime. I need to delete and update a bar on the bar and need to persist the change. For that i think i need start and end values which will be start time and end time of bar in Date.UTC.

Any hint is appreciable.
I tried with getSelectedPoints method but not able to access coordinates from it

Thanks
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Get coordinates of the bar when update or delete a bar from gantt chart

Hi eraka,

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

Information about start and end of the point should be available on each point object. Here is a demo showing how you can read it:
https://jsfiddle.net/BlackLabel/wks952pr/

Let me know if it was what you were looking for.
Regards!
Mateusz Bernacik
Highcharts Developer
eraka
Posts: 123
Joined: Thu Apr 28, 2022 6:55 am

Re: Get coordinates of the bar when update or delete a bar from gantt chart

Hi mateusz.b

Thank you so much for your reply

I think i missed explaining it well, let me state my problem. On x axis i have datetime with 24 hour time (basically i am looking for a day with 24 hours on it) and on click of a button i am adding points to a series like this:

const point =
{ start: Date.UTC(
this.t1.getFullYear(),
this.t1.getMonth(),
this.t1.getDate() ),
end: Date.UTC(
this.t1.getFullYear(),
this.t1.getMonth(),
this.t1.getDate(),
0, 60
),
name: ob.product,

y: ob.i,
color: '#CAECF3',
id: this.counter
}

this.chartRef.series[0].addPoint(point); and persisting this data to the sessionstorage.

but say now i drag and drop this bar somewhere else on the chart say i have 4 categories and now i move the bar from category 1 to category three, then in that case how do i recalculate or find start and end value of updated point.

thanks
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Get coordinates of the bar when update or delete a bar from gantt chart

Hi eraka,

In that case you should use drop event to read properties of the updated point.
Demo:https://jsfiddle.net/BlackLabel/92sxpzet/
API reference:https://api.highcharts.com/gantt/plotOp ... vents.drop

Let me know if it was what you were looking for.
Regards!
Mateusz Bernacik
Highcharts Developer
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Get coordinates of the bar when update or delete a bar from gantt chart

You're welcome! In case of any further questions, feel free to contact us again.
Mateusz Bernacik
Highcharts Developer
kanti
Posts: 21
Joined: Fri Aug 18, 2023 7:18 am

Re: Get coordinates of the bar when update or delete a bar from gantt chart

Hii

After getting new drop values how to save those new values back to salesforce


thanks in advance
jedrzej.r
Posts: 725
Joined: Tue Jan 24, 2023 11:21 am

Re: Get coordinates of the bar when update or delete a bar from gantt chart

I can see that this is a duplicate post from other forum topic. We work as a single team across forum as well as other support platforms. Please do not duplicate your topics on multiple channels because it only disrupts our work. You do not have to worry because we always answer all questions on our support platforms.

A reply to your question has already been posted: viewtopic.php?f=19&t=51283&start=15#p188555

Best regards!
Jędrzej Ruta
Highcharts Developer

Return to “Highcharts Gantt”