added JS tooltips to the bar and line charts. Other types generate warnings for now.
This commit is contained in:
1491
js/overlib.js
Normal file
1491
js/overlib.js
Normal file
File diff suppressed because it is too large
Load Diff
70
js/pMap.js
Normal file
70
js/pMap.js
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
pMap - a JavaScript to add image map support to pChart graphs!
|
||||
Copyright (C) 2008 Jean-Damien POGOLOTTI
|
||||
Version 1.1 last updated on 08/20/08
|
||||
|
||||
http://pchart.sourceforge.net
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 1,2,3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
var pMap_IE = document.all?true:false;
|
||||
var pMap_ImageMap = new Array();
|
||||
var pMap_ImageID = "";
|
||||
var pMap_MouseX = 0;
|
||||
var pMap_MouseY = 0;
|
||||
var pMap_CurrentMap = -1;
|
||||
var pMap_URL = "";
|
||||
var pMap_Tries = 0;
|
||||
var pMap_MaxTries = 5;
|
||||
var pMap_HTTP_Timeout = 1000;
|
||||
var pMap_MUTEX = false;
|
||||
var pMap_MUTEX_Timeout = 100;
|
||||
|
||||
if (!pMap_IE) { document.captureEvents(Event.MOUSEMOVE); }
|
||||
|
||||
function getMousePosition(e)
|
||||
{
|
||||
/* Protect against event storm */
|
||||
if (pMap_MUTEX) { return(0);}
|
||||
pMap_MUTEX = true;
|
||||
setTimeout("pMap_MUTEX=false",pMap_MUTEX_Timeout);
|
||||
|
||||
/* Determine mouse position over the chart */
|
||||
if (pMap_IE)
|
||||
{ pMap_MouseX = event.clientX + document.body.scrollLeft; pMap_MouseY = event.clientY + document.body.scrollTop; }
|
||||
else
|
||||
{ pMap_MouseX = e.pageX; pMap_MouseY = e.pageY; }
|
||||
pMap_MouseX -= document.getElementById(pMap_ImageID).offsetLeft;
|
||||
pMap_MouseY -= document.getElementById(pMap_ImageID).offsetTop;
|
||||
|
||||
/* Check if we are flying over a map zone */
|
||||
Found = false;
|
||||
for (Map in pMap_ImageMap)
|
||||
{
|
||||
Values = pMap_ImageMap[Map].split(",");
|
||||
if ( pMap_MouseX>=Values[0] && pMap_MouseX<=Values[2])
|
||||
{
|
||||
if ( pMap_MouseY>=Values[1] && pMap_MouseY<=Values[3] )
|
||||
{
|
||||
Found = true;
|
||||
if ( pMap_CurrentMap != Map )
|
||||
{ overlib(Values[5], CAPTION, Values[4], WIDTH, 80); pMap_CurrentMap = Map; }
|
||||
}
|
||||
}
|
||||
if ( !Found && pMap_CurrentMap != -1 ) { nd(); pMap_CurrentMap = -1; }
|
||||
}
|
||||
}
|
||||
|
||||
function LoadImageMap(ID, map) { pMap_ImageID = ID, pMap_ImageMap = map.split("-"); }
|
@@ -60,6 +60,8 @@ abstract class PMA_pChart_Chart extends PMA_Chart
|
||||
}
|
||||
|
||||
$this->chart->setFontProperties($this->getFontPath().'tahoma.ttf', 8);
|
||||
|
||||
$this->chart->setImageMap(true, 'mapid');
|
||||
}
|
||||
|
||||
abstract protected function prepareDataSet();
|
||||
@@ -132,7 +134,14 @@ abstract class PMA_pChart_Chart extends PMA_Chart
|
||||
$this->prepareChart();
|
||||
$this->render();
|
||||
|
||||
return '<img id="chart" src="data:image/png;base64,'.$this->imageEncoded.'" />';
|
||||
$returnData = '<img id="chart" src="data:image/png;base64,'.$this->imageEncoded.'" OnMouseMove="getMousePosition(event);" OnMouseOut="nd();"/>';
|
||||
$returnData .= '
|
||||
<script type="text/javascript">
|
||||
LoadImageMap("chart", "'.implode("-", $this->getImageMap()).'");
|
||||
</script>
|
||||
';
|
||||
|
||||
return $returnData;
|
||||
}
|
||||
else {
|
||||
array_push($this->errors, ERR_NO_GD);
|
||||
@@ -164,6 +173,11 @@ abstract class PMA_pChart_Chart extends PMA_Chart
|
||||
{
|
||||
return $this->settings['scale'];
|
||||
}
|
||||
|
||||
protected function getImageMap()
|
||||
{
|
||||
return $this->chart->ImageMap;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -20,6 +20,9 @@ if (! defined('PMA_NO_VARIABLES_IMPORT')) {
|
||||
*/
|
||||
require_once './libraries/common.inc.php';
|
||||
|
||||
$GLOBALS['js_include'][] = 'overlib.js';
|
||||
$GLOBALS['js_include'][] = 'pMap.js';
|
||||
|
||||
/**
|
||||
* Runs common work
|
||||
*/
|
||||
|
Reference in New Issue
Block a user