diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 56316fd520..d3adb2812d 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,15 @@ +2011-03-31 Miguel de Dios + + * include/functions_graph.php, operation/agentes/stat_win.php: changes for + to show with new engine. + + * include/graphs/functions_pchart.php, + include/graphs/pChart/pData.class.php, + include/graphs/pChart/pDraw.class.php, + include/graphs/functions_fsgraph.php, + include/graphs/fgraph.php: part of job is Sergio Martin in my laptop, the + changes to show borders in the static image graph. + 2011-03-31 Juan Manuel Ramon * include/config_process.php: Fixed wrong condition when global diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index a147286bcc..c089e52792 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -167,7 +167,34 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events, } $k++; } + + // Set the title and time format + if ($period <= 3600) { + $title_period = __('Last hour'); + $time_format = 'G:i:s'; + } + elseif ($period <= 86400) { + $title_period = __('Last day'); + $time_format = 'G:i'; + } + elseif ($period <= 604800) { + $title_period = __('Last week'); + $time_format = 'M j'; + } + elseif ($period <= 2419200) { + $title_period = __('Last month'); + $time_format = 'M j'; + } + else { + $title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); + $time_format = 'M j'; + } + $timestamp_short = date($time_format, $timestamp); + $long_index[$timestamp_short] = date( + html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp); + $timestamp = $timestamp_short; + // Data if ($count > 0) { $chart[$timestamp]['sum'] = $total; @@ -187,13 +214,17 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events, } } - $chart[$timestamp]['count'] = 0; + //$chart[$timestamp]['count'] = 0; ///////// //$chart[$timestamp]['timestamp_bottom'] = $timestamp; //$chart[$timestamp]['timestamp_top'] = $timestamp + $interval; ///////// - $chart[$timestamp]['event'] = $event_value; - $chart[$timestamp]['alert'] = $alert_value; + if($show_events) { + $chart[$timestamp]['event'] = $event_value; + } + if($show_alerts) { + $chart[$timestamp]['alert'] = $alert_value; + } $chart[$timestamp]['baseline'] = array_shift ($baseline_data); if ($chart[$timestamp]['baseline'] == NULL) { $chart[$timestamp]['baseline'] = 0; @@ -213,35 +244,13 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events, // Fix event and alert scale $event_max = $max_value * 1.25; foreach ($chart as $timestamp => $chart_data) { - if ($chart_data['event'] > 0) { + if ($show_events && $chart_data['event'] > 0) { $chart[$timestamp]['event'] = $event_max; } - if ($chart_data['alert'] > 0) { + if ($show_alerts && $chart_data['alert'] > 0) { $chart[$timestamp]['alert'] = $event_max; } } - - // Set the title and time format - if ($period <= 3600) { - $title_period = __('Last hour'); - $time_format = 'G:i:s'; - } - elseif ($period <= 86400) { - $title_period = __('Last day'); - $time_format = 'G:i'; - } - elseif ($period <= 604800) { - $title_period = __('Last week'); - $time_format = 'M j'; - } - elseif ($period <= 2419200) { - $title_period = __('Last month'); - $time_format = 'M j'; - } - else { - $title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); - $time_format = 'M j'; - } // Only show caption if graph is not small if ($width > MIN_WIDTH_CAPTION && $height > MIN_HEIGHT) @@ -252,21 +261,30 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events, /////// $color = array(); - $color['sum'] = array('border' => '#000000', 'color' => $config['graph_color2'], 'alpha' => 100); - $color['event'] = array('border' => '#ff7f00', 'color' => '#ff7f00', 'alpha' => 50); - $color['alert'] = array('border' => '#ff0000', 'color' => '#ff0000', 'alpha' => 50); - $color['max'] = array('border' => '#000000', 'color' => $config['graph_color3'], 'alpha' => 100); - $color['min'] = array('border' => '#000000', 'color' => $config['graph_color1'], 'alpha' => 100); + $color['sum'] = array('border' => '#000000', 'color' => $config['graph_color2'], 'alpha' => 50); + if($show_events) { + $color['event'] = array('border' => '#ff7f00', 'color' => '#ff7f00', 'alpha' => 50); + } + if($show_alerts) { + $color['alert'] = array('border' => '#ff0000', 'color' => '#ff0000', 'alpha' => 50); + } + $color['max'] = array('border' => '#000000', 'color' => $config['graph_color3'], 'alpha' => 50); + $color['min'] = array('border' => '#000000', 'color' => $config['graph_color1'], 'alpha' => 50); $color['baseline'] = array('border' => null, 'color' => '#0097BD', 'alpha' => 10); $legend = array(); $legend['sum'] = __('Avg') . ' (' . $avg_value . ')'; - $legend['event'] = __('Events'); - $legend['alert'] = __('Alerts'); + if($show_events) { + $legend['event'] = __('Events'); + } + if($show_alerts) { + $legend['alert'] = __('Alerts'); + } $legend['max'] = __('Max') . ' (' . $max_value . ')'; $legend['min'] = __('Min') . ' (' . $min_value . ')'; $legend['baseline'] = __('Baseline'); + //$legend = null; - area_graph(0, $chart, $width, $height, $avg_only, $resolution / 10, $time_format, $show_events, $show_alerts, $caption, $baseline, $color, $legend); + area_graph(0, $chart, $width, $height, $avg_only, $resolution / 10, $time_format, $show_events, $show_alerts, $caption, $baseline, $color, $legend, $long_index); } ?> \ No newline at end of file diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index e655de1ff1..f1fa657c57 100755 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -33,9 +33,12 @@ function threshold_graph($flash_chart, $chart_data, $width, $height) { } } -function area_graph($flash_chart, $chart_data, $width, $height, $avg_only, $resolution, $time_format, $show_events, $show_alerts, $caption, $baseline, $color) { +function area_graph($flash_chart, $chart_data, $width, $height, $avg_only, $resolution, $time_format, $show_events, $show_alerts, $caption, $baseline, $color,$legend, $long_index) { + $flash_chart = 1; + if($flash_chart) { - echo fs_module_chart ($chart_data, $width, $height, $avg_only, $resolution, $time_format, $show_events, $show_alerts, $caption, $baseline); + echo fs_area_graph($chart_data, $width, $height, $color, $legend, $long_index); + //echo fs_module_chart ($chart_data, $width, $height, $avg_only, $resolution, $time_format, $show_events, $show_alerts, $legend, $baseline, $color); } else { $id_graph = uniqid(); @@ -45,6 +48,7 @@ function area_graph($flash_chart, $chart_data, $width, $height, $avg_only, $reso $graph['width'] = $width; $graph['height'] = $height; $graph['color'] = $color; + $graph['legend'] = $legend; // $graph['avg_only'] = $avg_only; // $graph['resolution'] = $resolution; // $graph['time_format'] = $time_format; @@ -54,7 +58,9 @@ function area_graph($flash_chart, $chart_data, $width, $height, $avg_only, $reso // $graph['baseline'] = $baseline; session_start(); - $_SESSION['graph'][$id_graph] = $graph; + //unset($_SESSION['graph']); + $_SESSION['graph_session'][$id_graph] = $graph; + //debugPrint($_SESSION); session_write_close(); //echo ""; diff --git a/pandora_console/include/graphs/functions_fsgraph.php b/pandora_console/include/graphs/functions_fsgraph.php index c95d75a9b1..7a05c0ff3d 100755 --- a/pandora_console/include/graphs/functions_fsgraph.php +++ b/pandora_console/include/graphs/functions_fsgraph.php @@ -26,6 +26,134 @@ require_once ("FusionCharts/FusionCharts_Gen.php"); /////////////////////////////// /////////////////////////////// +function fs_area_graph($chart_data, $width, $height, $color, $legend, $long_index) { + global $config; + + $graph_type = "MSArea2D"; //MSLine is possible also + + $chart = new FusionCharts($graph_type, $width, $height); + + + $pixels_between_xdata = 25; + $max_xdata_display = round($width / $pixels_between_xdata); + $ndata = count($chart_data); + if($max_xdata_display > $ndata) { + $xdata_display = $ndata; + } + else { + $xdata_display = $max_xdata_display; + } + + $step = round($ndata/$xdata_display); + + + if(is_array(reset($chart_data))) { + $data2 = array(); + $count = 0; + foreach($chart_data as $i =>$values) { +// $count = 0; +// $step = 10; +// $num_vlines = 0; +// +// if ($count++ % $step == 0) { +// $show_name = '1'; +// $num_vlines++; +// } +// else { +// $show_name = '0'; +// } + + $count++; + $show_name = '0'; + if (($count % $step) == 0) { + $show_name = '1'; + } + + $chart->addCategory($i, //''); + 'hoverText=' . $long_index[$i] . + ';showName=' . $show_name); + + $c = 0; + foreach($values as $i2 => $value) { + $data2[$i2][$i] = $value; + $c++; + } + } + $data = $data2; + } + else { + $data = array($chart_data); + } + + $a = 0; + + $empty = 1; + foreach ($data as $i => $value) { + $showAreaBorder = 0; + if (!is_null($color[$i]['border'])) { + $showAreaBorder = 1; + } + + $chart->addDataSet($legend[$i], 'alpha=' . $color[$i]['alpha'] . ';' . + 'showAreaBorder=' . $showAreaBorder . ';' . + 'areaBorderColor=' . $color[$i]['border'] . ';' . + 'color=#' . $color[$i]['color']); + + $count = 0; + $step = 10; + $num_vlines = 0; + + foreach ($value as $i2 => $v) { + if ($count++ % $step == 0) { + $show_name = '1'; + $num_vlines++; + } + else { + $show_name = '0'; + } + + $empty = 0; + + if ($a < 3) { + $a++; +// $chart->addCategory(date('G:i', $i2), //''); +// 'hoverText=' . date (html_entity_decode ($config['date_format'], ENT_QUOTES, "UTF-8"), $i2) . +// ';showName=' . $show_name); + } + + //Add data + $chart->addChartData($v); + } + } + + $chart->setChartParams('animation=0;numVDivLines=' . $num_vlines . + ';showShadow=0;showAlternateVGridColor=1;showNames=1;rotateNames=1;' . + 'lineThickness=0.1;anchorRadius=0.5;showValues=0;baseFontSize=9;showLimits=0;' . + 'showAreaBorder=1;areaBorderThickness=0.1;areaBorderColor=000000' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : '')); + + $random_number = uniqid(); + + $div_id = 'chart_div_' . $random_number; + $chart_id = 'chart_' . $random_number; + + $pre_url = ($config["homeurl"] == "/") ? '' : $config["homeurl"]; + + $output = '
'; + $output .= ''; + $output .= ''; + + return $output; +} function fs_module_chart ($data, $width, $height, $avg_only = 1, $step = 10, $time_format = 'G:i', $show_events = 0, $show_alerts = 0, $caption = '', $baseline = 0, $color) { global $config; @@ -66,6 +194,7 @@ function fs_module_chart ($data, $width, $height, $avg_only = 1, $step = 10, $ti } else { $show_name = '0'; } + //$chart->addCategory(date($time_format, $i), ''); $chart->addCategory(date($time_format, $i), 'hoverText=' . date (html_entity_decode ($config['date_format'], ENT_QUOTES, "UTF-8"), $i) . ';showName=' . $show_name); } @@ -142,10 +271,13 @@ function fs_module_chart ($data, $width, $height, $avg_only = 1, $step = 10, $ti if (!is_null($color['baseline']['border'])) { $showAreaBorder = 1; } - + //debugPrint($color); $chart->addDataSet($caption['baseline'], 'color=' . $color['baseline']['color'] . ';' . 'alpha=' . $color['baseline']['alpha'] . ';' . 'showAreaBorder=' . $showAreaBorder . ';'); + debugPrint('color=' . $color['baseline']['color'] . ';' . + 'alpha=' . $color['baseline']['alpha'] . ';' . + 'showAreaBorder=' . $showAreaBorder . ';'); foreach ($data as $value) { $chart->addChartData($value['baseline']); } diff --git a/pandora_console/include/graphs/functions_pchart.php b/pandora_console/include/graphs/functions_pchart.php index 9f8727182b..8e2f8e52f7 100755 --- a/pandora_console/include/graphs/functions_pchart.php +++ b/pandora_console/include/graphs/functions_pchart.php @@ -37,9 +37,8 @@ $id_graph = get_parameter('id_graph', false); if ($id_graph) { session_start(); - $graph = $_SESSION['graph'][$id_graph]; - - unset($_SESSION['graph'][$id_graph]); + $graph = $_SESSION['graph_session'][$id_graph]; + unset($_SESSION['graph_session'][$id_graph]); session_write_close(); if (isset($graph)) { @@ -50,10 +49,10 @@ if ($id_graph) { $legend = $graph['legend']; /* $colors = array(); - $colors['pep1'] = array('border' => '#000000', 'color' => '#000000', 'alpha' => 100); + $colors['pep1'] = array('border' => '#000000', 'color' => '#000000', 'alpha' => 50); $colors['pep2'] = array('border' => '#ff7f00', 'color' => '#ff0000', 'alpha' => 50); - $colors['pep3'] = array('border' => '#ff0000', 'color' => '#00ff00', 'alpha' => 20); - $colors['pep4'] = array('border' => '#000000', 'color' => '#0000ff', 'alpha' => 100); + $colors['pep3'] = array('border' => '#ff0000', 'color' => '#00ff00', 'alpha' => 50); + $colors['pep4'] = array('border' => '#000000', 'color' => '#0000ff', 'alpha' => 50); */ $rgb_color = array(); foreach($colors as $i => $color) { @@ -82,7 +81,7 @@ if ($id_graph) { if($graph_type != 'pie3d' && $graph_type != 'pie2d') { - $pixels_between_xdata = 10; + $pixels_between_xdata = 25; $max_xdata_display = round($width / $pixels_between_xdata); $ndata = count($data); if($max_xdata_display > $ndata) { @@ -94,20 +93,21 @@ if($graph_type != 'pie3d' && $graph_type != 'pie2d') { $step = round($ndata/$xdata_display); $c = 0; + foreach($data as $i => $d) { $data_values[] = $d; - if($c == 0) { + + if (($c % $step) == 0) { $data_keys[] = $i; } else { - if($c == $step) { - $c = -1; - } $data_keys[] = ""; } + $c++; } + //debugPrint($data_values); } switch($graph_type) { @@ -299,14 +299,16 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $rgb_c if(!is_array($legend) || empty($legend)) { unset($legend); } - //$legend=array('pep1','pep2','pep3','pep4'); - //$data=array(array(1,1,3,3), array(1,3,1,4), array(3,1,1,1), array(1,1,1,0)); - if(is_array($data[0])) { + /*$legend=array('pep1' => 'pep1','pep2' => 'pep2','pep3' => 'pep3','pep4' => 'pep4'); + $data=array(array('pep1' => 1, 'pep2' => 1, 'pep3' => 3, 'pep4' => 3), array('pep1' => 1, 'pep2' => 3, 'pep3' => 1,'pep4' => 4), array('pep1' => 3, 'pep2' => 1, 'pep3' => 1,'pep4' =>1), array('pep1' => 1, 'pep2' =>1, 'pep3' =>1,'pep4' =>0)); + $index=array(1,2,3,4); + */ + if(is_array(reset($data))) { $data2 = array(); foreach($data as $i =>$values) { $c = 0; - foreach($values as $value) { - $data2[$c][$i] = $value; + foreach($values as $i2 => $value) { + $data2[$i2][$i] = $value; $c++; } } @@ -318,15 +320,28 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $rgb_c /* Create and populate the pData object */ $MyData = new pData(); + //debugPrint($data); foreach($data as $i => $values) { - if(isset($legend)) { + if(isset($legend)) { $point_id = $legend[$i]; } else { $point_id = $i; } + + if ($i == 'alert') { + $values[100] = 100; + } + $MyData->addPoints($values,$point_id); - $MyData->setPalette($point_id, array("R" => $rgb_color[$point_id]['color']["R"], "G" => $rgb_color[$point_id]['color']["G"], "B" => $rgb_color[$point_id]['color']["B"], "Alpha" => $rgb_color[$point_id]['alpha'])); + $MyData->setPalette($point_id, + array("R" => $rgb_color[$i]['color']["R"], + "G" => $rgb_color[$i]['color']["G"], + "B" => $rgb_color[$i]['color']["B"], + "BorderR" => $rgb_color[$i]['border']["R"], + "BorderG" => $rgb_color[$i]['border']["G"], + "BorderB" => $rgb_color[$i]['border']["B"], + "Alpha" => $rgb_color[$i]['alpha'])); } //$MyData->addPoints($data,"Yaxis"); @@ -353,17 +368,25 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $rgb_c /* Draw the scale */ $scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "XMargin" => 40, "LabelRotation" => 90); $myPicture->drawScale($scaleSettings); - + if(isset($legend)) { /* Write the chart legend */ - $myPicture->drawLegend($height/2,$width/1.8,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL)); + //$myPicture->drawLegend($height/2,$width/1.8,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL)); + $myPicture->drawLegend($height/2,$height-20,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL)); } /* Turn on shadow computing */ //$myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); /* Draw the chart */ - $settings = array("ForceTransparency"=>"-1", "Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE); + $settings = array("ForceTransparency"=>"-1", + "Gradient"=>TRUE, + "GradientMode"=>GRADIENT_EFFECT_CAN, + "DisplayValues"=>$show_values, + "DisplayZeroValues"=>FALSE, + "DisplayR"=>100, + "DisplayZeros"=> FALSE, + "DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE); switch($graph_type) { case "area": diff --git a/pandora_console/include/graphs/pChart/pData.class.php b/pandora_console/include/graphs/pChart/pData.class.php index 70edd695f1..f810ae274a 100755 --- a/pandora_console/include/graphs/pChart/pData.class.php +++ b/pandora_console/include/graphs/pChart/pData.class.php @@ -344,19 +344,35 @@ $G = isset($Format["G"]) ? $Format["G"] : 0; $B = isset($Format["B"]) ? $Format["B"] : 0; $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; + $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : $R; + $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : $G; + $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : $B; if ( isset($this->Data["Series"][$Serie]) ) { - $OldR = $this->Data["Series"][$Serie]["Color"]["R"]; $OldG = $this->Data["Series"][$Serie]["Color"]["G"]; $OldB = $this->Data["Series"][$Serie]["Color"]["B"]; + $OldR = $this->Data["Series"][$Serie]["Color"]["R"]; + $OldG = $this->Data["Series"][$Serie]["Color"]["G"]; + $OldB = $this->Data["Series"][$Serie]["Color"]["B"]; $this->Data["Series"][$Serie]["Color"]["R"] = $R; $this->Data["Series"][$Serie]["Color"]["G"] = $G; $this->Data["Series"][$Serie]["Color"]["B"] = $B; + $this->Data["Series"][$Serie]["Color"]["BorderR"] = $BorderR; + $this->Data["Series"][$Serie]["Color"]["BorderG"] = $BorderG; + $this->Data["Series"][$Serie]["Color"]["BorderB"] = $BorderB; $this->Data["Series"][$Serie]["Color"]["Alpha"] = $Alpha; /* Do reverse processing on the internal palette array */ - foreach ($this->Palette as $Key => $Value) - { if ($Value["R"] == $OldR && $Value["G"] == $OldG && $Value["B"] == $OldB) { $this->Palette[$Key]["R"] = $R; $this->Palette[$Key]["G"] = $G; $this->Palette[$Key]["B"] = $B; $this->Palette[$Key]["Alpha"] = $Alpha;} } - } + foreach ($this->Palette as $Key => $Value) { + if ($Value["R"] == $OldR && $Value["G"] == $OldG && $Value["B"] == $OldB) { + $this->Palette[$Key]["R"] = $R; + $this->Palette[$Key]["G"] = $G; + $this->Palette[$Key]["B"] = $B; + $this->Palette[$Key]["BorderR"] = $BorderR; + $this->Palette[$Key]["BorderG"] = $BorderG; + $this->Palette[$Key]["BorderB"] = $BorderB; + $this->Palette[$Key]["Alpha"] = $Alpha;} + } + } } /* Load a palette file */ diff --git a/pandora_console/include/graphs/pChart/pDraw.class.php b/pandora_console/include/graphs/pChart/pDraw.class.php index 3742897fc4..2a6f54c08c 100755 --- a/pandora_console/include/graphs/pChart/pDraw.class.php +++ b/pandora_console/include/graphs/pChart/pDraw.class.php @@ -3676,7 +3676,14 @@ { if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) { - $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; + $R = $Serie["Color"]["R"]; + $G = $Serie["Color"]["G"]; + $B = $Serie["Color"]["B"]; + $BorderR = $Serie["Color"]["BorderR"]; + $BorderG = $Serie["Color"]["BorderG"]; + $BorderB = $Serie["Color"]["BorderB"]; + $Alpha = $Serie["Color"]["Alpha"]; + $Ticks = $Serie["Ticks"]; if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; } $AxisID = $Serie["Axis"]; @@ -3705,10 +3712,14 @@ foreach($PosArray as $Key => $Y) { // Hack to avoid draw zero values - debugPrint($Serie["Data"][$Key]." - ".$lastKey, '/tmp/logo'); - if(!$DisplayZeros && $Serie["Data"][$Key] == 0 && $lastKey == 0) { + debugPrint((int)$DisplayZeros . " - " . $Serie["Data"][$Key]." - ".$lastKey, '/tmp/logo'); + if(!$DisplayZeros && $Serie["Data"][$Key] == 0 && $lastKey == 0) { + debugPrint("HOLA", "/tmp/logo"); $Y = VOID; - } + } + else { + //debugPrint("ADIOS", "/tmp/logo"); + } $lastKey = $Serie["Data"][$Key]; if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) @@ -3743,7 +3754,7 @@ if ( $AroundZero ) { $Areas[$AreaID][] = $YZero; } else { $Areas[$AreaID][] = $this->GraphAreaY2-1; } $Alpha = $ForceTransparency != -1 ? $ForceTransparency : $Alpha; - $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha); + $Color = array("BorderR" => $BorderR, "BorderG" => $BorderG, "BorderB" => $BorderB, "R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha); foreach($Areas as $Key => $Points) $this->drawPolygon($Points,$Color); } @@ -3795,7 +3806,7 @@ $Areas[$AreaID][] = $LastY; $Alpha = $ForceTransparency != -1 ? $ForceTransparency : $Alpha; - $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha); + $Color = array("BorderR" => $BorderR, "BorderG" => $BorderG, "BorderB" => $BorderB, "R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha); foreach($Areas as $Key => $Points) $this->drawPolygon($Points,$Color); } diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index 0114bc760e..12f9d1e7b2 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -27,7 +27,8 @@ if (! isset($_SESSION["id_user"])) { require_once ($config["homedir"] . '/include/functions.php'); require_once ($config["homedir"] . '/include/functions_db.php'); require_once ($config["homedir"] . '/include/functions_reporting.php'); -require_once ($config["homedir"] . '/include/fgraph.php'); +require_once ($config["homedir"] . '/include/functions_graph.php'); +//require_once ($config["homedir"] . '/include/fgraph.php'); check_login (); ?> @@ -137,9 +138,11 @@ else // log4x doesnt support flash yet // if ($config['flash_charts'] && $graph_type != "log4x") { +//if (true) { + switch ($graph_type) { case 'sparse': - echo grafico_modulo_sparse ($id, $period, $draw_events, $width, $height, + echo grafico_modulo_sparse2 ($id, $period, $draw_events, $width, $height, $label, $unit_name, $draw_alerts, $avg_only, $pure, $date, $baseline); break; case 'boolean': @@ -160,11 +163,33 @@ if ($config['flash_charts'] && $graph_type != "log4x") { } } else { - $image = "../../include/fgraph.php?tipo=".$graph_type."&draw_alerts=".$draw_alerts."&draw_events=".$draw_events."&id=".$id."&zoom=".$zoom."&label=". base64_encode ($label) ."&height=".$height."&width=".$width."&period=".$period."&avg_only=".$avg_only."&baseline=".$baseline; - - $image .= "&date=" . $date; - - print_image ($image, false, array ("border" => 0)); + switch ($graph_type) { + case 'sparse': + echo grafico_modulo_sparse2 ($id, $period, $draw_events, $width, $height, + $label, $unit_name, $draw_alerts, $avg_only, $pure, $date, $baseline); + break; + case 'boolean': + echo grafico_modulo_boolean ($id, $period, $draw_events, $width, $height, + $label, $unit_name, $draw_alerts, 1, $pure, $date); + break; + case 'string': + echo grafico_modulo_string ($id, $period, $draw_events, $width, $height, + $label, $unit_name, $draw_alerts, 1, $pure, $date, 1); + break; + case 'log4x': + echo grafico_modulo_log4x ($id, $period, $draw_events, $width, $height, + $label, $unit_name, $draw_alerts, 1, $pure, $date, 1); + break; + default: + echo fs_error_image ('../images'); + break; + } + +//$image = "../../include/fgraph.php?tipo=".$graph_type."&draw_alerts=".$draw_alerts."&draw_events=".$draw_events."&id=".$id."&zoom=".$zoom."&label=". base64_encode ($label) ."&height=".$height."&width=".$width."&period=".$period."&avg_only=".$avg_only."&baseline=".$baseline; +// +//$image .= "&date=" . $date; +// +//print_image ($image, false, array ("border" => 0)); } //z-index is 1 because 2 made the calendar show under the divmenu.