How to implement gwt-highcharts draggable data points in java?

374 views Asked by At

I need to implement gwt-highcharts draggable data points in java, similar to what's done in js here:

http://jsfiddle.net/highcharts/AyUbx/ (code below)

I can't figure out how to do that in java from the gwt-highcharts javadocs. None of the mouse or click eventhandler documentation mentions how to capture drag info, or even how to capture mouse-up events, which combined with click events, would let me detect a drag action. I haven't found this anywhere else on the Web. Any help or examples would be greatly appreciated. I'm using GWT 2.5.1, and the latest versions of gwt-highcharts and jquery as of 2014-01-03. Thanks in advance. -Dan

var chart = new Highcharts.Chart({

chart: {
    renderTo: 'container',
    animation: false,
    zoomType: 'x'
},

xAxis: {
    //categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},

plotOptions: {
    series: {
        cursor: 'ns-resize',
        point: {
            events: {

                drag: function(e) {
                    // Returning false stops the drag and drops. Example:
                    /*
                    if (e.newY > 300) {
                        this.y = 300;
                        return false;
                    }
                    */
                    $('#drag').html(
                        'Dragging <b>' + this.series.name + '</b>, <b>' +
                        this.category + '</b> to <b>' + 
                        Highcharts.numberFormat(e.newY, 2) + '</b>'
                    );
                },
                drop: function() {
                    $('#drop').html(
                        'In <b>' + this.series.name + '</b>, <b>' +
                        this.category + '</b> was set to <b>' + 
                        Highcharts.numberFormat(this.y, 2) + '</b>'
                    );
                }
            }
        },
        stickyTracking: false
    },
    column: {
        stacking: 'normal'
    }
},

tooltip: {
    yDecimals: 2
},

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,
    dragMinY: 0,
    type: 'column',
    minPointLength: 2
}, {
    data: [0, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4].reverse(),
    draggableY: true,
    dragMinY: 0,
    type: 'column',
    minPointLength: 2
}, {
    data: [0, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
    draggableY: true
}]

});

0

There are 0 answers