From 7c2f1e1f3ad9efb66c2c6f2f76307ca019f5c9b1 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 29 Jul 2012 06:23:55 -0400 Subject: [PATCH 01/42] Testing DateAxisRenderer --- js/server_status.js | 66 +++++++++++++++++++++++++++++++++++++++++++++ server_status.php | 6 +++++ 2 files changed, 72 insertions(+) diff --git a/js/server_status.js b/js/server_status.js index 438ed416c5..7619fb6ef5 100644 --- a/js/server_status.js +++ b/js/server_status.js @@ -332,6 +332,7 @@ $(function() { var settings = null; if (tabStatus[$tab.attr('id')] == 'static') { + /* settings = { series: [ { name: PMA_messages['strChartIssuedQueries'], data: [] } ], title: { text: PMA_messages['strChartIssuedQueriesTitle'] }, @@ -352,6 +353,31 @@ $(function() { error: function() { serverResponseError(); } } }; + */ + settings = { + title: PMA_messages['strChartIssuedQueriesTitle'], + axes: { + xaxis: { + label: PMA_messages['strChartIssuedQueries'], + labelRenderer: $.jqplot.CanvasAxisLabelRenderer, + renderer: $.jqplot.DateAxisRenderer, + tickInterval: 300000, + //min: '2008-06-30 08:00:00', + //min: '2012-06-07 12:00:00', + //min: '1970-01-01 12:00:00', + tickOptions: { + formatString: '%Y-%m-%d %H:%M:%S' + } + } + } + }; + $tab.find('.tabInnerContent') + .hide() + .after('
'); + //currentChart = $.jqplot($tab.attr('id') + '_chart_cnt', [[null]], settings); + currentChart = $.jqplot($tab.attr('id') + '_chart_cnt', [[['2008-06-30 08:00:00',4], ['2008-06-30 08:00:05',6.5], ['2008-06-30 08:00:10',5.7], ['2008-06-30 08:00:15',9], ['2008-06-30 08:00:20',8.2]]], settings); + recursiveTimer(); + } else { $(this).html(PMA_messages['strLiveQueryChart']); } @@ -361,6 +387,46 @@ $(function() { return false; }); + var t; + var currentChart; + var series = new Array(); + series[0] = new Array(); + + function recursiveTimer() { + ajaxGetStatus(); + t = setTimeout(function() { + recursiveTimer() }, 5000); + } + + function ajaxGetStatus() { + var ret = null; + $.ajax({ + async: false, + url: 'server_status.php', + type: 'post', + data: { + 'token' : window.parent.token, + 'ajax_request' : true, + 'chart_data' : true, + 'type' : 'queries' + }, + dataType: 'json', + success: function(data) { + ret = data; + } + }); + + series[0].push([ + //ret.x, + new Date().getTime(), + //getDateFromFormat('1970-01-01 12:15:00', 'yyyy-MM-dd HH:mm:ss'), + //-344401659000, + ret.y + ]); + currentChart.series[0].data = series[0]; + currentChart.replot(); + }; + function setupLiveChart($tab, link, settings) { if (settings != null) { // Loading a chart with existing chart => remove old chart first diff --git a/server_status.php b/server_status.php index 58b11031df..67b6dab368 100644 --- a/server_status.php +++ b/server_status.php @@ -433,6 +433,12 @@ $GLOBALS['js_include'][] = 'canvg/canvg.js'; // for profiling chart $GLOBALS['js_include'][] = 'jqplot/jquery.jqplot.js'; $GLOBALS['js_include'][] = 'jqplot/plugins/jqplot.pieRenderer.js'; +$GLOBALS['js_include'][] = 'jqplot/plugins/jqplot.canvasTextRenderer.js'; +$GLOBALS['js_include'][] = 'jqplot/plugins/jqplot.canvasAxisLabelRenderer.js'; +$GLOBALS['js_include'][] = 'jqplot/plugins/jqplot.dateAxisRenderer.js'; +$GLOBALS['js_include'][] = 'jqplot/plugins/jqplot.highlighter.js'; +$GLOBALS['js_include'][] = 'jqplot/plugins/jqplot.cursor.js'; +$GLOBALS['js_include'][] = 'date.js'; /** * flush status variables if requested From f9cf1d1f70401cb908f51dc1cd27dd19f1237864 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 29 Jul 2012 06:57:36 -0400 Subject: [PATCH 02/42] Upgrade to jqplot 1.0.2 --- js/jqplot/jquery.jqplot.js | 607 ++++++++++++++---- .../plugins/jqplot.canvasAxisLabelRenderer.js | 3 +- .../plugins/jqplot.canvasTextRenderer.js | 3 +- js/jqplot/plugins/jqplot.cursor.js | 33 +- js/jqplot/plugins/jqplot.dateAxisRenderer.js | 37 +- js/jqplot/plugins/jqplot.highlighter.js | 13 +- js/jqplot/plugins/jqplot.pieRenderer.js | 7 +- 7 files changed, 580 insertions(+), 123 deletions(-) diff --git a/js/jqplot/jquery.jqplot.js b/js/jqplot/jquery.jqplot.js index 3c620f2e3e..3e767e8643 100644 --- a/js/jqplot/jquery.jqplot.js +++ b/js/jqplot/jquery.jqplot.js @@ -5,7 +5,8 @@ * * About: Version * - * 1.0.0b2_r1012 + * version: 1.0.2 + * revision: 1108 * * About: Copyright & License * @@ -89,11 +90,11 @@ for ( var i = 0, elem; (elem = $(this)[i]) != null; i++ ) { // Remove element nodes and prevent memory leaks if ( elem.nodeType === 1 ) { - jQuery.cleanData( elem.getElementsByTagName("*") ); + $.cleanData( elem.getElementsByTagName("*") ); } // Remove any remaining nodes - if ($.jqplot_use_excanvas) { + if ($.jqplot.use_excanvas) { elem.outerHTML = ""; } else { @@ -115,6 +116,56 @@ } }; + $.fn.jqplot = function() { + var datas = []; + var options = []; + // see how many data arrays we have + for (var i=0, l=arguments.length; i