$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" => "../fonts/Silkscreen.ttf", "FontSize" => 6));
$myPicture->drawText(10, 13, "drawThreshold() - draw a treshold in the charting area", array("R" => 255, "G" => 255, "B" => 255));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(250, 55, "My chart title", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Draw the scale and do some cosmetics */
$myPicture->setGraphArea(60, 60, 450, 190);
$myPicture->drawFilledRectangle(70, 70, 440, 180, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -200, "Alpha" => 10));
$myPicture->drawScale(array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "DrawSubTicks" => TRUE));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 20));
/* Draw static thresholds */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
$myPicture->drawThreshold(5, array("WriteCaption" => TRUE, "Caption" => "Step 1", "BoxAlpha" => 100, "BoxR" => 255, "BoxG" => 40, "BoxB" => 70, "Alpha" => 70, "Ticks" => 1, "R" => 255, "G" => 40, "B" => 70));
$myPicture->drawThreshold(15, array("WriteCaption" => TRUE, "Caption" => "Step 2", "BoxAlpha" => 100, "BoxR" => 40, "BoxG" => 70, "BoxB" => 255, "Alpha" => 70, "Ticks" => 2, "R" => 40, "G" => 70, "B" => 255));
/* Disable shadow computing */
$myPicture->setShadow(FALSE);
/* Draw the scale and do some cosmetics */
$myPicture->setGraphArea(500, 60, 670, 190);
$myPicture->drawFilledRectangle(505, 65, 665, 185, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -200, "Alpha" => 10));
$myPicture->drawScale(array("XMargin" => 5, "YMargin" => 5, "Floating" => TRUE, "Pos" => SCALE_POS_TOPBOTTOM, "DrawSubTicks" => TRUE));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 20));
/* Draw static thresholds */
$myPicture->drawThreshold(5, array("Alpha" => 70, "Ticks" => 1));
$myPicture->drawThreshold(array(10, 12), array("Alpha" => 70, "Ticks" => 2, "R" => 0, "G" => 0, "B" => 255));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawThreshold.png");
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Define the chart area */
$myPicture->setGraphArea(60, 50, 670, 200);
/* Draw the scale */
$scaleSettings = array("LabelSkip" => 9, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the line chart */
$myPicture->drawPlotChart(array("PlotSize" => 2));
/* Compute the serie average and standard deviation */
$Average = $MyData->getSerieAverage("Probe 1");
/* Compute the serie standard deviation */
$StandardDeviation = $MyData->getStandardDeviation("Probe 1");
/* Draw a threshold area */
$myPicture->setShadow(FALSE);
$myPicture->drawThresholdArea($Average - $StandardDeviation, $Average + $StandardDeviation, array("R" => 100, "G" => 100, "B" => 200, "Alpha" => 10));
$myPicture->setShadow(TRUE);
/* Draw the serie average */
$myPicture->drawThreshold($Average, array("WriteCaption" => TRUE, "Caption" => "Average value", "AxisID" => 0));
/* Draw the standard deviation boundaries */
$ThresholdSettings = array("WriteCaption" => TRUE, "CaptionAlign" => CAPTION_RIGHT_BOTTOM, "Caption" => "SD", "AxisID" => 0, "R" => 0, "G" => 0, "B" => 0);
$myPicture->drawThreshold($Average + $StandardDeviation, $ThresholdSettings);
$myPicture->drawThreshold($Average - $StandardDeviation, $ThresholdSettings);
/* Write the coefficient of variation */
$CoefficientOfVariation = round($MyData->getCoefficientOfVariation("Probe 1"), 1);
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
$myPicture->drawText(610, 46, "coefficient of variation : " . $CoefficientOfVariation, array("Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawStandardDeviation.png");
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(150, 35, "Average temperature", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, 650, 200);
/* Draw the scale */
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Write the chart legend */
$myPicture->drawLegend(600, 20, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Enable shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the area chart */
$Threshold = "";
$Threshold[] = array("Min" => 0, "Max" => 5, "R" => 207, "G" => 240, "B" => 20, "Alpha" => 70);
$Threshold[] = array("Min" => 5, "Max" => 10, "R" => 240, "G" => 232, "B" => 20, "Alpha" => 70);
$Threshold[] = array("Min" => 10, "Max" => 20, "R" => 240, "G" => 191, "B" => 20, "Alpha" => 70);
$myPicture->drawAreaChart(array("Threshold" => $Threshold));
/* Write the thresholds */
$myPicture->drawThreshold(5, array("WriteCaption" => TRUE, "Caption" => "Warn Zone", "Alpha" => 70, "Ticks" => 2, "R" => 0, "G" => 0, "B" => 255));
$myPicture->drawThreshold(10, array("WriteCaption" => TRUE, "Caption" => "Error Zone", "Alpha" => 70, "Ticks" => 2, "R" => 0, "G" => 0, "B" => 255));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawAreaChart.threshold.png");
$MyData->addPoints(array(19, 0, -8, 8, -8, 12, -19, -10, 5, 12, -20, -8, 10, -11, -12, 8, -17, -14, 0), "Probe 4");
$MyData->setAxisName(0, "Temperatures");
$MyData->addPoints(array(4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22), "Time");
$MyData->setSerieDescription("Time", "Hour of the day");
$MyData->setAbscissa("Time");
$MyData->setXAxisUnit("h");
/* 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);
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Draw the scale */
$myPicture->setGraphArea(60, 30, 650, 190);
$myPicture->drawScale(array("CycleBackground" => TRUE, "DrawSubTicks" => TRUE, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 10, "Mode" => SCALE_MODE_ADDALL));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw some thresholds */
$myPicture->setShadow(FALSE);
$myPicture->drawThreshold(-40, array("WriteCaption" => TRUE, "R" => 0, "G" => 0, "B" => 0, "Ticks" => 4));
$myPicture->drawThreshold(28, array("WriteCaption" => TRUE, "R" => 0, "G" => 0, "B" => 0, "Ticks" => 4));
/* Draw the chart */
$myPicture->drawStackedBarChart(array("Rounded" => TRUE, "DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO, "DisplaySize" => 6, "BorderR" => 255, "BorderG" => 255, "BorderB" => 255));
/* Write the chart legend */
$myPicture->drawLegend(570, 212, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawStackedBarChart.rounded.png");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, array("StartR" => 100, "StartG" => 100, "StartB" => 100, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 100));
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_HORIZONTAL, array("StartR" => 100, "StartG" => 100, "StartB" => 100, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 20));
$myPicture->drawGradientArea(0, 0, 60, 230, DIRECTION_HORIZONTAL, array("StartR" => 0, "StartG" => 0, "StartB" => 0, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 100));
/* Do some cosmetics */
$myPicture->drawLine(60, 0, 60, 230, array("R" => 70, "G" => 70, "B" => 70));
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(35, 115, "Recorded cases", array("R" => 255, "G" => 255, "B" => 255, "FontSize" => 20, "Angle" => 90, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Prepare the chart area */
$myPicture->setGraphArea(100, 30, 680, 190);
$myPicture->drawFilledRectangle(100, 30, 680, 190, array("R" => 255, "G" => 255, "B" => 255, "Alpha" => 20));
$myPicture->setFontProperties(array("R" => 255, "G" => 255, "B" => 255, "FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
$myPicture->drawScale(array("AxisR" => 255, "AxisG" => 255, "AxisB" => 255, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE));
/* Write two thresholds over the chart */
$myPicture->drawThreshold(10, array("WriteCaption" => TRUE, "Caption" => "Agreed SLA", "NoMargin" => TRUE));
$myPicture->drawThreshold(15, array("WriteCaption" => TRUE, "Caption" => "Best effort", "NoMargin" => TRUE));
/* Draw one static X threshold area */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 30));
$myPicture->drawXThresholdArea(3, 5, array("AreaName" => "Service closed", "R" => 226, "G" => 194, "B" => 54, "Alpha" => 40));
$myPicture->setShadow(FALSE);
/* Draw the chart */
$myPicture->drawSplineChart();
$myPicture->drawPlotChart(array("PlotSize" => 3, "PlotBorder" => TRUE));
/* Write the data bounds */
$myPicture->writeBounds();
/* Write the chart legend */
$myPicture->drawLegend(630, 215, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawThreshold.labels.png");
$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" => "../fonts/Silkscreen.ttf", "FontSize" => 6));
$myPicture->drawText(10, 13, "drawStackedAreaChart() - draw a stacked area chart", array("R" => 255, "G" => 255, "B" => 255));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 11));
$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, "Mode" => SCALE_MODE_ADDALL));
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
$myPicture->setShadow(FALSE);
$myPicture->drawStackedAreaChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO, "DrawPlot" => TRUE, "DrawLine" => TRUE, "LineSurrounding" => -250));
/* Draw one static threshold */
$myPicture->drawThreshold(0, array("Alpha" => 70, "Ticks" => 1, "NoMargin" => TRUE));
/* 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, "Mode" => SCALE_MODE_ADDALL, "DrawSubTicks" => TRUE));
$myPicture->setShadow(FALSE);
$myPicture->drawStackedAreaChart(array("Surrounding" => 10));
/* Draw one static threshold */
$myPicture->drawThreshold(0, array("Alpha" => 70, "Ticks" => 1, "NoMargin" => TRUE));
/* 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.drawStackedAreaChart.png");
Example #7
0
 public static function tests_pchart3()
 {
     /* @ 700x230 Filled spline chart drawing example. */
     /* pChart library inclusions */
     include 'lib/pChart/class/pData.class';
     include 'lib/pChart/class/pDraw.class';
     include 'lib/pChart/class/pImage.class';
     /* Create and populate the pData object */
     $MyData = new pData();
     $MyData->setAxisName(0, "Strength");
     for ($i = 0; $i <= 720; $i = $i + 20) {
         $MyData->addPoints(cos(deg2rad($i)) * 100, "Probe 1");
         $MyData->addPoints(cos(deg2rad($i + 90)) * 60, "Probe 2");
     }
     /* Create the pChart object */
     $myPicture = new pImage(847, 304, $MyData);
     $myPicture->drawGradientArea(0, 0, 847, 304, DIRECTION_VERTICAL, array("StartR" => 47, "StartG" => 47, "StartB" => 47, "EndR" => 17, "EndG" => 17, "EndB" => 17, "Alpha" => 100));
     $myPicture->drawGradientArea(0, 250, 847, 304, DIRECTION_VERTICAL, array("StartR" => 47, "StartG" => 47, "StartB" => 47, "EndR" => 27, "EndG" => 27, "EndB" => 27, "Alpha" => 100));
     $myPicture->drawLine(0, 249, 847, 249, array("R" => 0, "G" => 0, "B" => 0));
     $myPicture->drawLine(0, 250, 847, 250, array("R" => 70, "G" => 70, "B" => 70));
     /* Add a border to the picture */
     $myPicture->drawRectangle(0, 0, 846, 303, array("R" => 204, "G" => 204, "B" => 204));
     /* Write the picture title */
     $myPicture->setFontProperties(array("FontName" => CINTIENT_INSTALL_DIR . "lib/pChart/fonts/pf_arma_five.ttf", "FontSize" => 6));
     $myPicture->drawText(423, 14, "Cyclic magnetic field strength", array("R" => 255, "G" => 255, "B" => 255, "Align" => TEXT_ALIGN_MIDDLEMIDDLE));
     /* Define the chart area */
     $myPicture->setGraphArea(58, 27, 816, 228);
     /* Draw a rectangle */
     $myPicture->drawFilledRectangle(58, 27, 816, 228, array("R" => 0, "G" => 0, "B" => 0, "Dash" => TRUE, "DashR" => 0, "DashG" => 51, "DashB" => 51, "BorderR" => 0, "BorderG" => 0, "BorderB" => 0));
     /* Turn on shadow computing */
     $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 20));
     /* Draw the scale */
     $myPicture->setFontProperties(array("R" => 255, "G" => 255, "B" => 255));
     $ScaleSettings = array("XMargin" => 4, "DrawSubTicks" => TRUE, "GridR" => 255, "GridG" => 255, "GridB" => 255, "AxisR" => 255, "AxisG" => 255, "AxisB" => 255, "GridAlpha" => 30, "CycleBackground" => TRUE);
     $myPicture->drawScale($ScaleSettings);
     /* Draw the spline chart */
     $myPicture->drawFilledSplineChart();
     /* Write the chart boundaries */
     $BoundsSettings = array("MaxDisplayR" => 237, "MaxDisplayG" => 23, "MaxDisplayB" => 48, "MinDisplayR" => 23, "MinDisplayG" => 144, "MinDisplayB" => 237);
     $myPicture->writeBounds(BOUND_BOTH, $BoundsSettings);
     /* Write the 0 line */
     $myPicture->drawThreshold(0, array("WriteCaption" => TRUE));
     /* Write the chart legend */
     $myPicture->setFontProperties(array("R" => 255, "G" => 255, "B" => 255));
     $myPicture->drawLegend(560, 266, array("Style" => LEGEND_NOBORDER));
     /* Write the 1st data series statistics */
     $Settings = array("R" => 188, "G" => 224, "B" => 46, "Align" => TEXT_ALIGN_BOTTOMLEFT);
     $myPicture->drawText(620, 270, "Max : " . ceil($MyData->getMax("Probe 1")), $Settings);
     $myPicture->drawText(680, 270, "Min : " . ceil($MyData->getMin("Probe 1")), $Settings);
     $myPicture->drawText(740, 270, "Avg : " . ceil($MyData->getSerieAverage("Probe 1")), $Settings);
     /* Write the 2nd data series statistics */
     $Settings = array("R" => 224, "G" => 100, "B" => 46, "Align" => TEXT_ALIGN_BOTTOMLEFT);
     $myPicture->drawText(620, 283, "Max : " . ceil($MyData->getMax("Probe 2")), $Settings);
     $myPicture->drawText(680, 283, "Min : " . ceil($MyData->getMin("Probe 2")), $Settings);
     $myPicture->drawText(740, 283, "Avg : " . ceil($MyData->getSerieAverage("Probe 2")), $Settings);
     /* Render the picture (choose the best way) */
     $myPicture->autoOutput("pictures/example.drawFilledSplineChart.png");
 }
