Drop events are triggered by single clicks
Drop events sometimes fire without preceding dragging, i.e. by a single click. This can be reproduced in the demo fiddle http://jsfiddle.net/highcharts/AyUbx/ like this:
- Drag and drop the Jan value of series 3 to - say - 200.
- Move the cursor to some location above the Feb columns, so that the Feb tooltip opens. The cursor does not need to switch to ns-resize.
- Perform a single click. As result, the #drop div displays something like "In Series 3, 1 was set to 71.50".
Although the Feb value does not change, this behavior is problematic if your drop callback performs something like changing the marker attributes.
As a workaround, one can define a drag event that sets a wasDragged flag, and have the drop event test that flag before performing the actual action:
events: { drag: function () { wasDragged = true; }, drop: function() { if ( wasDragged == true ) { wasDragged = false; // drop code goes here }; } }
Some problems remains:
description:
with draggable options activated on the x-axis of a series, a single click on a point generates a DROP events with a negative shift on the x-axis only when categorical values on x-axis
step to reproduce based on http://jsfiddle.net/highcharts/AyUbx/ :
1 / single click generates a drop on serie 3
when you add draggableX: true, to serie 3
a single click on a point from series 3 will generate a drop with a shift of -.0.5 on the x axis
2/ not reproduced when deleting the 2 first series and keeping series 3
series: [ {
data: [0, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
draggableX: true,
draggableY: true
}]
3/ reproduced with categorical x-axis
i.e. deleting the 2 first series and keeping series 3 and uncommenting the categories on the xAxis
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
...
series: [ {
data: [0, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
draggableX: true,
draggableY: true
}]