2012-03-22 Sergio Martin <sergio.martin@artica.es>
* include/graphs/functions_pchart.php: Added calculation of the left side of the graph space. Merged from 4.0 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5821 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
011b44a072
commit
fc07ea169a
|
@ -1,3 +1,8 @@
|
|||
2012-03-22 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/graphs/functions_pchart.php: Added calculation
|
||||
of the left side of the graph space. Merged from 4.0
|
||||
|
||||
2012-03-22 Vanessa Gil <vanessa.gil@artica.es>
|
||||
|
||||
* pandoradb.sql
|
||||
|
|
|
@ -705,9 +705,35 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
|
|||
($height - $water_mark_height) - $margin_bottom, $water_mark);
|
||||
}
|
||||
|
||||
// Get the max number of scale
|
||||
$max_all = 0;
|
||||
foreach($data as $serie) {
|
||||
$max_this_serie = max($serie);
|
||||
if($max_this_serie > $max_all) {
|
||||
$max_all = $max_this_serie;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the number of digits of the scale
|
||||
$digits_left = 0;
|
||||
while($max_all > 1) {
|
||||
$digits_left ++;
|
||||
$max_all /= 10;
|
||||
}
|
||||
|
||||
// If the number is less than 1 we count the decimals
|
||||
if($digits_left == 0){
|
||||
while($max_all < 1) {
|
||||
$digits_left ++;
|
||||
$max_all *= 10;
|
||||
}
|
||||
}
|
||||
|
||||
$chart_size = ($digits_left * $font_size) + 20;
|
||||
|
||||
/* Area depends on yaxisname */
|
||||
if ($yaxisname != ''){
|
||||
$chart_size = 80;
|
||||
$chart_size += 40;
|
||||
}
|
||||
else{
|
||||
$chart_size = 40;
|
||||
|
|
Loading…
Reference in New Issue