diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 4c17dabc02..bd90130c04 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2011-04-25 Miguel de Dios + + * include/functions_graph.php, include/graphs/functions_pchart.php, + include/graphs/fgraph.php: added parameter to choose if show all xaxis + marks or not. + 2011-04-25 Javier Lanz * operation/agentes/tactical.php: Fixed a style problem on Internet @@ -5,7 +11,7 @@ Fix: #3279238 -2011-04-20 Miguel de Dios +2011-04-25 Miguel de Dios * pandoradb_data.sql, pandoradb.data.postgreSQL.sql, pandoradb.data.oracle.sql: added the default value for flash_chart for diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index eb85f9aa45..b2d3dfd818 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -870,7 +870,7 @@ function grafico_db_agentes_paquetes2($width = 380, $height = 300) { return hbar_graph($config['flash_charts'], $data, $width, $height, array(), $legend, "", "", true, "", $config['homedir'] . "/images/logo_vertical_water.png", - $config['fontpath'], $config['font_size']); + $config['fontpath'], $config['font_size'], false); } /** @@ -922,7 +922,7 @@ function graph_db_agentes_modulos2($width, $height) { return hbar_graph($config['flash_charts'], $data, $width, $height, array(), array(), "", "", true, "", $config['homedir'] . "/images/logo_vertical_water.png", - $config['fontpath'], $config['font_size']); + $config['fontpath'], $config['font_size'], false); } /** @@ -1343,13 +1343,13 @@ function graph_custom_sql_graph2 ($id, $width, $height, $type = 'sql_graph_vbar' return hbar_graph($flash_charts, $data, $width, $height, array(), array(), "", "", false, $homeurl, $config['homedir'] . "/images/logo_vertical_water.png", - $config['fontpath'], $config['font_size']); + $config['fontpath'], $config['font_size'], false); break; case 'sql_graph_hbar': // horizontal bar return vbar_graph($flash_charts, $data, $width, $height, array(), array(), "", "", $homeurl, $config['homedir'] . "/images/logo_vertical_water.png", - $config['fontpath'], $config['font_size']); + $config['fontpath'], $config['font_size'], false); break; case 'sql_graph_pie': // Pie return pie3d_graph($flash_charts, $data, $width, $height, __("other"), $homeurl, diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index 6df37c2357..db85c18491 100755 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -108,7 +108,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="", - $water_mark = '', $font = '', $font_size = '') { + $water_mark = '', $font = '', $font_size = '', $force_steps = true) { if($flash_chart) { echo fs_2d_column_chart ($chart_data, $width, $height); } @@ -124,6 +124,7 @@ function vbar_graph($flash_chart, $chart_data, $width, $height, $color = array() $graph['water_mark'] = $water_mark; $graph['font'] = $font; $graph['font_size'] = $font_size; + $graph['force_steps'] = $force_steps; $id_graph = serialize_in_temp($graph); @@ -288,7 +289,7 @@ 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="", $water_mark = '', $font = '', $font_size = '') {$flash_chart = false; + $homedir="", $water_mark = '', $font = '', $font_size = '', $force_steps = true) { if($flash_chart) { echo fs_2d_hcolumn_chart ($chart_data, $width, $height); } @@ -305,6 +306,7 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array() $graph['water_mark'] = $water_mark; $graph['font'] = $font; $graph['font_size'] = $font_size; + $graph['force_steps'] = $force_steps; $id_graph = serialize_in_temp($graph); @@ -315,13 +317,13 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array() function pie3d_graph($flash_chart, $chart_data, $width, $height, $others_str = "other", $homedir="", $water_mark = "", $font = '', $font_size = '') { return pie_graph('3d', $flash_chart, $chart_data, $width, $height, - $others_str, $homedir, $water_mark, $font); + $others_str, $homedir, $water_mark, $font, $font_size); } function pie2d_graph($flash_chart, $chart_data, $width, $height, $others_str = "other", $homedir="", $water_mark = "", $font = '', $font_size = '') { return pie_graph('2d', $flash_chart, $chart_data, $width, $height, - $others_str, $homedir, $water_mark, $font); + $others_str, $homedir, $water_mark, $font, $font_size); } function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height, diff --git a/pandora_console/include/graphs/functions_pchart.php b/pandora_console/include/graphs/functions_pchart.php index eb972fbbc1..005798bfbb 100755 --- a/pandora_console/include/graphs/functions_pchart.php +++ b/pandora_console/include/graphs/functions_pchart.php @@ -62,6 +62,7 @@ $data = $graph['data']; $width = $graph['width']; $height = $graph['height']; $colors = null; +$force_steps = true; if (isset($graph['color'])) $colors = $graph['color']; $legend = null; @@ -107,6 +108,10 @@ if(isset($graph['water_mark'])) { $water_mark = $graph['water_mark']; //"/var/www/pandora_console/images/logo_vertical_water.png"; } +if (isset($graph['force_steps'])) { + $force_steps = $graph['force_steps']; +} + /* $colors = array(); $colors['pep1'] = array('border' => '#000000', 'color' => '#000000', 'alpha' => 50); @@ -115,20 +120,19 @@ $colors['pep3'] = array('border' => '#ff0000', 'color' => '#00ff00', 'alpha' => $colors['pep4'] = array('border' => '#000000', 'color' => '#0000ff', 'alpha' => 50); */ -$pixels_between_xdata = 40; -$max_xdata_display = round($width / $pixels_between_xdata); -$ndata = count($data); -if($max_xdata_display > $ndata) { - $xdata_display = $ndata; -} -else { - $xdata_display = $max_xdata_display; -} - -$step = round($ndata/$xdata_display); - -if(($graph_type == 'hbar') || ($graph_type == 'vbar')) { - $step = 1; +$step = 1; +if ($force_steps) { + $pixels_between_xdata = 40; + $max_xdata_display = round($width / $pixels_between_xdata); + $ndata = count($data); + if($max_xdata_display > $ndata) { + $xdata_display = $ndata; + } + else { + $xdata_display = $max_xdata_display; + } + + $step = round($ndata/$xdata_display); } $c = 0;