Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop events are triggered by single clicks #9

Open
ThorstenPeter opened this issue Mar 13, 2014 · 1 comment
Open

Drop events are triggered by single clicks #9

ThorstenPeter opened this issue Mar 13, 2014 · 1 comment

Comments

@ThorstenPeter
Copy link

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:

  1. Drag and drop the Jan value of series 3 to - say - 200.
  2. 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.
  3. 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
};
}
}

@danreb25
Copy link

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
    }]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants