diff --git a/js/pMap.js b/js/pMap.js index fc3f73849..bfcd4d235 100644 --- a/js/pMap.js +++ b/js/pMap.js @@ -23,6 +23,12 @@ var imageMap = { 'mouseMoved': function(event, cont) { + // return if no imageMap set + // this can happen if server has no json + if (!this.imageMap) { + return; + } + // get mouse coordinated relative to image var mouseX = event.pageX - cont.offsetLeft; var mouseY = event.pageY - cont.offsetTop; diff --git a/libraries/chart.lib.php b/libraries/chart.lib.php index 3939e552e..b8213f2ad 100644 --- a/libraries/chart.lib.php +++ b/libraries/chart.lib.php @@ -1,7 +1,7 @@ toString(); $chartSettings = $chart->getSettings(); - $chartErrors = array_merge($chartErrors, $chart->getErrors()); + $chartErrors = $chart->getErrors(); PMA_handle_chart_err($chartErrors); return $chartCode; @@ -241,6 +240,9 @@ function PMA_handle_chart_err($errors) if (in_array(ERR_NO_GD, $errors)) { PMA_warnMissingExtension('GD', false, 'GD extension is needed for charts.'); } + else if (in_array(ERR_NO_JSON, $errors)) { + PMA_warnMissingExtension('JSON', false, 'JSON encoder is needed for chart tooltips.'); + } } ?> diff --git a/libraries/chart/pChart/pChart.class b/libraries/chart/pChart/pChart.class index eb2bc4693..2b5a07721 100644 --- a/libraries/chart/pChart/pChart.class +++ b/libraries/chart/pChart/pChart.class @@ -3495,7 +3495,7 @@ /* Get the current image map */ function getImageMap() { - return json_encode($this->ImageMap); + return $this->ImageMap; } /* Load and cleanup the image map from disk */ @@ -3544,7 +3544,7 @@ } else { - fwrite($Handle, $this->getImageMap()); + fwrite($Handle, serialize($this->getImageMap())); } fclose ($Handle); } diff --git a/libraries/chart/pma_pchart_chart.php b/libraries/chart/pma_pchart_chart.php index 97af13604..bcca2ac28 100644 --- a/libraries/chart/pma_pchart_chart.php +++ b/libraries/chart/pma_pchart_chart.php @@ -171,37 +171,42 @@ abstract class PMA_pChart_Chart extends PMA_Chart public function toString() { - if (function_exists('gd_info')) { - $this->init(); - $this->prepareDataSet(); - $this->prepareChart(); - - //$this->chart->debugImageMap(); - - if ($this->isContinuous()) { - $this->render(1); - } - else { - $this->render(20); - } - - $returnData = '