diff --git a/js/pMap.js b/js/pMap.js index a40dee9e4..fbcd817b8 100644 --- a/js/pMap.js +++ b/js/pMap.js @@ -89,11 +89,17 @@ var imageMap = { }, 'loadImageMap': function(map) { - imageMap.imageMap = JSON.parse(map); + this.imageMap = JSON.parse(map); + for (key in this.imageMap) + { + // FIXME + // without this loop image map does not work + // on IE8 in the status page + } }, 'init': function() { - $("img#chart").bind('mousemove',function(e) { + $("div#chart").bind('mousemove',function(e) { imageMap.mouseMoved(e, this); }); diff --git a/libraries/chart/pma_pchart_chart.php b/libraries/chart/pma_pchart_chart.php index dfba08169..87ca65f70 100644 --- a/libraries/chart/pma_pchart_chart.php +++ b/libraries/chart/pma_pchart_chart.php @@ -21,7 +21,7 @@ abstract class PMA_pChart_Chart extends PMA_Chart protected $dataSet; protected $chart; - protected $imageEncoded; + protected $partsEncoded = array(); public function __construct($data, $options = null) { @@ -116,14 +116,32 @@ abstract class PMA_pChart_Chart extends PMA_Chart protected abstract function drawChart(); - protected function render() + protected function render($parts = 1) { - ob_start(); - imagepng($this->chart->Picture); - $output = ob_get_contents(); - ob_end_clean(); + $fullWidth = 0; - $this->imageEncoded = base64_encode($output); + for ($i = 0; $i < $parts; $i++) { + $partHeight = $this->chart->YSize; + $partWidth = round($this->chart->XSize / $parts); + $fullWidth += $partWidth; + $partX = $partWidth * $i; + + if ($i == $parts - 1) { + // compensate for the rounding errors in the last part + $partWidth += $this->chart->XSize - $fullWidth; + } + + $part = imagecreatetruecolor($partWidth, $partHeight); + imagecopy($part, $this->chart->Picture, 0, 0, $partX, 0, $partWidth, $partHeight); + + ob_start(); + imagepng($part, NULL, 9, PNG_ALL_FILTERS); + $output = ob_get_contents(); + ob_end_clean(); + + $partEncoded = base64_encode($output); + $this->partsEncoded[$i] = $partEncoded; + } } public function toString() @@ -132,9 +150,13 @@ abstract class PMA_pChart_Chart extends PMA_Chart $this->init(); $this->prepareDataSet(); $this->prepareChart(); - $this->render(); + $this->render(20); - $returnData = ''; + $returnData = '
'; + foreach ($this->partsEncoded as $part) { + $returnData .= ''; + } + $returnData .= '
'; $returnData .= '