Try to fix false positive with dolgraph

This commit is contained in:
Laurent Destailleur 2013-09-10 16:12:20 +02:00
parent 21602b34a9
commit f195d59c9c

View File

@ -895,20 +895,20 @@ class DolGraph
$this->_stringtoshow.='\''; $this->_stringtoshow.='\'';
if ($urltemp) $this->_stringtoshow.='</a>'; if ($urltemp) $this->_stringtoshow.='</a>';
$this->_stringtoshow.='</div>\'; $this->_stringtoshow.='</div>\';
}, },
background: { background: {
opacity: 0.5, opacity: 0.5,
color: \'#000000\' color: \'#000000\'
} }
} }
} }
}, },
zoom: { zoom: {
interactive: true interactive: true
}, },
pan: { pan: {
interactive: true interactive: true
},'; },';
if (count($datacolor)) if (count($datacolor))
{ {
$this->_stringtoshow.='colors: '.(! empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor)).','; $this->_stringtoshow.='colors: '.(! empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor)).',';
@ -923,47 +923,46 @@ class DolGraph
// Add code to support tooltips // Add code to support tooltips
$this->_stringtoshow.=' $this->_stringtoshow.='
function showTooltip_'.$tag.'(x, y, contents) { function showTooltip_'.$tag.'(x, y, contents) {
$(\'<div id="tooltip_'.$tag.'">\' + contents + \'</div>\').css({ $(\'<div id="tooltip_'.$tag.'">\' + contents + \'</div>\').css({
position: \'absolute\', position: \'absolute\',
display: \'none\', display: \'none\',
top: y + 5, top: y + 5,
left: x + 5, left: x + 5,
border: \'1px solid #ddd\', border: \'1px solid #ddd\',
padding: \'2px\', padding: \'2px\',
\'background-color\': \'#ffe\', \'background-color\': \'#ffe\',
width: 200, width: 200,
opacity: 0.80 opacity: 0.80
}).appendTo("body").fadeIn(20); }).appendTo("body").fadeIn(20);
} }
var previousPoint = null; var previousPoint = null;
$("#placeholder_'.$tag.'").bind("plothover", function (event, pos, item) { $("#placeholder_'.$tag.'").bind("plothover", function (event, pos, item) {
$("#x").text(pos.x.toFixed(2)); $("#x").text(pos.x.toFixed(2));
$("#y").text(pos.y.toFixed(2)); $("#y").text(pos.y.toFixed(2));
if (item) { if (item) {
if (previousPoint != item.dataIndex) { if (previousPoint != item.dataIndex) {
previousPoint = item.dataIndex; previousPoint = item.dataIndex;
$("#tooltip").remove(); $("#tooltip").remove();
/* console.log(item); */ /* console.log(item); */
var x = item.datapoint[0].toFixed(2); var x = item.datapoint[0].toFixed(2);
var y = item.datapoint[1].toFixed(2); var y = item.datapoint[1].toFixed(2);
var z = item.series.xaxis.ticks[item.dataIndex].label; var z = item.series.xaxis.ticks[item.dataIndex].label;
'; ';
if ($this->showpointvalue > 0) $this->_stringtoshow.=' if ($this->showpointvalue > 0) $this->_stringtoshow.='
showTooltip_'.$tag.'(item.pageX, item.pageY, showTooltip_'.$tag.'(item.pageX, item.pageY, item.series.label + "<br>" + z + " => " + y);
item.series.label + "<br>" + z + " => " + y); ';
$this->_stringtoshow.='
}
}
else {
$("#tooltip_'.$tag.'").remove();
previousPoint = null;
}
});
'; ';
$this->_stringtoshow.='
}
}
else {
$("#tooltip_'.$tag.'").remove();
previousPoint = null;
}
});
';
$this->_stringtoshow.='var stack = null, steps = false;'."\n"; $this->_stringtoshow.='var stack = null, steps = false;'."\n";
@ -1039,6 +1038,7 @@ class DolGraph
if ($direction == 'height') return ($conf->dol_optimize_smallscreen?'160':($defaultsize?$defaultsize:'200')); if ($direction == 'height') return ($conf->dol_optimize_smallscreen?'160':($defaultsize?$defaultsize:'200'));
return 0; return 0;
} }
} }
?> ?>