From 5d8ea2bfa8ec49beebbd7de1e71181dbb8db4bde Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 20 Apr 2011 09:23:54 +0000 Subject: [PATCH] 2011-04-20 Miguel de Dios * images/logo_vertical_water.png: added water mark for the graphs. * godmode/db/db_info.php: cleaned source code style. * include/graphs/pChart/pDraw.class.php: re-added lost line for the rotation label value. * include/functions_graph.php, include/graphs/functions_pchart.php, include/graphs/functions_fsgraph.php, include/graphs/fgraph.php: added the source code to show warter mark. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4261 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 13 +++ pandora_console/godmode/db/db_info.php | 2 +- .../images/logo_vertical_water.png | Bin 0 -> 2654 bytes pandora_console/include/functions_graph.php | 74 ++++++++++----- pandora_console/include/graphs/fgraph.php | 35 ++++--- .../include/graphs/functions_fsgraph.php | 2 +- .../include/graphs/functions_pchart.php | 88 ++++++++++++++---- .../include/graphs/pChart/pDraw.class.php | 1 + 8 files changed, 162 insertions(+), 53 deletions(-) create mode 100644 pandora_console/images/logo_vertical_water.png diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 5bbf8e4dfb..8889b6fe72 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,16 @@ +2011-04-20 Miguel de Dios + + * images/logo_vertical_water.png: added water mark for the graphs. + + * godmode/db/db_info.php: cleaned source code style. + + * include/graphs/pChart/pDraw.class.php: re-added lost line for the + rotation label value. + + * include/functions_graph.php, include/graphs/functions_pchart.php, + include/graphs/functions_fsgraph.php, include/graphs/fgraph.php: added the + source code to show warter mark. + 2011-04-20 Juan Manuel Ramon * include/functions_events.php diff --git a/pandora_console/godmode/db/db_info.php b/pandora_console/godmode/db/db_info.php index 16f6623e4d..20e9f5f0c2 100644 --- a/pandora_console/godmode/db/db_info.php +++ b/pandora_console/godmode/db/db_info.php @@ -18,7 +18,7 @@ // Load global vars global $config; -require_once ($config["homedir"] . '/include/functions_graph.php'); +require_once ($config["homedir"] . '/include/functions_graph.php'); require_once($config['homedir'] . "/include/functions_agents.php"); require_once($config['homedir'] . "/include/functions_modules.php"); diff --git a/pandora_console/images/logo_vertical_water.png b/pandora_console/images/logo_vertical_water.png new file mode 100644 index 0000000000000000000000000000000000000000..0de1e72b327e639eff887044cfe2f39cab0c6af4 GIT binary patch literal 2654 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%0Dcp<=9F`B>sujin5O*t@ zb7Ct!m9=3lw=reK$siLcBw&aX;xY+!I>?M8b=MxvCk6RMlJlB+5<)vaoIB2SX7=ehEB`MGD0C53t{vd`rRLg3&7 zr9o|~w$QD()v3OT?YT;UN+7sHoSZ>OfCd#HVny=ZOmDxlV7bjmkpM#~!k8n7Tk+Z^ z3HMKq&b%NYlOcsGosT!%sh+YMCn=2E7lbF7jvz&9QG+C@c35qb2&9bQC5?^7$+1xp z^W $data_tmp[4], __('Maintenance') => $data_tmp[5]); - return pie3d_graph($config['flash_charts'], $data, 320, 200); + return pie3d_graph($config['flash_charts'], $data, 320, 200, + __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png"); } /** @@ -1002,7 +1019,8 @@ function graph_incidents_status2 () { $data[__("Invalid")]++; } - return pie3d_graph($config['flash_charts'], $data, 370, 180); + return pie3d_graph($config['flash_charts'], $data, 370, 180, + __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png"); } /** @@ -1028,7 +1046,8 @@ function graphic_incident_group2 () { $data[$incident['nombre']] = $incident['n_incidents']; } - return pie3d_graph($config['flash_charts'], $data, 320, 200); + return pie3d_graph($config['flash_charts'], $data, 320, 200, + __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png"); } /** @@ -1065,7 +1084,8 @@ function graphic_incident_user2 () { $data[$name] = $incident['n_incidents']; } - return pie3d_graph($config['flash_charts'], $data, 320, 200); + return pie3d_graph($config['flash_charts'], $data, 320, 200, + __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png"); } /** @@ -1107,7 +1127,8 @@ function graphic_incident_source2($width = 320, $height = 200) { $data[$origin['origen']] = $origin['n_incident']; } - return pie3d_graph($config['flash_charts'], $data, $width, $height); + return pie3d_graph($config['flash_charts'], $data, $width, $height, + __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png"); } /** @@ -1171,7 +1192,8 @@ function grafico_eventos_grupo2 ($width = 300, $height = 200, $url = "") { $loop++; } - return pie3d_graph($config['flash_charts'], $data, $width, $height); + return pie3d_graph($config['flash_charts'], $data, $width, $height, + __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png"); } /** @@ -1205,7 +1227,8 @@ function grafico_eventos_total2($filter = "") { asort ($data); - return pie3d_graph($config['flash_charts'], $data, 320, 200); + return pie3d_graph($config['flash_charts'], $data, 320, 200, + __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png"); } /** @@ -1241,7 +1264,8 @@ function grafico_eventos_usuario2 ($width, $height) { $events = array(); } - return pie3d_graph($config['flash_charts'], $data, $width, $height); + return pie3d_graph($config['flash_charts'], $data, $width, $height, + __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png"); } /** @@ -1295,13 +1319,15 @@ function graph_custom_sql_graph2 ($id, $width, $height, $type = 'sql_graph_vbar' switch ($type) { case 'sql_graph_vbar': // vertical bar - return hbar_graph($flash_charts, $data, $width, $height, array(), array(), "", "", false, $homeurl); + return hbar_graph($flash_charts, $data, $width, $height, array(), + array(), "", "", false, $homeurl, $config['homedir'] . "/images/logo_vertical_water.png"); break; case 'sql_graph_hbar': // horizontal bar return vbar_graph($flash_charts, $data, $width, $height, array(), array(), "", "", $homeurl); break; case 'sql_graph_pie': // Pie - return pie3d_graph($flash_charts, $data, $width, $height, __("other"), $homeurl); + return pie3d_graph($flash_charts, $data, $width, $height, __("other"), $homeurl, + $config['homedir'] . "/images/logo_vertical_water.png"); break; } } @@ -1721,7 +1747,8 @@ function grafico_modulo_boolean2 ($agent_module_id, $period, $show_events, } return area_graph($flash_chart, $chart, $width, $height, $color, $legend, - $long_index, "images/image_problem.opaque.png", "", "", $homeurl); + $long_index, "images/image_problem.opaque.png", "", "", $homeurl, + $config['homedir'] . "/images/logo_vertical_water.png"); } /** @@ -1947,7 +1974,8 @@ function grafico_modulo_string2 ($agent_module_id, $period, $show_events, $legend = null; return area_graph($flash_chart, $chart, $width, $height, $color, $legend, - $long_index, "images/image_problem.opaque.png", "", "", $homeurl); + $long_index, "images/image_problem.opaque.png", "", "", $homeurl, + $config['homedir'] . "/images/logo_vertical_water.png"); } function grafico_modulo_log4x_2 ($id_agente_modulo, $periodo, $show_event, diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index 500a2b4c9c..701438586e 100755 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -107,7 +107,7 @@ function slicesbar_graph($chart_data, $width, $height, $colors, $font, $round_co } function vbar_graph($flash_chart, $chart_data, $width, $height, $color = array(), - $legend = array(), $xaxisname = "", $yaxisname = "", $homedir="") { + $legend = array(), $xaxisname = "", $yaxisname = "", $homedir="", $water_mark = '') { if($flash_chart) { echo fs_2d_column_chart ($chart_data, $width, $height); } @@ -120,6 +120,7 @@ function vbar_graph($flash_chart, $chart_data, $width, $height, $color = array() $graph['legend'] = $legend; $graph['xaxisname'] = $xaxisname; $graph['yaxisname'] = $yaxisname; + $graph['water_mark'] = $water_mark; $id_graph = serialize_in_temp($graph); @@ -129,7 +130,7 @@ function vbar_graph($flash_chart, $chart_data, $width, $height, $color = array() function threshold_graph($flash_chart, $chart_data, $width, $height) { if($flash_chart) { - echo fs_area_chart ($chart_data, $width, $height); + echo fs_2d_column_chart ($chart_data, $width, $height); } else { echo ""; @@ -137,7 +138,7 @@ function threshold_graph($flash_chart, $chart_data, $width, $height) { } function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend, - $long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $homedir="") { + $long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $homedir="", $water_mark = "") { if (empty($chart_data)) { return ''; } @@ -154,6 +155,7 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $graph['legend'] = $legend; $graph['xaxisname'] = $xaxisname; $graph['yaxisname'] = $yaxisname; + $graph['water_mark'] = $water_mark; $id_graph = serialize_in_temp($graph); @@ -161,7 +163,8 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend, } } -function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "") { +function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color, + $legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $water_mark = "") { if (empty($chart_data)) { return ''; @@ -182,6 +185,7 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color, $graph['legend'] = $legend; $graph['xaxisname'] = $xaxisname; $graph['yaxisname'] = $yaxisname; + $graph['water_mark'] = $water_mark; $id_graph = serialize_in_temp($graph); @@ -189,7 +193,8 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color, } } -function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "") { +function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color, + $legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $water_mark = "") { if (empty($chart_data)) { return ''; } @@ -209,6 +214,7 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color, $graph['legend'] = $legend; $graph['xaxisname'] = $xaxisname; $graph['yaxisname'] = $yaxisname; + $graph['water_mark'] = $water_mark; $id_graph = serialize_in_temp($graph); @@ -216,7 +222,8 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color, } } -function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "") { +function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend, + $long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $water_mark = "") { if (empty($chart_data)) { return ''; } @@ -233,6 +240,7 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $graph['legend'] = $legend; $graph['xaxisname'] = $xaxisname; $graph['yaxisname'] = $yaxisname; + $graph['water_mark'] = $water_mark; $id_graph = serialize_in_temp($graph); @@ -264,7 +272,8 @@ function polar_graph($flash_chart, $chart_data, $width, $height, $no_data_image) } function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array(), - $legend = array(), $xaxisname = "", $yaxisname = "", $force_height = true, $homedir="") { + $legend = array(), $xaxisname = "", $yaxisname = "", $force_height = true, + $homedir="", $water_mark = '') {$flash_chart = false; if($flash_chart) { echo fs_2d_hcolumn_chart ($chart_data, $width, $height); } @@ -278,6 +287,7 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array() $graph['xaxisname'] = $xaxisname; $graph['yaxisname'] = $yaxisname; $graph['force_height'] = $force_height; + $graph['water_mark'] = $water_mark; $id_graph = serialize_in_temp($graph); @@ -285,15 +295,15 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array() } } -function pie3d_graph($flash_chart, $chart_data, $width, $height, $others_str = "other", $homedir="") { - return pie_graph('3d', $flash_chart, $chart_data, $width, $height, $others_str, $homedir); +function pie3d_graph($flash_chart, $chart_data, $width, $height, $others_str = "other", $homedir="", $water_mark = "") { + return pie_graph('3d', $flash_chart, $chart_data, $width, $height, $others_str, $homedir, $water_mark); } -function pie2d_graph($flash_chart, $chart_data, $width, $height, $others_str = "other", $homedir="") { - return pie_graph('2d', $flash_chart, $chart_data, $width, $height, $others_str, $homedir); +function pie2d_graph($flash_chart, $chart_data, $width, $height, $others_str = "other", $homedir="", $water_mark = "") { + return pie_graph('2d', $flash_chart, $chart_data, $width, $height, $others_str, $homedir, $water_mark); } -function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height, $others_str = "other", $homedir="") { +function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height, $others_str = "other", $homedir="", $water_mark = "") { // This library allows only 8 colors $max_values = 8; @@ -330,6 +340,7 @@ function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height, $oth $graph['data'] = $chart_data; $graph['width'] = $width; $graph['height'] = $height; + $graph['water_mark'] = $water_mark; $id_graph = serialize_in_temp($graph); diff --git a/pandora_console/include/graphs/functions_fsgraph.php b/pandora_console/include/graphs/functions_fsgraph.php index d866e9cd92..bd0e338810 100755 --- a/pandora_console/include/graphs/functions_fsgraph.php +++ b/pandora_console/include/graphs/functions_fsgraph.php @@ -309,7 +309,7 @@ function fs_line_graph($chart_data, $width, $height, $color, $legend, $long_inde } -function fs_area_graph($chart_data, $width, $height, $colors, $legend, $long_index) { +function fs_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl = '') { global $config; $graph_type = "MSArea2D"; //MSLine is possible also diff --git a/pandora_console/include/graphs/functions_pchart.php b/pandora_console/include/graphs/functions_pchart.php index 8654064856..714e24d7a5 100755 --- a/pandora_console/include/graphs/functions_pchart.php +++ b/pandora_console/include/graphs/functions_pchart.php @@ -94,6 +94,11 @@ if (!$force_height) { } } +$water_mark = ''; +if(isset($graph['water_mark'])) { + $water_mark = $graph['water_mark']; //"/var/www/pandora_console/images/logo_vertical_water.png"; +} +debugPrint($graph['water_mark'], true); /* $colors = array(); @@ -247,7 +252,7 @@ foreach($colors as $i => $color) { switch($graph_type) { case 'pie3d': case 'pie2d': - pch_pie_graph($graph_type, array_values($data), array_keys($data), $width, $height, $font); + pch_pie_graph($graph_type, array_values($data), array_keys($data), $width, $height, $font, $water_mark); break; case 'slicebar': pch_slicebar_graph($graph_type, $data, $width, $height, $colors, $font, $round_corner); @@ -258,12 +263,16 @@ switch($graph_type) { break; case 'hbar': case 'vbar': - pch_bar_graph($graph_type, $data_keys, $data_values, $width, $height, $font, $antialiasing, $rgb_color, $xaxisname, $yaxisname, false, $legend, $fine_colors); + pch_bar_graph($graph_type, $data_keys, $data_values, $width, $height, + $font, $antialiasing, $rgb_color, $xaxisname, $yaxisname, false, + $legend, $fine_colors, $water_mark); break; case 'stacked_area': case 'area': case 'line': - pch_vertical_graph($graph_type, $data_keys, $data_values, $width, $height, $rgb_color, $xaxisname, $yaxisname, false, $legend, $font, $antialiasing); + pch_vertical_graph($graph_type, $data_keys, $data_values, $width, + $height, $rgb_color, $xaxisname, $yaxisname, false, $legend, + $font, $antialiasing, $water_mark); break; case 'threshold': pch_threshold_graph($graph_type, $data_keys, $data_values, $width, $height, $font, $antialiasing, $xaxisname, $yaxisname, $title); @@ -330,7 +339,7 @@ function pch_slicebar_graph ($graph_type, $data, $width, $height, $colors, $font $myPicture->Stroke (); } -function pch_pie_graph ($graph_type, $data_values, $legend_values, $width, $height, $font) { +function pch_pie_graph ($graph_type, $data_values, $legend_values, $width, $height, $font, $water_mark) { /* CAT:Pie charts */ /* Create and populate the pData object */ @@ -348,6 +357,21 @@ function pch_pie_graph ($graph_type, $data_values, $legend_values, $width, $heig /* Set the default font properties */ $myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>10,"R"=>80,"G"=>80,"B"=>80)); + + + $water_mark_height = 0; + $water_mark_width = 0; + debugPrint($water_mark, true); + 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) - 50, $water_mark); + } + + /* Create the pPie object */ $PieChart = new pPie($myPicture,$MyData); @@ -357,7 +381,7 @@ function pch_pie_graph ($graph_type, $data_values, $legend_values, $width, $heig $PieChart->draw2DPie($width/4,$height/2,array("DataGapAngle"=>0,"DataGapRadius"=>0, "Border"=>FALSE, "BorderR"=>200, "BorderG"=>200, "BorderB"=>200, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE)); break; case "pie3d": - $PieChart->draw3DPie($width/4,$height/2,array("DataGapAngle"=>10,"DataGapRadius"=>6, "Border"=>TRUE, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE)); + $PieChart->draw3DPie($width/4, $height/2,array("DataGapAngle"=>10,"DataGapRadius"=>6, "Border"=>TRUE, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE)); break; } @@ -381,7 +405,7 @@ function pch_pie_graph ($graph_type, $data_values, $legend_values, $width, $heig $myPicture->setShadow(TRUE,array("X"=>3,"Y"=>3,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); /* Render the picture */ - $myPicture->stroke(); + $myPicture->stroke(); } function pch_kiviat_graph ($graph_type, $data_values, $legend_values, $width, $height, $font) { @@ -424,7 +448,9 @@ function pch_kiviat_graph ($graph_type, $data_values, $legend_values, $width, $h $myPicture->stroke(); } -function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, $antialiasing, $rgb_color = false, $xaxisname = "", $yaxisname = "", $show_values = false, $legend = array(), $fine_colors = array()) { +function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, + $antialiasing, $rgb_color = false, $xaxisname = "", $yaxisname = "", + $show_values = false, $legend = array(), $fine_colors = array(), $water_mark = '') { /* CAT: Vertical Bar Chart */ if(!is_array($legend) || empty($legend)) { unset($legend); @@ -470,7 +496,7 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, $ant /* Create the pChart object */ $myPicture = new pImage($width,$height,$MyData); - + /* Turn of Antialiasing */ $myPicture->Antialias = $antialiasing; @@ -498,24 +524,39 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, $ant } } $margin_top = 10 * $max_chars; - + switch($graph_type) { case "vbar": - $scaleSettings = array("AvoidTickWhenEmpty" => FALSE, "AvoidGridWhenEmpty" => FALSE, "GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "LabelRotation" => 60); + $scaleSettings = array("AvoidTickWhenEmpty" => FALSE, "AvoidGridWhenEmpty" => FALSE, + "GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE, + "Mode"=>SCALE_MODE_START0, "LabelRotation" => 60); $margin_left = 40; $margin_top = 10; $margin_bottom = 8 * $max_chars; break; case "hbar": - $scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "Pos"=>SCALE_POS_TOPBOTTOM, "LabelValuesRotation" => 60); - $margin_left = 8 * $max_chars; + $scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE, + "CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "Pos"=>SCALE_POS_TOPBOTTOM, + "LabelValuesRotation" => 60); + $margin_left = 5 * $max_chars; $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,$height-$margin_bottom); + $myPicture->setGraphArea($margin_left,$margin_top,$width - $water_mark_width,$height-$margin_bottom); $myPicture->drawScale($scaleSettings); @@ -537,7 +578,9 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, $ant $myPicture->stroke(); } -function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $rgb_color = false, $xaxisname = "", $yaxisname = "", $show_values = false, $legend = array(), $font, $antialiasing) { +function pch_vertical_graph ($graph_type, $index, $data, $width, $height, + $rgb_color = false, $xaxisname = "", $yaxisname = "", $show_values = false, + $legend = array(), $font, $antialiasing, $water_mark = '') { /* CAT:Vertical Charts */ if(!is_array($legend) || empty($legend)) { unset($legend); @@ -647,13 +690,25 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $rgb_c } $margin_bottom = 10 * $max_chars; + $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); + } + + if (isset($size['Height'])) { /* Define the chart area */ - $myPicture->setGraphArea(40,$size['Height'],$width,$height - $margin_bottom); + $myPicture->setGraphArea(40,$size['Height'],$width - $water_mark_width,$height - $margin_bottom); } else { /* Define the chart area */ - $myPicture->setGraphArea(40, 5,$width,$height - $margin_bottom); + $myPicture->setGraphArea(40, 5,$width - $water_mark_width,$height - $margin_bottom); } /* Draw the scale */ @@ -686,6 +741,7 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $rgb_c "DisplayZeros"=> FALSE, "DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE); + switch($graph_type) { case "stacked_area": case "area": diff --git a/pandora_console/include/graphs/pChart/pDraw.class.php b/pandora_console/include/graphs/pChart/pDraw.class.php index 015aa68acb..a6f6bcdc37 100755 --- a/pandora_console/include/graphs/pChart/pDraw.class.php +++ b/pandora_console/include/graphs/pChart/pDraw.class.php @@ -1745,6 +1745,7 @@ $LabelingMethod = isset($Format["LabelingMethod"]) ? $Format["LabelingMethod"] : LABELING_ALL; $LabelSkip = isset($Format["LabelSkip"]) ? $Format["LabelSkip"] : 1; $LabelRotation = isset($Format["LabelRotation"]) ? $Format["LabelRotation"] : 0; + $LabelValuesRotation = isset($Format["LabelValuesRotation"]) ? $Format["LabelValuesRotation"] : 0; $SkippedAxisTicks = isset($Format["SkippedAxisTicks"]) ? $Format["SkippedAxisTicks"] : $GridTicks+2; $SkippedAxisR = isset($Format["SkippedAxisR"]) ? $Format["SkippedAxisR"] : $GridR; $SkippedAxisG = isset($Format["SkippedAxisG"]) ? $Format["SkippedAxisG"] : $GridG;