Example #8
0
        $Config["AxisID"] = $t_axis;
    }
    if ($t_ticks == "true") {
        $Config["Ticks"] = 4;
    } else {
        $Config["Ticks"] = 0;
    }
    if ($t_caption_enabled == "true") {
        $Config["WriteCaption"] = TRUE;
        $Config["Caption"] = $t_caption;
        if ($t_box == "true") {
            $Config["DrawBox"] = TRUE;
        }
    }
    if ($Mode == "Render") {
        $myPicture->drawThreshold($t_value, $Config);
    } else {
        $Config["Caption"] = chr(34) . $t_caption . chr(34);
        echo "\r\n";
        echo dumpArray("Config", $Config);
        echo '$myPicture->drawThreshold(' . $t_value . ',$Config);' . "\r\n";
    }
}
if ($l_enabled == "true") {
    list($R, $G, $B) = extractColors($l_font_color);
    $Config = "";
    $Config["FontR"] = $R;
    $Config["FontG"] = $G;
    $Config["FontB"] = $B;
    $Config["FontName"] = "../../../fonts/" . $l_font;
    $Config["FontSize"] = $l_font_size;
Example #9
0
/* Image creation time */
$myPicture->drawText(1075, 455, date("Y/m/d H:i:s"), array("FontSize" => 10, "Align" => TEXT_ALIGN_BOTTOMRIGHT));
////////////////////////////////////////////////////////////////
// Chart area and Scale
//
/* Line Chart Area */
$myPicture->setGraphArea(100, 40, 980, 400);
/* Scaling Setup */
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
/* Draw Scale */
$myPicture->drawScale($scaleSettings);
////////////////////////////////////////////////////////////////
// Average and Standard Deviation Lines
//
/* Temperature Average Line */
$myPicture->drawThreshold($T_Average, array("AxisID" => 0, "WriteCaption" => FALSE, "Caption" => "Temp Ave", "R" => 0, "G" => 0, "B" => 255));
/* Temperature Standard Deviation Upper */
$myPicture->drawThreshold($T_Average + $T_StandardDeviation, array("AxisID" => 0, "WriteCaption" => FALSE, "Caption" => "Temp SD", "R" => 0, "G" => 0, "B" => 255));
/* Temperature Standard Deviation Lower */
$myPicture->drawThreshold($T_Average - $T_StandardDeviation, array("AxisID" => 0, "WriteCaption" => FALSE, "Caption" => "Temp SD", "R" => 0, "G" => 0, "B" => 255));
/* Humidity Average Line */
$myPicture->drawThreshold($H_Average, array("AxisID" => 1, "WriteCaption" => FALSE, "Caption" => "Pres Ave", "R" => 255, "G" => 0, "B" => 0));
/* Humidity Standard Deviation Upper */
$myPicture->drawThreshold($H_Average + $H_StandardDeviation, array("AxisID" => 1, "WriteCaption" => FALSE, "Caption" => "Pres SD", "R" => 255, "G" => 0, "B" => 0));
/* Humidity Standard Deviation Lower */
$myPicture->drawThreshold($H_Average - $H_StandardDeviation, array("AxisID" => 1, "WriteCaption" => FALSE, "Caption" => "Pres SD", "R" => 255, "G" => 0, "B" => 0));
////////////////////////////////////////////////////////////////
// Draw the Line Chart
//
/* Draw Line Chart */
$myPicture->drawLineChart();
Example #10
0
function block_mystats_quiz_chart($avg, $high, $strAvg, $strHigh, $strTitle, $strScale, $userid)
{
    $myQuizData = new pData();
    $myQuizData->addPoints(array($avg), "Serie1");
    $myQuizData->setSerieDescription("Serie1", $strAvg);
    $myQuizData->setSerieOnAxis("Serie1", 0);
    $myQuizData->addPoints(array($high), "Serie2");
    $myQuizData->setSerieDescription("Serie2", $strHigh);
    $myQuizData->setSerieOnAxis("Serie2", 0);
    $myQuizData->addPoints(array(" "), "Absissa");
    $myQuizData->setAbscissa("Absissa");
    $myQuizData->setAxisPosition(0, AXIS_POSITION_LEFT);
    $myQuizData->setAxisName(0, $strScale);
    $myQuizData->setAxisUnit(0, "");
    $myQuizPicture = new pImage(350, 230, $myQuizData);
    $quizSettings = array("R" => 255, "G" => 255, "B" => 255);
    $myQuizPicture->drawFilledRectangle(0, 0, 350, 230, $quizSettings);
    $myQuizPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 20));
    $myQuizPicture->setFontProperties(array("FontName" => "../blocks/mystats/pChart2.1.3/fonts/GeosansLight.ttf", "FontSize" => 14));
    $TextSettings = array("Align" => TEXT_ALIGN_TOPLEFT, "R" => 0, "G" => 0, "B" => 0);
    $myQuizPicture->drawText(25, 25, $strTitle, $TextSettings);
    $myQuizPicture->setShadow(FALSE);
    $myQuizPicture->setGraphArea(25, 70, 325, 210);
    $myQuizPicture->setFontProperties(array("R" => 0, "G" => 0, "B" => 0, "FontName" => "../blocks/mystats/pChart2.1.3/fonts/pf_arma_five.ttf", "FontSize" => 8));
    $AxisBoundaries = array(0 => array("Min" => 0, "Max" => 110), 1 => array("Min" => 00, "Max" => 1));
    $quizSettings = array("Pos" => SCALE_POS_TOPBOTTOM, "Mode" => SCALE_MODE_MANUAL, "ManualScale" => $AxisBoundaries, "LabelingMethod" => LABELING_ALL, "GridR" => 255, "GridG" => 255, "GridB" => 255, "GridAlpha" => 50, "TickR" => 0, "TickG" => 0, "TickB" => 0, "TickAlpha" => 50, "LabelRotation" => 0, "CycleBackground" => 1, "DrawXLines" => 1, "DrawSubTicks" => 1, "SubTickR" => 255, "SubTickG" => 0, "SubTickB" => 0, "SubTickAlpha" => 50, "DrawYLines" => ALL);
    $myQuizPicture->drawScale($quizSettings);
    $myQuizPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 10));
    $quizConfig = array("DisplayValues" => 1, "Rounded" => 1, "AroundZero" => 1);
    $myQuizPicture->drawBarChart($quizConfig);
    $quizConfig = array("R" => 0, "G" => 0, "B" => 0, "Alpha" => 50, "AxisID" => 0, "Ticks" => 4, "Caption" => "Threshold");
    $myQuizPicture->drawThreshold(0, $quizConfig);
    $quizConfig = array("FontR" => 0, "FontG" => 0, "FontB" => 0, "FontName" => "../blocks/mystats/pChart2.1.3/fonts/pf_arma_five.ttf", "FontSize" => 8, "Margin" => 6, "Alpha" => 30, "BoxSize" => 5, "Style" => LEGEND_ROUND, "Mode" => LEGEND_VERTICAL, "Family" => LEGEND_FAMILY_CIRCLE);
    $myQuizPicture->drawLegend(240, 16, $quizConfig);
    $imgName = sha1($userid . $strTitle) . '.png';
    $myQuizPicture->Render('../blocks/mystats/img/' . $imgName);
    return '<img src="../blocks/mystats/img/' . $imgName . '" alt="' . $strAvg . ': ' . $avg . ', ' . $strHigh . ': ' . $high . '">';
}
$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" => "../fonts/Silkscreen.ttf", "FontSize" => 6));
$myPicture->drawText(10, 13, "drawThreshold() - draw a treshold in the charting area", array("R" => 255, "G" => 255, "B" => 255));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(250, 55, "My chart title", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Draw the scale and do some cosmetics */
$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));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 20));
/* Draw one static threshold */
$myPicture->drawThreshold(5, array("Alpha" => 70, "Ticks" => 1));
/* Draw one static threshold */
$myPicture->drawThreshold(15, array("Alpha" => 70, "Ticks" => 2, "R" => 0, "G" => 0, "B" => 255));
/* Disable shadow computing */
$myPicture->setShadow(FALSE);
/* Draw the scale and do some cosmetics */
$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));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 20));
/* Draw one static threshold */
$myPicture->drawThreshold(5, array("Alpha" => 70, "Ticks" => 1));
/* Draw one static threshold */
$myPicture->drawThreshold(15, array("Alpha" => 70, "Ticks" => 2, "R" => 0, "G" => 0, "B" => 255));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawThreshold.png");
}
$MyData->setAxisName(0, "Temperatures");
$MyData->setAbscissaName("Samples");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(150, 35, "Average temperature", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, 650, 200);
/* Draw the scale */
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Draw the line of best fit */
$myPicture->drawThreshold($MyData->getSerieMedian("Probe 1"), array("WriteCaption" => TRUE, "Caption" => "Median value"));
/* Turn on shadows */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the line chart */
$myPicture->drawPlotChart();
/* Write the chart legend */
$myPicture->drawLegend(580, 20, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.median.png");
$myPicture = new pImage(700, 230, $MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(150, 35, "Average temperature", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, 680, 200);
/* Draw the scale */
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Turn on shadows */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the line chart */
$myPicture->drawPlotChart();
/* Draw the standard mean and the harmonic one */
$Mean = $MyData->getSerieAverage("Probe 1");
$HarmonicMean = $MyData->getHarmonicMean("Probe 1");
$myPicture->drawThreshold($HarmonicMean, array("WriteCaption" => TRUE, "Caption" => "Harmonic mean"));
$myPicture->drawThreshold($Mean, array("WriteCaption" => TRUE, "Caption" => "Mean", "CaptionAlign" => CAPTION_RIGHT_BOTTOM));
/* Write the computed values */
$myPicture->drawText(550, 20, "Arithmetic average : " . round($Mean, 2));
$myPicture->drawText(550, 30, "Harmonic Mean : " . round($HarmonicMean, 2));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.harmonicMean.png");
Example #14
0
/* Draw the scale */
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "GridAlpha" => 100, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Write the chart legend */
//$myPicture->drawLegend(640,20,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Enable shadow computing */
//$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
/* Draw the area chart */
//$Threshold = "";
// $Threshold[] = array("Min"=>0,"Max"=>5,"R"=>187,"G"=>220,"B"=>0,"Alpha"=>100);
//$Threshold[] = array("Min"=>5,"Max"=>10,"R"=>240,"G"=>132,"B"=>20,"Alpha"=>100);
// $Threshold[] = array("Min"=>10,"Max"=>20,"R"=>240,"G"=>91,"B"=>20,"Alpha"=>100);
//$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>20));
//$myPicture->drawAreaChart(array("Threshold"=>$Threshold));
/* Draw a line chart over */
$myPicture->drawLineChart(array("ForceColor" => TRUE, "ForceR" => 0, "ForceG" => 0, "ForceB" => 0));
/* Draw a plot chart over */
//$myPicture->drawPlotChart(array("PlotBorder"=>TRUE,"BorderSize"=>1,"Surrounding"=>-255,"BorderAlpha"=>80));
/* Write the thresholds */
$myPicture->drawThreshold(3000, array("WriteCaption" => FALSE, "Caption" => "tiefentladen", "Alpha" => 70, "Ticks" => 2, "R" => 0, "G" => 0, "B" => 255));
$myPicture->drawThreshold(4250, array("WriteCaption" => FALSE, "Caption" => "tiefentladen", "Alpha" => 70, "Ticks" => 2, "R" => 0, "G" => 0, "B" => 255));
//$myPicture->drawThreshold(10,array("WriteCaption"=>TRUE,"Caption"=>"Error Zone","Alpha"=>70,"Ticks"=>2,"R"=>0,"G"=>0,"B"=>255));
/* Render the picture (choose the best way) */
//imagejpeg ( $myPicture, "myPicture.jpg" , 100);		//saves Image to Server
$myPicture->render("voltage.png");
// debug ==> picture debug... show image
// header('Content-Type: image/png');
// imagejpeg ( $myPicture);
//$myPicture->autoOutput("pictures/example.drawAreaChart.threshold.png");
$myPicture->drawGradientArea(540, 0, 700, 30, 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));
$myPicture->drawRectangle(540, 0, 699, 31, array("R" => 0, "G" => 0, "B" => 0));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 20));
$myPicture->drawText(110, 35, "Functions computing", array("Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, 650, 200);
/* Draw the scale */
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Turn on shadows */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the 0 threshold */
$myPicture->drawThreshold(0, array("Alpha" => 70, "Ticks" => 1));
$myPicture->drawXThreshold(10, array("Alpha" => 70, "Ticks" => 1));
/* Draw a zone chart */
$myPicture->drawZoneChart("Serie 2", "Serie 3", array("AreaR" => 200, "AreaAlpha" => 30));
/* Draw the line chart */
$myPicture->drawLineChart();
$myPicture->drawPlotChart(array("PlotBorder" => TRUE, "BorderSize" => 1, "Surrounding" => -60, "BorderAlpha" => 80));
/* Write the chart legend */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 11, "R" => 255, "G" => 255, "B" => 255));
$myPicture->drawLegend(560, 15, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.createFunctionSerie.png");
$myPicture->setGraphArea(58, 27, 816, 228);
/* Draw a rectangle */
$myPicture->drawFilledRectangle(58, 27, 816, 228, array("R" => 0, "G" => 0, "B" => 0, "Dash" => TRUE, "DashR" => 0, "DashG" => 51, "DashB" => 51, "BorderR" => 0, "BorderG" => 0, "BorderB" => 0));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 20));
/* Draw the scale */
$myPicture->setFontProperties(array("R" => 255, "G" => 255, "B" => 255));
$ScaleSettings = array("XMargin" => 4, "DrawSubTicks" => TRUE, "GridR" => 255, "GridG" => 255, "GridB" => 255, "AxisR" => 255, "AxisG" => 255, "AxisB" => 255, "GridAlpha" => 30, "CycleBackground" => TRUE);
$myPicture->drawScale($ScaleSettings);
/* Draw the spline chart */
$myPicture->drawFilledSplineChart();
/* Write the chart boundaries */
$BoundsSettings = array("MaxDisplayR" => 237, "MaxDisplayG" => 23, "MaxDisplayB" => 48, "MinDisplayR" => 23, "MinDisplayG" => 144, "MinDisplayB" => 237);
$myPicture->writeBounds(BOUND_BOTH, $BoundsSettings);
/* Write the 0 line */
$myPicture->drawThreshold(0, array("WriteCaption" => TRUE));
/* Write the chart legend */
$myPicture->setFontProperties(array("R" => 255, "G" => 255, "B" => 255));
$myPicture->drawLegend(560, 266, array("Style" => LEGEND_NOBORDER));
/* Write the 1st data series statistics */
$Settings = array("R" => 188, "G" => 224, "B" => 46, "Align" => TEXT_ALIGN_BOTTOMLEFT);
$myPicture->drawText(620, 270, "Max : " . ceil($MyData->getMax("Probe 1")), $Settings);
$myPicture->drawText(680, 270, "Min : " . ceil($MyData->getMin("Probe 1")), $Settings);
$myPicture->drawText(740, 270, "Avg : " . ceil($MyData->getSerieAverage("Probe 1")), $Settings);
/* Write the 2nd data series statistics */
$Settings = array("R" => 224, "G" => 100, "B" => 46, "Align" => TEXT_ALIGN_BOTTOMLEFT);
$myPicture->drawText(620, 283, "Max : " . ceil($MyData->getMax("Probe 2")), $Settings);
$myPicture->drawText(680, 283, "Min : " . ceil($MyData->getMin("Probe 2")), $Settings);
$myPicture->drawText(740, 283, "Avg : " . ceil($MyData->getSerieAverage("Probe 2")), $Settings);
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawFilledSplineChart.png");
Example #17
0
$index = 0;
$Alpha = $drawThreshold["Alpha"];
while ($index < sizeof($thresholds)) {
    if ($index == 0) {
        $Test->drawXThresholdArea(0, $thresholds[$index], $drawThreshold);
    } elseif ($index % 2 == 1) {
        if ($index + 1 >= sizeof($thresholds)) {
            $Test->drawXThresholdArea($thresholds[$index], sizeof($hours), $drawThreshold);
        } else {
            $Test->drawXThresholdArea($thresholds[$index], $thresholds[$index + 1], $drawThreshold);
        }
    }
    ++$index;
}
$drawThreshold["Alpha"] = $Alpha;
$Test->drawThreshold(round(max($values), 1), $ThresholdSettings);
//горизонтальная линия по максимальному значению
$Test->drawThreshold(round(min($values), 1), $ThresholdSettings);
//горизонтальная линия по минимальному значению
$Test->drawThreshold(round(array_sum($values) / sizeof($values), 1), $ThresholdSettings);
//горизонтальная линия по среднему значению
//$Test->drawGrid(1,TRUE,230,230,230,10);
if ($_GET['scale'] == 'zero') {
    $temp = $ThresholdSettings["WriteCaption"];
    $ThresholdSettings["WriteCaption"] = FALSE;
    $Test->drawThreshold(0, $ThresholdSettings);
    $ThresholdSettings["WriteCaption"] = $temp;
}
//выводим заголовок графика
if (SETTINGS_THEME == 'light' || $_GET['bg'] == 'light') {
    if ($_GET['title']) {