From 95a79ad7ad4d9fa9c3dfabdf37cd21d4fda75328 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 27 Sep 2016 12:16:14 +0200 Subject: [PATCH] ticket Integria: 4070 fixed visual console add custom graph #4070 (cherry picked from commit 33e7e40856701f1e26a30704342d81def6f01dbd) --- .../reporting/visual_console_builder.editor.js | 4 ++-- .../include/ajax/visual_console_builder.ajax.php | 5 +++-- pandora_console/include/functions_visual_map.php | 6 ++++-- .../include/graphs/functions_pchart.php | 15 ++++++++------- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index f5450fccc7..c338fb0d71 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -1238,8 +1238,8 @@ function setModuleGraph(id_data) { id_agente_modulo = data['id_agente_modulo']; id_custom_graph = data['id_custom_graph']; label = data['label']; - height = data['height']; - width = data['width']; + height = (data['height'] + 60); + width = (data['width'] + 60); period = data['period']; background_color = data['image']; diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 5ba5a4e059..9631063b6d 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -153,7 +153,7 @@ switch ($action) { if ($id_custom_graph != 0) { $img = custom_graphs_print( $id_custom_graph, $height, $width, $period, - true, true, 0, true, $background_color); + null, true, 0, true, $background_color); } else { $img = grafico_modulo_sparse($id_agent_module, @@ -189,7 +189,8 @@ switch ($action) { case 'get_layout_data': $layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element)); - + $layoutData['height'] = $layoutData['height'] + 60; + $layoutData['width'] = $layoutData['width'] + 60; echo json_encode($layoutData); break; diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index f9686953e7..6bdc617829 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -94,8 +94,10 @@ function visual_map_print_item($mode = "read", $layoutData, require_once ($config["homedir"] . '/include/functions_graph.php'); require_once ($config["homedir"] . '/include/functions_custom_graphs.php'); - $width = $layoutData['width']; - $height = $max_percentile = $layoutData['height']; + //add 60 px for visual console map + $width = $layoutData['width'] + 60; + $height = $layoutData['height'] + 60; + $max_percentile = $layoutData['height']; $top = $layoutData['pos_y']; $left = $layoutData['pos_x']; $id = $layoutData['id']; diff --git a/pandora_console/include/graphs/functions_pchart.php b/pandora_console/include/graphs/functions_pchart.php index 4f302f5f8a..4665872454 100644 --- a/pandora_console/include/graphs/functions_pchart.php +++ b/pandora_console/include/graphs/functions_pchart.php @@ -691,7 +691,7 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, "Mode"=>SCALE_MODE_START0, "LabelRotation" => 60); $margin_left = 40; $margin_top = 10; - $margin_bottom = 10 * $max_chars; + $margin_bottom = 3 * $max_chars; break; case "hbar": $scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE, @@ -718,13 +718,13 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, $myPicture->setGraphArea($margin_left,$margin_top,$width - $water_mark_width,$height-$margin_bottom); $myPicture->drawScale($scaleSettings); - + /* if (isset($legend)) { - /* Write the chart legend */ + /* Write the chart legend $size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL)); $myPicture->drawLegend($width-$size['Width'],0,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL, "BoxWidth"=>10, "BoxHeight"=>10)); } - + */ /* Turn on shadow computing */ $myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); @@ -1137,8 +1137,9 @@ function pch_bullet_chart($graph_type, $data, $legend, $MyData->setSerieDescription("Labels", __("Agents/Modules")); $height_t = ($height * count($data) ) + 40; - $width_t = ($width + ( 200 + $max_chars)); - $max_chars = graph_get_max_index($legend_values); + $height_t = $height; + $max_chars = graph_get_max_index($legend); + $width_t = ($width + ( 100 + $max_chars)); /* Create the pChart object */ $myPicture = new pImage($width_t, $height_t,$MyData); @@ -1151,7 +1152,7 @@ function pch_bullet_chart($graph_type, $data, $legend, $height_t - 10; /* Draw the scale and chart */ - $myPicture->setGraphArea(220,20,($width + 80), $height_t); + $myPicture->setGraphArea(250,20,($width + 100), $height_t); $myPicture->drawScale(array("Pos"=>SCALE_POS_TOPBOTTOM, "Mode"=>SCALE_MODE_ADDALL_START0, "LabelingMethod"=>LABELING_DIFFERENT, "GridR"=>255, "GridG"=>255, "GridB"=>255, "GridAlpha"=>50, "TickR"=>0,"TickG"=>0, "TickB"=>0,