Highcharts test tool

HTML

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 300px"></div>

JavaScript

/**
* Experimental Draggable points plugin
* Revised 2012-02-08
*
* On Saving this jsbin, remember to update http://jsfiddle.net/highcharts/AyUbx/
*/
var hasTouch = 'ontouchstart' in window,
    START = 'mousedown',
    MOVE = 'mousemove',
    END = 'mouseup';

if (hasTouch) {
    START = 'touchstart';
    MOVE = 'touchmove';
    END = 'touchend';
}

function normalizeEvent(e) {
    var props = ['clientX', 'clientY', 'pageX', 'pageY'],
        i, l, n;
    
    if (['touchstart', 'touchmove', 'touchend'].indexOf(e.type) > -1) {
        for (i = 0, l = props.length; i < l; i++) {
            n = props[i];
            e[n] = e.originalEvent.targetTouches[0][n];
        }
    }
    
    return e;
}



(function(Highcharts) {
    var addEvent = Highcharts.addEvent,
        each = Highcharts.each;
    
    /**
     * Filter by dragMin and dragMax
     */
    function filterRange(newY, series) {
        var options = series.options,
            dragMin = options.dragMin,
            dragMax = options.dragMax;
        
        if (newY < dragMin) {
            newY = dragMin;
        } else if (newY > dragMax) {
            newY = dragMax;
        }
        return newY;
    }
    
    Highcharts.Chart.prototype.callbacks.push(function (chart) {        
        
        var container = chart.container,
            dragPoint,
            dragY,
            dragPlotY,
            dragPoint1,
            dragPlotY1;
        
        // my code:
        var dragPointSeries;
        var dragSeries;
        
        chart.redraw(); // kill animation (why was this again?)
        
        addEvent(container, START, function(e) {
            e = normalizeEvent(e);
            var hoverPoint = chart.hoverPoint;
            if (hoverPoint && hoverPoint.series.options.draggable) {
                dragSeries = false;
                dragPoint = hoverPoint;
                dragY = e.pageY;
                dragPlotY = dragPoint.plotY + (chart.plotHeight - (dragPoint.yBottom ||...