Merge branch '1177-Graficas_con_valores_negativos_rev2' into 'develop'

fixed error values negatives in reports pdf

See merge request !769
This commit is contained in:
slerena 2017-08-31 18:16:26 +02:00
commit 601db73596
1 changed files with 12 additions and 3 deletions

View File

@ -961,8 +961,18 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$chart_size = ($digits_left * $font_size) + 20; $chart_size = ($digits_left * $font_size) + 20;
$max_data = max(max($data)); $min_data = 0;
$max_data = 0;
foreach ($data as $k => $v) {
if(min($v) < $min_data){
$min_data = min($v);
}
if(max($v) > $max_data){
$max_data = max($v);
}
}
$default_chart_size = 40; $default_chart_size = 40;
$rest_chars = strlen($max_data) - 6; $rest_chars = strlen($max_data) - 6;
$default_chart_size += $rest_chars * 5; $default_chart_size += $rest_chars * 5;
@ -982,7 +992,6 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
/*Get minimun value to draw axis properly*/ /*Get minimun value to draw axis properly*/
$min_data = min(min($data));
$ManualScale = array(); $ManualScale = array();
$mode = SCALE_MODE_START0; $mode = SCALE_MODE_START0;
if ($min_data < 0) { if ($min_data < 0) {