diff --git a/js/tbl_zoom_plot.js b/js/tbl_zoom_plot.js index 2e3fd40791..ae2143201d 100644 --- a/js/tbl_zoom_plot.js +++ b/js/tbl_zoom_plot.js @@ -7,23 +7,42 @@ **/ +/** + ** Display Help/Info + **/ function displayHelp() { var msgbox = PMA_ajaxShowMessage(PMA_messages['strDisplayHelp']); } +/** + ** Extend the array object for max function + ** @param array + **/ Array.max = function (array) { return Math.max.apply( Math, array ); } +/** + ** Extend the array object for min function + ** @param array + **/ Array.min = function (array) { return Math.min.apply( Math, array ); } + +/** + ** Scrolls the view to the display section + **/ function scrollToChart() { var x = $('#dataDisplay').offset().top - 100; // 100 provides buffer in viewport $('html,body').animate({scrollTop: x}, 500); } +/** + ** Displays the query result display section + ** @param modal: type of dialog + **/ function ShowDialog(modal) { $("#overlay").show(); $("#dialog").fadeIn(300); @@ -31,8 +50,12 @@ function ShowDialog(modal) { { HideDialog(); }); - } +} +/** + ** Hides the query result display section + ** @param modal : type of dialog + **/ function HideDialog() { $("#overlay").hide(); $("#dialog").fadeOut(300); @@ -49,9 +72,9 @@ $(document).ready(function() { cache: 'false' }); - var cursorMode = ($("input[name='mode']:checked").val() == 'edit') ? 'crosshair' : 'pointer'; var currentChart=null; + /** ** Form submit on field change **/ @@ -71,6 +94,9 @@ $(document).ready(function() { $('#zoom_search_form').submit(); }) + /** + ** Change mouse pointer on change of mode + */ $("input[name='mode']").change(function(){ if($("input[name='mode']:checked").val() == 'edit'){ currentSettings.plotOptions.series.cursor = 'crosshair'; @@ -84,27 +110,29 @@ $(document).ready(function() { } }); - /* - * Edit point data submit - */ - - $('#buttonID').live('click',function(event){ - - $search_form = $('#zoom_search_form'); - event.preventDefault(); - alert('Working on it!'); - //PMA_prepareForAjaxRequest($search_form); - //var str = $search_form.serialize(); - //$.post($search_form.attr('action'), str, function(response){ - // $('#sqlqueryresults').html(response); - // $("#sqlqueryresults").trigger('appendAnchor'); - - - //}); - - - }); + /** + ** Prepare a div containing a link, otherwise it's incorrectly displayed + ** after a couple of clicks + **/ + $('
') + .insertAfter('#zoom_search_form') + // don't show it until we have results on-screen + .hide(); + $('#togglesearchformlink') + .html(PMA_messages['strShowSearchCriteria']) + .bind('click', function() { + var $link = $(this); + $('#zoom_search_form').slideToggle(); + if ($link.text() == PMA_messages['strHideSearchCriteria']) { + $link.text(PMA_messages['strShowSearchCriteria']); + } else { + $link.text(PMA_messages['strHideSearchCriteria']); + } + // avoid default click action + return false; + }); + /* * Generate plot using Highcharts */ @@ -112,8 +140,17 @@ $(document).ready(function() { // Get query result var data = jQuery.parseJSON($('#querydata').html()); if (data != null) { - ShowDialog(false); - $('#resizer').height($('#dataDisplay').height() + 49); + + $('#zoom_search_form') + .slideToggle() + .hide(); + $('#togglesearchformlink') + .text(PMA_messages['strShowSearchCriteria']) + $('#togglesearchformdiv').show(); + + ShowDialog(false); + $('#resizer').height($('#dataDisplay').height() + 49); + var xLabel = $('#tableid_0').val(); var yLabel = $('#tableid_1').val(); @@ -129,6 +166,7 @@ $(document).ready(function() { // Get column names for (key in data[0]) columnNames.push(key); + // Form series $.each(data,function(key,value) { series[it] = new Object(); series[it].data = new Array(); @@ -142,6 +180,7 @@ $(document).ready(function() { it++; }); + // Set the plot settings var currentSettings = { chart: { renderTo: 'querychart', @@ -207,6 +246,7 @@ $(document).ready(function() { }); currentChart = PMA_createChart(currentSettings); + scrollToChart(); } }); diff --git a/tbl_zoom_select.php b/tbl_zoom_select.php index 57ec266027..4f10b2c83f 100644 --- a/tbl_zoom_select.php +++ b/tbl_zoom_select.php @@ -18,7 +18,6 @@ require_once './libraries/relation.lib.php'; $GLOBALS['js_include'][] = 'makegrid.js'; $GLOBALS['js_include'][] = 'sql.js'; $GLOBALS['js_include'][] = 'functions.js'; -$GLOBALS['js_include'][] = 'tbl_select.js'; $GLOBALS['js_include'][] = 'tbl_zoom_plot.js'; $GLOBALS['js_include'][] = 'highcharts/highcharts.js'; /* Files required for chart exporting */ @@ -30,11 +29,10 @@ $GLOBALS['js_include'][] = 'jquery/timepicker.js'; $titles['Browse'] = PMA_tbl_setTitle($GLOBALS['cfg']['PropertiesIconic'], $pmaThemeImage); - /** * Not selection yet required -> displays the selection form */ - + // Gets some core libraries require_once './libraries/tbl_common.php'; //$err_url = 'tbl_select.php' . $err_url; @@ -75,12 +73,11 @@ $titles['Browse'] = PMA_tbl_setTitle($GLOBALS['cfg']['PropertiesIconic'], $pmaTh $url_params = array(); $url_params['db'] = $db; $url_params['table'] = $table; - echo PMA_generate_html_tabs(PMA_tbl_getSubTabs(), $url_params); -?> - - -if(isset($zoom_submit) && $inputs[0] != __('pma_null') && $inputs[1] != __('pma_null')) { + $inputs[0], 'yLabel' => $inputs[1], 'dataLabel' => $dataLabel); - $result = PMA_DBI_query( $sql_query . ";" , null, PMA_DBI_QUERY_STORE); - while ($row = PMA_DBI_fetch_assoc($result)) { - $data[] = $row; - } - $query_data = $data; - //$scatter_plot = PMA_SVG_scatter_plot($data,$settings); -} ?>
> - + /> @@ -275,10 +236,15 @@ for($i = 0 ; $i < 4 ; $i++){ +
         - + - -
- + + + + +
> + + + + +
+ +
+ + +
- - - - -