I am using highcharts with dragable points for highcharts. I want to be able to drag the chart points, but not past the next point. Their website shows demos of how dragMaxX can be set, but not dynamically: http://www.highcharts.com/plugin-registry/single/3/Draggable%20Points
This fiddle shows how I have set the Highchart settings, without setting dragMax : http://jsfiddle.net/AyUbx/3263/
I want to limit the user to not be able to drag a point past the next point. Something like this:
var thisX = this.series.xData.indexOf(this.x);
var nextX = this.series.xData[thisX+1];
this.series.dragMaxX = nextX;
Except this doesn't work. Does anyone know if this is possible or how it can be done? I have looked at the API for Highcharts but couldn't find something that worked.
I have changed this plugin a little bit to give you the possibility for setting max distance between points. I have added new parameter, named dragMaxToPoint, you can use it in series.
Here you can see function I have changed:
Here you can see an example how it can work: http://jsfiddle.net/AyUbx/3269/
Best regards.
EDIT: If you want to stop the drag if the point you are dragging gets a higher x value than the next point, you can change the same function a little bit. You can add if statement similar to:
Here you can see an example how it can work: http://jsfiddle.net/AyUbx/3270/