highstock chart使用“Esc”取消缩放区域选择

时间:2015-07-13 23:15:21

标签: javascript highcharts

在图表上拖动鼠标但是没有释放鼠标后,有没有人知道如何取消缩放区域选择?

1 个答案:

答案 0 :(得分:2)

查看已连接的请求here

例如:http://jsfiddle.net/highcharts/72gA7/7/

段:

// Generic code to add zoom cancelling by hitting escape
Highcharts.Pointer.prototype.cancelDrag = function () {
    if (this.selectionMarker) {
        this.selectionMarker = this.selectionMarker.destroy();
    }
    this.drop();
};
$(document).keyup(function (e) {
    if (e.charCode == 27) { // esc
        $.each(Highcharts.charts, function () {
            this.pointer.cancelDrag();
        });
    } // esc
});