Merge branch 'ent-526-Las-graficas-estaticas-en-la-7-estan-mal' into 'develop'

Position watermark inside the static graphs

See merge request !284
This commit is contained in:
fermin 2017-03-21 13:07:52 +01:00
commit c1f00a63a4
3 changed files with 29 additions and 33 deletions

View File

@ -1773,10 +1773,12 @@ function graphic_combined_module ($module_list, $weight_list, $period,
}
*/
if($config["fixed_graph"] == false){
$water_mark = array(
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
}
$water_mark = array(
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
//Work around for fixed the agents name with huge size chars.

View File

@ -5962,7 +5962,7 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
false,
$width,
$height,
'<br>' . $label,
$label,
'',
false,
$only_avg,
@ -5987,7 +5987,7 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
false,
$width,
$height,
'<br>' . $label,
$label,
'',
false,
$only_avg,

View File

@ -749,6 +749,7 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
"GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE,
"Mode"=>SCALE_MODE_START0, "LabelRotation" => 60);
$margin_left = 40;
$margin_right = 0;
$margin_top = 10;
$margin_bottom = 3 * $max_chars;
break;
@ -757,24 +758,14 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
"CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "Pos"=>SCALE_POS_TOPBOTTOM,
"LabelValuesRotation" => 30);
$margin_left = $font_size * $max_chars;
$margin_right = 15;
$margin_top = 40;
$margin_bottom = 10;
break;
}
$water_mark_height = 0;
$water_mark_width = 0;
if (!empty($water_mark)) {
$size_water_mark = getimagesize($water_mark);
$water_mark_height = $size_water_mark[1];
$water_mark_width = $size_water_mark[0];
$myPicture->drawFromPNG(($width - $water_mark_width),
($height - $water_mark_height) - $margin_bottom, $water_mark);
}
/* Define the chart area */
$myPicture->setGraphArea($margin_left,$margin_top,$width - $water_mark_width,$height-$margin_bottom);
$myPicture->setGraphArea($margin_left, $margin_top, $width - $margin_right, $height - $margin_bottom);
$myPicture->drawScale($scaleSettings);
/*
@ -792,6 +783,15 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
$myPicture->drawBarChart($settings);
// Paint the water mark at the last moment to show it in front
if (!empty($water_mark)) {
$size_water_mark = getimagesize($water_mark);
$water_mark_width = $size_water_mark[0];
$myPicture->drawFromPNG(($width - $water_mark_width - $margin_right),
$margin_top, $water_mark);
}
/* Render the picture */
$myPicture->stroke();
}
@ -907,7 +907,7 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
}
/* Create the pChart object */
$myPicture = new pImage($width, $height, $MyData, $transparent,
$myPicture = new pImage($width, $height + $font_size, $MyData, $transparent,
$backgroundColor, $fontColor);
/* Turn of Antialiasing */
@ -920,6 +920,8 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$myPicture->setFontProperties(
array("FontName" =>$font, "FontSize" => $font_size));
// By default, set a top margin of 5 px
$top_margin = 5;
if (isset($legend)) {
/* Set horizontal legend if is posible */
$legend_mode = LEGEND_HORIZONTAL;
@ -930,6 +932,9 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>$legend_mode));
}
// Update the top margin to add the legend Height
$top_margin = $size['Height'];
/* Write the chart legend */
$myPicture->drawLegend($width - $size['Width'], 8,
array("Style" => LEGEND_NOBORDER, "Mode" => $legend_mode));
@ -948,7 +953,7 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$myPicture->drawFromPNG(
($width - $water_mark_width),
($height - $water_mark_height) - $margin_bottom,
$top_margin,
$water_mark);
}
@ -999,20 +1004,9 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$chart_size = $default_chart_size;
}
if (isset($size['Height'])) {
/* Define the chart area */
//if ($yaxisname != '') {
//}
$myPicture->setGraphArea($chart_size, $size['Height'],
($width - $water_mark_width),
($height - $margin_bottom));
}
else {
/* Define the chart area */
$myPicture->setGraphArea($chart_size, 5,
($width - $water_mark_width),
($height - $margin_bottom));
}
$myPicture->setGraphArea($chart_size, $top_margin,
$width,
($height - $margin_bottom));
/*Get minimun value to draw axis properly*/
$min_data = min(min($data));