From 01d5a76ca992bb521530a804ef358c3ec3e5094c Mon Sep 17 00:00:00 2001 From: Ammar Yasir Date: Fri, 19 Aug 2011 09:13:01 +0530 Subject: [PATCH] Added "Reset Zoom" link that reverts the plot to original display. --- js/tbl_zoom_plot.js | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/js/tbl_zoom_plot.js b/js/tbl_zoom_plot.js index cb40e11584..e773175d7a 100644 --- a/js/tbl_zoom_plot.js +++ b/js/tbl_zoom_plot.js @@ -495,12 +495,23 @@ $(document).ready(function() { title: { text: 'Query Results' }, xAxis: { title: { text: $('#tableid_0').val() }, + events: { + setExtremes: function(e){ + this.resetZoom.show(); + } + } + }, yAxis: { min: null, title: { text: $('#tableid_1').val() }, endOnTick: false, - startOnTick: false + startOnTick: false, + events: { + setExtremes: function(e){ + this.resetZoom.show(); + } + } }, } @@ -678,7 +689,20 @@ $(document).ready(function() { setZoom(); } }); + //Add reset zoom feature + currentChart.yAxis[0].resetZoom = currentChart.xAxis[0].resetZoom = $('Reset zoom') + .appendTo(currentChart.container) + .css({ + position: 'absolute', + top: 10, + right: 20, + display: 'none' + }) + .click(function(){ + currentChart.xAxis[0].setExtremes(null, null) + currentChart.yAxis[0].setExtremes(null, null) + this.style.display = 'none' + }); scrollToChart(); - } });