diff --git a/pandora_console/include/graphs/functions_pchart.php b/pandora_console/include/graphs/functions_pchart.php index 732c4388a0..dd66d9173d 100644 --- a/pandora_console/include/graphs/functions_pchart.php +++ b/pandora_console/include/graphs/functions_pchart.php @@ -27,6 +27,7 @@ include_once("pChart/pScatter.class.php"); include_once("pChart/pRadar.class.php"); // Define default fine colors + $default_fine_colors = array(); $default_fine_colors[] = "#2222FF"; $default_fine_colors[] = "#00DD00"; @@ -44,7 +45,7 @@ $yaxisname = ''; $legend = null; $colors = null; $font_size = 8; -$force_steps = true; +$force_steps = true; $legend_position = null; $series_type = null; @@ -71,9 +72,6 @@ if (!$graph) { } $data = $graph['data']; - -html_debug_print($data, true); - $width = $graph['width']; $height = $graph['height']; @@ -880,17 +878,72 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $rgb_color = false, $xaxisname = "", $yaxisname = "", $show_values = false, $legend = array(), $font, $antialiasing, $water_mark = '', $font_size, - $backgroundColor = 'white', $unit = '', $series_type = array(), + $backgroundColor = 'white', $unit = '', $series_type = array(), $graph_threshold = false, $id_module) { - + global $config; - /* CAT:Vertical Charts */ + html_debug_print($graph_type, true); + html_debug_print($index, true); + html_debug_print($data, true); + + + /* Create and populate the pData object */ + $MyData = new pData(); + $MyData->addPoints(array(20,22,25,5,12,8,30,8),"Probe 1"); + //$MyData->addPoints(array(3,12,15,8,8,5,-5),"Probe 2"); + $MyData->setSerieTicks("Probe 2",4); + $MyData->setAxisName(0,"Temperatures"); + $MyData->addPoints(array(1296299019,1296302903,1296307001,1296308071,1296309901,1296318931, 1296318941, 1296318942,1296338941),"Labels"); + $MyData->setSerieDescription("Labels","Timestamp"); + $MyData->setXAxisDisplay(AXIS_FORMAT_DATE,"H:i"); + $MyData->setAbscissa("Labels"); + + /* Create the pChart object */ + $myPicture = new pImage(700,230,$MyData); + + /* Draw the background */ + $Settings = array("R"=>170, "G"=>183, "B"=>87); + $myPicture->drawFilledRectangle(0,0,700,230,$Settings); + + /* Overlay with a gradient */ + $Settings = array("StartR"=>219, "StartG"=>231, "StartB"=>139, "EndR"=>1, "EndG"=>138, "EndB"=>68, "Alpha"=>50); + $myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,$Settings); + $myPicture->drawGradientArea(0,0,700,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>80)); + + /* Add a border to the picture */ + $myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0)); + + /* Write the picture title */ + $myPicture->setFontProperties(array("FontName" =>$font, "FontSize" => $font_size)); + $myPicture->drawText(10,13,"drawStepChart() - draw a step chart",array("R"=>255,"G"=>255,"B"=>255)); + + /* Write the chart title */ + $myPicture->setFontProperties(array("FontName" =>$font, "FontSize" => $font_size)); + $myPicture->drawText(250,55,"Average temperature",array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); + + /* Draw the scale and the 1st chart */ + $myPicture->setGraphArea(60,60,450,190); + $myPicture->drawFilledRectangle(60,60,450,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10)); + $myPicture->drawScale(array("DrawSubTicks"=>TRUE,"LabelShowBoundaries"=>TRUE,"ScaleModeAuto"=>TRUE)); + $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); + $myPicture->setFontProperties(array("FontName" =>$font, "FontSize" => $font_size)); + $myPicture->drawAreaChart(array("BreakVoid"=>FALSE, "BreakR"=>234, "BreakG"=>55, "BreakB"=>26, "DisplayValues"=>FALSE,"DisplayColor"=>DISPLAY_AUTO,"ScaleModeAuto"=>TRUE)); + $myPicture->setShadow(FALSE); + + /* Write the chart legend */ + $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL)); + + $myPicture->stroke(); + + + + /* + // CAT:Vertical Charts if (!is_array($legend) || empty($legend)) { unset($legend); } - if (is_array(reset($data))) { $data2 = array(); foreach ($data as $i =>$values) { @@ -905,15 +958,13 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, else { $data = array($data); } -*/ - /* Create and populate the pData object */ -/* + + // Create and populate the pData object $MyData = new pData(); - + foreach ($data as $i => $values) { if (isset($legend)) { $point_id = $legend[$i]; - // Translate the id of serie to legend of id if (!empty($series_type)) { if (!isset($series_type[$point_id])) { @@ -925,21 +976,19 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, else { $point_id = $i; } - + $MyData->addPoints($values, $point_id); - - + if (!empty($rgb_color)) { - $MyData->setPalette($point_id, + $MyData->setPalette($point_id, array( - "R" => $rgb_color[$i]['color']["R"], - "G" => $rgb_color[$i]['color']["G"], + "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"], + "BorderR" => $rgb_color[$i]['border']["R"], + "BorderG" => $rgb_color[$i]['border']["G"], + "BorderB" => $rgb_color[$i]['border']["B"], "Alpha" => $rgb_color[$i]['alpha'])); - $palette_color = array(); if (isset($rgb_color[$i]['color'])) { $palette_color["R"] = $rgb_color[$i]['color']["R"]; @@ -954,157 +1003,19 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, if (isset($rgb_color[$i]['color'])) { $palette_color["Alpha"] = $rgb_color[$i]['Alpha']; } - + $MyData->setPalette($point_id, $palette_color); } - // The weight of the line is not calculated in pixels, so it needs to be transformed $reduction_coefficient = 0.31; $MyData->setSerieWeight($point_id, $config['custom_graph_width'] * $reduction_coefficient); } -*/ -/* - $MyData = new pData(); - $MyData->addPoints(array(0.11, 0.91, 0.58, 1.11),"Probe 1"); - $MyData->setAxisName(0,"Temperatures"); - $MyData->addPoints(array(1328112000, 1328126400, 1330610400, 1330610420),"Labels"); - $MyData->setAbscissa("Labels"); - $MyData->setXAxisDisplay(AXIS_FORMAT_TIME,"d/m\nH:i"); -*/ -/* - $MyData = new pData(); - $MyData->addPoints(array(1700,2500,7800,5),"Distance"); - $MyData->setAxisName(0,"Maximum distance"); - $MyData->setAxisUnit(0,"m"); - $MyData->setAxisDisplay(0,AXIS_FORMAT_METRIC); - $MyData->setAxisName(0,$unit); - $MyData->addPoints(array(1526886033000, 1526893630000, 1526972433000, 1526972433300),"Timestamp"); - $MyData->setSerieDescription("Timestamp", $xaxisname); - $MyData->setAbscissa("Timestamp"); - $MyData->setXAxisDisplay(AXIS_FORMAT_DATE); -*/ - // Create the pChart object - //$myPicture = new pImage(800, 800, $MyData); + $MyData->addPoints($index,"Xaxis"); + $MyData->setSerieDescription("Xaxis", $xaxisname); + $MyData->setAbscissa("Xaxis"); + $MyData->setAxisDisplay(0, AXIS_FORMAT_TWO_SIGNIFICANT, 0); -/* - $myPicture->setGraphArea(60,60,660,190); - $myPicture->drawText(350,55,"My chart title",array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); - $myPicture->drawFilledRectangle(60,60,660,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10)); -*/ -/* - $myPicture->setGraphArea(60,60,800,400); - $myPicture->drawText(350,55,"My chart title",array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); - $myPicture->drawFilledRectangle(60,60,800,400,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10)); - $myPicture->drawScale(array("DrawSubTicks"=>TRUE,"LabelShowBoundaries"=>TRUE,"ScaleModeAuto"=>TRUE)); - $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); - $myPicture->setFontProperties(array("FontName"=>"fonts/pf_arma_five.ttf","FontSize"=>6)); - $myPicture->drawStepChart(array("DisplayValues"=>TRUE,"DisplayColor"=>DISPLAY_AUTO,"ScaleModeAuto"=>TRUE)); - $myPicture->drawAreaChart(array("DisplayValues"=>TRUE,"DisplayColor"=>DISPLAY_AUTO)); - //$myPicture->setShadow(FALSE); -*/ - - -/* Create and populate the pData object */ -$MyData = new pData(); -$MyData->addPoints(array(-4,VOID,VOID,12,8,3),"Probe 1"); -$MyData->addPoints(array(3,12,15,8,5,-5),"Probe 2"); -$MyData->addPoints(array(2,7,5,18,19,22),"Probe 3"); -$MyData->setSerieTicks("Probe 2",4); -$MyData->setAxisName(0,"Temperatures"); -$MyData->addPoints(array(1296299019,1296302903,1296307001,1296308071,1296309901,1296318931),"Labels"); -$MyData->setSerieDescription("Labels","Timestamp"); -$MyData->setXAxisDisplay(AXIS_FORMAT_DATE,"H:i"); -$MyData->setAbscissa("Labels"); - -/* Create the pChart object */ -$myPicture = new pImage(700,230,$MyData); - -/* Draw the background */ -$Settings = array("R"=>170, "G"=>183, "B"=>87, "Dash"=>1, "DashR"=>190, "DashG"=>203, "DashB"=>107); -$myPicture->drawFilledRectangle(0,0,700,230,$Settings); - -/* Overlay with a gradient */ -$Settings = array("StartR"=>219, "StartG"=>231, "StartB"=>139, "EndR"=>1, "EndG"=>138, "EndB"=>68, "Alpha"=>50); -$myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,$Settings); -$myPicture->drawGradientArea(0,0,700,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>80)); - -/* Add a border to the picture */ -$myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0)); - -/* Write the picture title */ -$myPicture->setFontProperties(array("FontName" =>$font, "FontSize" => $font_size)); -$myPicture->drawText(10,13,"drawStepChart() - draw a step chart",array("R"=>255,"G"=>255,"B"=>255)); - -/* Write the chart title */ -$myPicture->setFontProperties(array("FontName" =>$font, "FontSize" => $font_size)); -$myPicture->drawText(250,55,"Average temperature",array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); - -/* Draw the scale and the 1st chart */ -$myPicture->setGraphArea(60,60,450,190); -$myPicture->drawFilledRectangle(60,60,450,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10)); -$myPicture->drawScale(array("DrawSubTicks"=>TRUE,"LabelShowBoundaries"=>TRUE,"ScaleModeAuto"=>TRUE)); -$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); -$myPicture->setFontProperties(array("FontName" =>$font, "FontSize" => $font_size)); -$myPicture->drawStepChart(array("DisplayValues"=>TRUE,"DisplayColor"=>DISPLAY_AUTO,"ScaleModeAuto"=>TRUE)); -$myPicture->setShadow(FALSE); - -/* Draw the scale and the 2nd chart */ -$myPicture->setGraphArea(500,60,670,190); -$myPicture->drawFilledRectangle(500,60,670,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10)); -$myPicture->drawScale(array("Pos"=>SCALE_POS_TOPBOTTOM,"DrawSubTicks"=>TRUE,"ScaleModeAuto"=>TRUE)); -$myPicture->setShadow(TRUE,array("X"=>-1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); -$myPicture->drawStepChart(array("ScaleModeAuto"=>TRUE)); -$myPicture->setShadow(FALSE); - -/* Write the chart legend */ -$myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL)); - -/* Render the picture (choose the best way) */ -//$myPicture->autoOutput("pictures/example.drawStepChart.png"); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $myPicture->stroke(); -/* switch ($backgroundColor) { case 'white': $transparent = false; @@ -1121,16 +1032,16 @@ $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HOR $fontColor = array('R' => 200, 'G' => 200, 'B' => 200); break; } - - // Create the pChart object + //Create the pChart object $myPicture = new pImage($width, $height + $font_size, $MyData, $transparent, $backgroundColor, $fontColor); - //Turn of Antialiasing + // Turn of Antialiasing $myPicture->Antialias = $antialiasing; - //Add a border to the picture + // Add a border to the picture //$myPicture->drawRectangle(0,0,$width,$height,array("R"=>0,"G"=>0,"B"=>0)); + //Set the default font $myPicture->setFontProperties( array("FontName" =>$font, "FontSize" => $font_size)); @@ -1138,7 +1049,6 @@ $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HOR // By default, set a top margin of 5 px $top_margin = 5; if (isset($legend)) { - //Set horizontal legend if is posible $legend_mode = LEGEND_HORIZONTAL; $size = $myPicture->getLegendSize( @@ -1147,12 +1057,11 @@ $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HOR $legend_mode = LEGEND_VERTICAL; $size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>$legend_mode)); } - + // Update the top margin to add the legend Height $top_margin = $size['Height']; //Write the chart legend - $myPicture->drawLegend($width - $size['Width'], 8, array("Style" => LEGEND_NOBORDER, "Mode" => $legend_mode)); } @@ -1160,52 +1069,52 @@ $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HOR //Calculate the bottom margin from the size of string in each index $max_chars = graph_get_max_index($index); $margin_bottom = $font_size * $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), $top_margin, $water_mark); } - + // Get the max number of scale $max_all = 0; - + $serie_ne_zero = false; foreach ($data as $serie) { $max_this_serie = max($serie); if ($max_this_serie > $max_all) { - $max_all = $max_this_serie; + $max_all = $max_this_serie; } // Detect if all serie is equal to zero or not if ($serie != 0) $serie_ne_zero = true; } - + // Get the number of digits of the scale $digits_left = 0; while ($max_all > 1) { $digits_left ++; $max_all /= 10; } - + // If the number is less than 1 we count the decimals // Also check if the serie is not all equal to zero (!$serie_ne_zero) - if ($digits_left == 0 and !$serie_ne_zero) { + if ($digits_left == 0 and !$serie_ne_zero) { while($max_all < 1) { $digits_left ++; $max_all *= 10; } } - + $chart_size = ($digits_left * $font_size) + 20; - + $min_data = 0; $max_data = 0; foreach ($data as $k => $v) { @@ -1219,15 +1128,14 @@ $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HOR $chart_margin = 36; //Area depends on yaxisname - if ($yaxisname != '') { $chart_margin += $chart_size; } - - $myPicture->setGraphArea($chart_margin, $top_margin, + + $myPicture->setGraphArea($chart_margin, $top_margin, $width, ($height - $margin_bottom)); - + if($graph_threshold){ $sql_treshold = 'select min_critical, max_critical, min_warning, max_warning, critical_inverse, warning_inverse from tagente_modulo where id_agente_modulo =' . $id_module; $treshold_position = db_get_all_rows_sql($sql_treshold); @@ -1257,10 +1165,10 @@ $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HOR $p_min_warn = $p_max_warn; if($p_max_warn > $max_data){ - $p_max_warn = $p_max_warn + 21; + $p_max_warn = $p_max_warn + 21; } else{ - $p_max_warn = $max_data + 21; + $p_max_warn = $max_data + 21; } } } @@ -1270,7 +1178,7 @@ $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HOR $p_max_warn = $max_data + 21; } else{ - $p_max_warn = $p_min_warn + 21; + $p_max_warn = $p_min_warn + 21; } } } @@ -1295,21 +1203,21 @@ $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HOR $p_min_crit = $p_max_crit; if($p_inv_warn){ if($p_max_crit < $p_max_warn){ - $p_max_crit = $p_max_warn; + $p_max_crit = $p_max_warn; } } else{ if($p_max_crit > $max_data){ - $p_max_crit = $p_max_crit + 21; + $p_max_crit = $p_max_crit + 21; } else{ - $p_max_crit = $max_data + 21; + $p_max_crit = $max_data + 21; } } } } else{ - if($p_max_crit == 0){ + if($p_max_crit == 0){ if($p_max_warn > $p_min_crit){ $p_max_crit = $p_max_warn; } @@ -1318,7 +1226,7 @@ $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HOR $p_max_crit = $max_data + 21; } else{ - $p_max_crit = $p_min_crit + 21; + $p_max_crit = $p_min_crit + 21; } } } @@ -1328,24 +1236,24 @@ $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HOR //Check size scale //Which of the thresholds is higher? if($p_max_crit > $p_max_warn){ - $check_scale = $p_max_crit; + $check_scale = $p_max_crit; } else{ - $check_scale = $p_max_warn; + $check_scale = $p_max_warn; } if($p_min_crit < $p_min_warn){ - $check_scale_min = $p_min_crit; + $check_scale_min = $p_min_crit; } else{ - $check_scale_min = $p_min_warn; + $check_scale_min = $p_min_warn; } //Is the threshold higher than our maximum? if($max_data > $check_scale){ - $check_scale = $max_data; + $check_scale = $max_data; } - + if($min_data < $check_scale_min){ $check_scale_min = $min_data; } @@ -1353,7 +1261,7 @@ $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HOR $ManualScale = array( 0 => array("Min" => $check_scale_min, "Max" => $check_scale) ); $mode = SCALE_MODE_MANUAL; - //Draw the scale + // Draw the scale $scaleSettings = array( "GridR" => 200, "GridG" => 200, @@ -1365,18 +1273,18 @@ $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HOR "BackgroundAlpha2" => 35, "Mode" => $mode, "ManualScale" => $ManualScale, - "LabelRotation" => 40, - "XMargin" => 0, + "LabelRotation" => 40, + "XMargin" => 0, "MinDivHeight" => 15, "TicksFontSize" => $font_size - 1); - + $scaleSettings['AxisR'] = '200'; $scaleSettings['AxisG'] = '200'; $scaleSettings['AxisB'] = '200'; $scaleSettings['TickR'] = '200'; $scaleSettings['TickG'] = '200'; $scaleSettings['TickB'] = '200'; - + $myPicture->drawScale($scaleSettings); @@ -1391,7 +1299,7 @@ $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HOR $position3 = $myPicture->GraphAreaX2; $cte = ($position_y2 - $position_y1) / ($scale_max - $scale_min); - + //warning if($print_rectangle_warning){ $RectangleSettings = array("R"=>255,"G"=>255,"B"=>000,"Dash"=>TRUE,"DashR"=>170,"DashG"=>220,"DashB"=>190); @@ -1399,16 +1307,16 @@ $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HOR $p_min_warn = $scale_min; } - $position2 = ($scale_max - $p_min_warn)*$cte + $position_y1; + $position2 = ($scale_max - $p_min_warn)*$cte + $position_y1; $position4 = ($scale_max - $p_max_warn)*$cte + $position_y1; - $myPicture->drawFilledRectangle($position1, floor($position2), + $myPicture->drawFilledRectangle($position1, floor($position2), $position3, floor($position4), $RectangleSettings); if($p_inv_warn){ - $position2 = ($scale_max - $p_min_warn_inv)*$cte + $position_y1; + $position2 = ($scale_max - $p_min_warn_inv)*$cte + $position_y1; $position4 = ($scale_max - $p_max_warn_inv)*$cte + $position_y1; - $myPicture->drawFilledRectangle($position1, floor($position2), + $myPicture->drawFilledRectangle($position1, floor($position2), $position3, floor($position4), $RectangleSettings); } @@ -1422,16 +1330,16 @@ $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HOR $p_min_crit = $scale_min; } - $position2 = ($scale_max - $p_min_crit)*$cte + $position_y1; + $position2 = ($scale_max - $p_min_crit)*$cte + $position_y1; $position4 = ($scale_max - $p_max_crit)*$cte + $position_y1; - $myPicture->drawFilledRectangle($position1, $position2, + $myPicture->drawFilledRectangle($position1, $position2, $position3, $position4, $RectangleSettings); if($p_inv_crit){ - $position2 = ($scale_max - $p_min_crit_inv)*$cte + $position_y1; + $position2 = ($scale_max - $p_min_crit_inv)*$cte + $position_y1; $position4 = ($scale_max - $p_max_crit_inv)*$cte + $position_y1; - $myPicture->drawFilledRectangle($position1, $position2, + $myPicture->drawFilledRectangle($position1, $position2, $position3, $position4, $RectangleSettings); } @@ -1459,24 +1367,24 @@ $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HOR "BackgroundAlpha2" => 35, "Mode" => $mode, "ManualScale" => $ManualScale, - "LabelRotation" => 40, - "XMargin" => 0, + "LabelRotation" => 40, + "XMargin" => 0, "MinDivHeight" => 15, "TicksFontSize" => $font_size - 1); - + $scaleSettings['AxisR'] = '200'; $scaleSettings['AxisG'] = '200'; $scaleSettings['AxisB'] = '200'; $scaleSettings['TickR'] = '200'; $scaleSettings['TickG'] = '200'; $scaleSettings['TickB'] = '200'; - + $myPicture->drawScale($scaleSettings); } //Turn on shadow computing //$myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); - + switch ($graph_type) { case 'stacked_area': $ForceTransparency = "-1"; @@ -1485,8 +1393,8 @@ $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HOR $ForceTransparency = "100"; break; } - - // Draw the chart + + //Draw the chart $settings = array( "ForceTransparency" => 20, "Gradient" => TRUE, @@ -1500,8 +1408,7 @@ $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HOR "DisplayShadow" => TRUE, "Surrounding" => 5, "AroundZero" => TRUE); - - + if (empty($series_type)) { switch($graph_type) { case "stacked_area":