- Fix for: If the moseout event on the row highlighting fails to get called (e.g. when having html code in the row), the toggle class will wrongly assign the hover class next time the element is being hovered over

- Better formatted PMA_createChart()
This commit is contained in:
Tyron Madlener 2011-06-16 15:05:08 +02:00
parent ab5d9b278a
commit f771e68a73

View File

@ -31,7 +31,6 @@ var codemirror_editor = false;
var chart_activeTimeouts = new Object();
/**
* Add a hidden field to the form to indicate that this will be an
* Ajax request (only if this hidden field does not exist)
@ -659,10 +658,10 @@ $(document).ready(function() {
* so that it works also for pages reached via AJAX)
*/
$(document).ready(function() {
$('tr.odd, tr.even').live('hover',function() {
$('tr.odd, tr.even').live('hover',function(event) {
var $tr = $(this);
$tr.toggleClass('hover');
$tr.children().toggleClass('hover');
$tr.toggleClass('hover',event.type=='mouseover');
$tr.children().toggleClass('hover',event.type=='mouseover');
});
})
@ -1411,31 +1410,41 @@ function PMA_createChart(passedSettings) {
events: {
load: function() {
var thisChart = this;
var lastValue=null, curValue=null;
var numLoadedPoints=0, otherSum=0;
var lastValue = null, curValue = null;
var numLoadedPoints = 0, otherSum = 0;
var diff;
// No realtime updates for graphs that are being exported, and disabled when no callback is set
if(thisChart.options.chart.forExport==true || !passedSettings.realtime || !passedSettings.realtime.callback) return;
if(thisChart.options.chart.forExport == true ||
! passedSettings.realtime ||
! passedSettings.realtime.callback) return;
thisChart.options.realtime.timeoutCallBack = function() {
$.get(passedSettings.realtime.url,{ajax_request:1, chart_data:1, type:passedSettings.realtime.type},function(data) {
curValue = jQuery.parseJSON(data);
//if(lastValue==null) lastValue = curValue;
if(lastValue==null) diff = curValue.x - thisChart.xAxis[0].getExtremes().max;
else diff = parseInt(curValue.x - lastValue.x);
thisChart.xAxis[0].setExtremes(thisChart.xAxis[0].getExtremes().min+diff, thisChart.xAxis[0].getExtremes().max+diff, false);
passedSettings.realtime.callback(thisChart,curValue,lastValue,numLoadedPoints);
lastValue = curValue;
numLoadedPoints++;
// Timeout has been cleared => don't start a new timeout
if(chart_activeTimeouts[container]==null) return;
chart_activeTimeouts[container] = setTimeout(thisChart.options.realtime.timeoutCallBack, thisChart.options.realtime.refreshRate);
$.post(passedSettings.realtime.url,
{ ajax_request: true, chart_data: 1, type: passedSettings.realtime.type },
function(data) {
curValue = jQuery.parseJSON(data);
if(lastValue==null) diff = curValue.x - thisChart.xAxis[0].getExtremes().max;
else diff = parseInt(curValue.x - lastValue.x);
thisChart.xAxis[0].setExtremes(
thisChart.xAxis[0].getExtremes().min+diff,
thisChart.xAxis[0].getExtremes().max+diff,
false
);
passedSettings.realtime.callback(thisChart,curValue,lastValue,numLoadedPoints);
lastValue = curValue;
numLoadedPoints++;
// Timeout has been cleared => don't start a new timeout
if(chart_activeTimeouts[container]==null) return;
chart_activeTimeouts[container] = setTimeout(
thisChart.options.realtime.timeoutCallBack,
thisChart.options.realtime.refreshRate
);
});
}
@ -1469,8 +1478,8 @@ function PMA_createChart(passedSettings) {
},
tooltip: {
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+
Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'<br/>'+
return '<b>' + this.series.name +'</b><br/>' +
Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '<br/>' +
Highcharts.numberFormat(this.y, 2);
}
},