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:
commit
c1f00a63a4
|
@ -1773,10 +1773,12 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if($config["fixed_graph"] == false){
|
||||||
$water_mark = array(
|
$water_mark = array(
|
||||||
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
||||||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Work around for fixed the agents name with huge size chars.
|
//Work around for fixed the agents name with huge size chars.
|
||||||
|
|
|
@ -5962,7 +5962,7 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
|
||||||
false,
|
false,
|
||||||
$width,
|
$width,
|
||||||
$height,
|
$height,
|
||||||
'<br>' . $label,
|
$label,
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
$only_avg,
|
$only_avg,
|
||||||
|
@ -5987,7 +5987,7 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
|
||||||
false,
|
false,
|
||||||
$width,
|
$width,
|
||||||
$height,
|
$height,
|
||||||
'<br>' . $label,
|
$label,
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
$only_avg,
|
$only_avg,
|
||||||
|
|
|
@ -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,
|
"GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE,
|
||||||
"Mode"=>SCALE_MODE_START0, "LabelRotation" => 60);
|
"Mode"=>SCALE_MODE_START0, "LabelRotation" => 60);
|
||||||
$margin_left = 40;
|
$margin_left = 40;
|
||||||
|
$margin_right = 0;
|
||||||
$margin_top = 10;
|
$margin_top = 10;
|
||||||
$margin_bottom = 3 * $max_chars;
|
$margin_bottom = 3 * $max_chars;
|
||||||
break;
|
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,
|
"CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "Pos"=>SCALE_POS_TOPBOTTOM,
|
||||||
"LabelValuesRotation" => 30);
|
"LabelValuesRotation" => 30);
|
||||||
$margin_left = $font_size * $max_chars;
|
$margin_left = $font_size * $max_chars;
|
||||||
|
$margin_right = 15;
|
||||||
$margin_top = 40;
|
$margin_top = 40;
|
||||||
$margin_bottom = 10;
|
$margin_bottom = 10;
|
||||||
break;
|
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 */
|
/* 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);
|
$myPicture->drawScale($scaleSettings);
|
||||||
/*
|
/*
|
||||||
|
@ -792,6 +783,15 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
|
||||||
|
|
||||||
$myPicture->drawBarChart($settings);
|
$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 */
|
/* Render the picture */
|
||||||
$myPicture->stroke();
|
$myPicture->stroke();
|
||||||
}
|
}
|
||||||
|
@ -907,7 +907,7 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
|
||||||
|
|
||||||
}
|
}
|
||||||
/* Create the pChart object */
|
/* Create the pChart object */
|
||||||
$myPicture = new pImage($width, $height, $MyData, $transparent,
|
$myPicture = new pImage($width, $height + $font_size, $MyData, $transparent,
|
||||||
$backgroundColor, $fontColor);
|
$backgroundColor, $fontColor);
|
||||||
|
|
||||||
/* Turn of Antialiasing */
|
/* Turn of Antialiasing */
|
||||||
|
@ -920,6 +920,8 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
|
||||||
$myPicture->setFontProperties(
|
$myPicture->setFontProperties(
|
||||||
array("FontName" =>$font, "FontSize" => $font_size));
|
array("FontName" =>$font, "FontSize" => $font_size));
|
||||||
|
|
||||||
|
// By default, set a top margin of 5 px
|
||||||
|
$top_margin = 5;
|
||||||
if (isset($legend)) {
|
if (isset($legend)) {
|
||||||
/* Set horizontal legend if is posible */
|
/* Set horizontal legend if is posible */
|
||||||
$legend_mode = LEGEND_HORIZONTAL;
|
$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));
|
$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 */
|
/* Write the chart legend */
|
||||||
$myPicture->drawLegend($width - $size['Width'], 8,
|
$myPicture->drawLegend($width - $size['Width'], 8,
|
||||||
array("Style" => LEGEND_NOBORDER, "Mode" => $legend_mode));
|
array("Style" => LEGEND_NOBORDER, "Mode" => $legend_mode));
|
||||||
|
@ -948,7 +953,7 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
|
||||||
|
|
||||||
$myPicture->drawFromPNG(
|
$myPicture->drawFromPNG(
|
||||||
($width - $water_mark_width),
|
($width - $water_mark_width),
|
||||||
($height - $water_mark_height) - $margin_bottom,
|
$top_margin,
|
||||||
$water_mark);
|
$water_mark);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -999,20 +1004,9 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
|
||||||
$chart_size = $default_chart_size;
|
$chart_size = $default_chart_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($size['Height'])) {
|
$myPicture->setGraphArea($chart_size, $top_margin,
|
||||||
/* Define the chart area */
|
$width,
|
||||||
//if ($yaxisname != '') {
|
|
||||||
//}
|
|
||||||
$myPicture->setGraphArea($chart_size, $size['Height'],
|
|
||||||
($width - $water_mark_width),
|
|
||||||
($height - $margin_bottom));
|
($height - $margin_bottom));
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* Define the chart area */
|
|
||||||
$myPicture->setGraphArea($chart_size, 5,
|
|
||||||
($width - $water_mark_width),
|
|
||||||
($height - $margin_bottom));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Get minimun value to draw axis properly*/
|
/*Get minimun value to draw axis properly*/
|
||||||
$min_data = min(min($data));
|
$min_data = min(min($data));
|
||||||
|
|
Loading…
Reference in New Issue