diff --git a/js/server_status_monitor.js b/js/server_status_monitor.js index dff1a59362..b9b6f8b51e 100644 --- a/js/server_status_monitor.js +++ b/js/server_status_monitor.js @@ -1188,14 +1188,14 @@ $(function() { $('#gridchart' + runtime.chartAI).bind('jqplotMouseDown', function(ev, gridpos, datapos, neighbor, plot) { selectionTimeDiff.push(datapos.xaxis); $('#selection_box').remove(); - selectionBox = $('
').hide(); + selectionBox = $('
'); $(document.body).append(selectionBox); - selectionStartX = gridpos.x; - selectionStartY = gridpos.y; + selectionStartX = ev.pageX; + selectionStartY = ev.pageY; selectionBox .attr({id: 'selection_box'}) .css({ - top: selectionStartY, + top: selectionStartY-gridpos.y, left: selectionStartX }) .fadeIn(); @@ -1204,22 +1204,26 @@ $(function() { $('#gridchart' + runtime.chartAI).bind('jqplotMouseUp', function(ev, gridpos, datapos, neighbor, plot) { selectionTimeDiff.push(datapos.xaxis); //get date from timestamp - alert(new Date(Math.ceil(selectionTimeDiff[0])) + " \n to \n " + new Date(Math.ceil(selectionTimeDiff[1]))); + //alert(new Date(Math.ceil(selectionTimeDiff[0])) + " \n to \n " + new Date(Math.ceil(selectionTimeDiff[1]))); selectionTimeDiff = []; $('#selection_box').attr({ id: '' }); + selectionBox.remove(); }); $('#gridchart' + runtime.chartAI).bind('jqplotMouseMove', function(ev, gridpos, datapos, neighbor, plot) { if (selectionStartX != undefined) { $('#selection_box') .css({ - width: Math.abs(gridpos.x - selectionStartX), - height: Math.abs(gridpos.y - selectionStartY), + width: Math.abs(ev.pageX - selectionStartX) }) .fadeIn(); } }); + $(document.body).mouseup(function() { + selectionBox.remove(); + }); + // Edit, Print icon only in edit mode $('table#chartGrid div svg').find('*[zIndex=20], *[zIndex=21], *[zIndex=19]').toggle(editMode)