js/highcharts-master/utils/samples/test-controller.js
/**
     * Trigger an event. The target element will be found based on the
     * coordinates. This function is called behind the shorthand functions like
     * .click() and .mousemove().
     * @param  {string} type  Event type
     * @param  {number} x     X relative to the chart container
     * @param  {number} y     Y relative to the chart container
     * @param  {Object} extra Extra properties for the event arguments, for
     *    example `{ shiftKey: true }` to emulate that the shift key has been
     *    pressed in a mouse event.
     */
Trigger an event. The target element will be found based on the
coordinates. This function is called behind the shorthand functions like
.click() and .mousemove().
@param  {string} type  Event type
@param  {number} x     X relative to the chart container
@param  {number} y     Y relative to the chart container
@param  {Object} extra Extra properties for the event arguments, for
example `{ shiftKey: true }` to emulate that the shift key has been
pressed in a mouse event.
Trigger an event . The target element will be found based on the coordinates . This function is called behind the shorthand functions like . click () and . mousemove () . @param { string } type Event type @param { number } x X relative to the chart container @param { number } y Y relative to the chart container @param { Object } extra Extra properties for the event arguments for example ` { shiftKey : true } ` to emulate that the shift key has been pressed in a mouse event .
function trigger(type, x, y, extra) {
        updateOffset();
        var pageX = offset.left + (x || 0),
            pageY = offset.top + (y || 0);
        var evt = document.createEvent('Events');
        evt.initEvent(type, true, true);
        evt.pageX = pageX;
        evt.pageY = pageY;
        if (extra) {
            Object.keys(extra).forEach(function (key) {
                evt[key] = extra[key];
            });
        }
        var element = document.elementFromPoint(pageX, pageY);
        if (typeof x === 'number' && typeof y === 'number') {
            chart.renderer.circle(
                x,
                y,
                {
                    mousedown: 3,
                    mousemove: 2
                }[type] || 3
            ).attr({
                'fill': 'none',
                'stroke': {
                    mousedown: 'green',
                    mousemove: 'blue'
                }[type] || 'red',
                'stroke-width': {
                    mousedown: 2,
                    mousemove: 1
                }[type] || 2,
                'zIndex': 100
            }).css({
                'pointer-events': 'none'
            }).add();
        }
        (element || document.body).dispatchEvent(evt);
    }
function trigger ( type , x , y , extra ) { updateOffset ( ) ; var pageX = offset . left + ( x || 0 ) , pageY = offset . top + ( y || 0 ) ; var evt = document . createEvent ( 'Events' ) ; evt . initEvent ( type , true , true ) ; evt . pageX = pageX ; evt . pageY = pageY ; if ( extra ) { Object . keys ( extra ) . forEach ( function ( key ) { evt [ key ] = extra [ key ] ; } ) ; } var element = document . elementFromPoint ( pageX , pageY ) ; if ( typeof x === 'number' && typeof y === 'number' ) { chart . renderer . circle ( x , y , { mousedown : 3 , mousemove : 2 } [ type ] || 3 ) . attr ( { 'fill' : 'none' , 'stroke' : { mousedown : 'green' , mousemove : 'blue' } [ type ] || 'red' , 'stroke-width' : { mousedown : 2 , mousemove : 1 } [ type ] || 2 , 'zIndex' : 100 } ) . css ( { 'pointer-events' : 'none' } ) . add ( ) ; } ( element || document . body ) . dispatchEvent ( evt ) ; }
Trigger an event.
Trigger an event .
// Leave marks for debugging