bazzacad
Posts: 20
Joined: Mon Jun 26, 2017 9:00 pm

Can't drag point & snap week to week

I'm trying to drag a point & have it snap week to week, but it seems to snap to some random location.
What am I missing?
Demo: https://jsfiddle.net/bazzacad/p5sfLhx1/24/
drag_gantt.gif
drag_gantt.gif (74.9 KiB) Viewed 790 times
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Can't drag point & snap week to week

Hello,


This is because dragPecisionX determines how far to move from the starting point which is January 1, 1970 for the date type axis. If you look at demo you can see what I mean: https://jsfiddle.net/BlackLabel/otcpe5az/

As a workaround in your case you can subtract 95000 ms from dragPrecisionX value.
Demo: https://jsfiddle.net/BlackLabel/98cdymsb/

Let me know if you have any further questions!
Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
bazzacad
Posts: 20
Joined: Mon Jun 26, 2017 9:00 pm

Re: Can't drag point & snap week to week

Thanks for the great solution. Out of curiosity, why did you use 95000 instead of 86400?
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Can't drag point & snap week to week

You're welcome!

For example, I set this value when testing and due to the fact that a thousand is a small number relative to the entire week, it is not noticeable on the chart.

Feel free to ask any further questions!
Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/

Return to “Highcharts Gantt”