diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 8693510e15..7f95879dc5 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2010-01-10 Juan Manuel Ramon + + * pchart_graph.php: Remove axis values and legend in small graphs. + * functions_visual_map.php: Added marks (div borders) for beautify visual console graphs. + * fgraph.php: Dont show caption graphs in small graphs. + * functions.php: Added constants for visual console. + + Fixes bug #3152673. + 2010-01-07 Juan Manuel Ramon * pandora_console_upgrade: Changed permissions in this file to make it executable by default. diff --git a/pandora_console/include/fgraph.php b/pandora_console/include/fgraph.php index f9608784a0..b30dfc8f48 100644 --- a/pandora_console/include/fgraph.php +++ b/pandora_console/include/fgraph.php @@ -1381,8 +1381,13 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, $time_format = 'M j'; } + // Only show caption if graph is not small + if ($width > MIN_WIDTH_CAPTION && $height > MIN_HEIGHT) // Flash chart $caption = __('Max. Value') . ': ' . $max_value . ' ' . __('Avg. Value') . ': ' . $avg_value . ' ' . __('Min. Value') . ': ' . $min_value; + else + $caption = array(); + if (! $graphic_type) { return fs_module_chart ($chart, $width, $height, $avg_only, $resolution / 10, $time_format, $show_events, $show_alerts, $caption, $baseline); } diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 5ab837b5aa..497b9c521a 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -36,6 +36,11 @@ define ('EVENT_PROCESS', 2); define ('AGENT_ENABLED',0); define ('AGENT_DISABLED',1); +/* Visual console constants */ +define("MIN_WIDTH",300); +define("MIN_HEIGHT",120); +define("MIN_WIDTH_CAPTION",420); + /** * Cleans an object or an array and casts all values as integers * diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 0adbfd9107..7ac55e4048 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -739,9 +739,9 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = if ($show_links) { if (($layout_data['id_layout_linked'] == "") || ($layout_data['id_layout_linked'] == 0)) { - echo ''; + echo '
'; } else { - echo ''; + echo '
'; } } if ($resizedMap) @@ -753,7 +753,7 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = else print_image ("include/fgraph.php?tipo=sparse&id=".$layout_data['id_agente_modulo']."&label=".safe_input ($layout_data['label'])."&height=".$layout_data['height']."&pure=1&width=".$layout_data['width']."&period=".$layout_data['period'], false, array ("title" => $layout_data['label'], "border" => 0)); echo ""; - echo "
"; + echo "
"; break; } diff --git a/pandora_console/include/pchart_graph.php b/pandora_console/include/pchart_graph.php index 991c7d4993..05ac4184b9 100644 --- a/pandora_console/include/pchart_graph.php +++ b/pandora_console/include/pchart_graph.php @@ -223,10 +223,19 @@ class PchartGraph extends PandoraGraphAbstract { $this->graph->drawGraphArea (254, 254, 254, false); $this->xaxis_interval = ($this->xaxis_interval / 7 >= 1) ? ($this->xaxis_interval / 7) : 10; - $this->graph->drawScale ($this->dataset->GetData (), - $this->dataset->GetDataDescription (), SCALE_START0, - 80, 80, 80, $this->show_axis, 0, 50, false, - $this->xaxis_interval); + + // Remove axis values if graph is small + if ($this->width > MIN_WIDTH && $this->height > MIN_HEIGHT){ + $this->graph->drawScale ($this->dataset->GetData (), + $this->dataset->GetDataDescription (), SCALE_START0, + 80, 80, 80, $this->show_axis, 0, 50, false, + $this->xaxis_interval); + }else{ + $this->graph->drawScale ($this->dataset->GetData (), + $this->dataset->GetDataDescription (), SCALE_START0, + 80, 80, 80, "", 0, 50, false, + $this->xaxis_interval); + } /* NOTICE: The final "false" is a Pandora modificaton of pChart to avoid showing vertical lines. */ if ($this->show_grid) @@ -235,7 +244,9 @@ class PchartGraph extends PandoraGraphAbstract { // Draw the graph $this->graph->drawFilledLineGraph ($this->dataset->GetData(), $this->dataset->GetDataDescription(), 50, true); - $this->add_legend (); + // Remove legends if graph is small + if ($this->width > MIN_WIDTH && $this->height > MIN_HEIGHT) + $this->add_legend (); $this->add_events ("AVG"); $this->add_alert_levels ();