当前位置: 首页>>代码示例>>PHP>>正文


PHP pImage::drawAreaChart方法代码示例

本文整理汇总了PHP中pImage::drawAreaChart方法的典型用法代码示例。如果您正苦于以下问题:PHP pImage::drawAreaChart方法的具体用法?PHP pImage::drawAreaChart怎么用?PHP pImage::drawAreaChart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pImage的用法示例。


在下文中一共展示了pImage::drawAreaChart方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PlotLine

function PlotLine($rowX, $rowY, $name, $ch)
{
    include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pData.class.php";
    include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pDraw.class.php";
    include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pImage.class.php";
    include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pPie.class.php";
    //**************************************
    $myData = new pData();
    $myData->addPoints($rowX, "Serie1");
    $myData->setSerieDescription("Serie1", $name);
    //$myData->setSerieOnAxis("Serie1",0);
    $myData->addPoints($rowY, "Absissa");
    $myData->setAbscissa("Absissa");
    //$myData->addPoints(array("January","February","March","April","May","June","July","August"),"Absissa");
    //$myData->setAbscissa("Absissa");
    $myData->setAxisPosition(0, AXIS_POSITION_LEFT);
    //$myData->setAxisName(0,"1st axis");
    $myData->setAxisUnit(0, "");
    $myPicture = new pImage(700, 230, $myData);
    $Settings = array("R" => 240, "G" => 242, "B" => 241, "Dash" => 1, "DashR" => 260, "DashG" => 262, "DashB" => 261);
    $myPicture->drawFilledRectangle(0, 0, 700, 230, $Settings);
    $Settings = array("StartR" => 252, "StartG" => 255, "StartB" => 254, "EndR" => 252, "EndG" => 255, "EndB" => 254, "Alpha" => 50);
    $myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, $Settings);
    $myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
    $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 20));
    $myPicture->setFontProperties(array("FontName" => "fonts/Forgotte.ttf", "FontSize" => 14));
    $TextSettings = array("Align" => TEXT_ALIGN_MIDDLEMIDDLE, "R" => 252, "G" => 252, "B" => 252, "DrawBox" => 1, "BoxAlpha" => 30);
    //$myPicture->drawText(350,25,$name,$TextSettings);
    $myPicture->setShadow(FALSE);
    $myPicture->setGraphArea(50, 50, 675, 190);
    //$myPicture->setFontProperties(array("R"=>0,"G"=>0,"B"=>0,"FontName"=>"fonts/pf_arma_five.ttf","FontSize"=>6));
    $Settings = array("Pos" => SCALE_POS_LEFTRIGHT, "Mode" => SCALE_MODE_FLOATING, "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);
    $myPicture->drawScale($Settings);
    $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 10));
    $Config = "";
    if ($ch == 1) {
        $myPicture->drawSplineChart($Config);
    }
    if ($ch == 2) {
        $myPicture->drawBarChart($Config);
    }
    if ($ch == 3) {
        $myPicture->drawLineChart($Config);
    }
    if ($ch == 4) {
        $myPicture->drawPlotChart($Config);
    }
    if ($ch == 5) {
        $myPicture->drawStepChart($Config);
    }
    if ($ch == 6) {
        $myPicture->drawAreaChart($Config);
    }
    if ($ch == 7) {
        $myPicture->drawFilledSplineChart($Config);
    }
    if ($ch == 8) {
        $myPicture->drawFilledStepChart($Config);
    }
    if ($ch == 9) {
        $myPicture->drawStackedAreaChart($Config);
    }
    $Config = array("FontR" => 0, "FontG" => 0, "FontB" => 0, "FontName" => "fonts/pf_arma_five.ttf", "FontSize" => 6, "Margin" => 6, "Alpha" => 30, "BoxSize" => 5, "Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL);
    $myPicture->drawLegend(563, 16, $Config);
    $myPicture->stroke();
}
开发者ID:tarekdjouad,项目名称:TBIMS,代码行数:66,代码来源:Plot.php

示例2: array

$myPicture->setFontProperties(array("FontName" => $LibPath . "fonts/verdana.ttf", "FontSize" => 8));
$myPicture->drawFilledRectangle(0, 0, $Graphwidth, $Graphheigth, $Settings);
$myPicture->drawRectangle(0, 0, $Graphwidth, $Graphheigth, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->drawRectangle(0, 0, $Graphwidth - 1, $Graphheigth - 1, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->setShadow(FALSE);
$myPicture->setGraphArea(50, 30, $Graphwidth - 70, $Graphheigth - 40);
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 20));
$myPicture->setFontProperties(array("FontName" => $LibPath . "fonts/verdana.ttf", "FontSize" => 8));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 10));
$Settings = array("Mode" => SCALE_MODE_FLOATING, "DrawSubTicks" => TRUE, "DrawArrows" => TRUE, "ArrowSize" => 6, "Pos" => SCALE_POS_LEFTRIGHT, "LabelSkip" => 0, "SkippedInnerTickWidth" => 10, "LabelingMethod" => LABELING_ALL, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 20, "TickR" => 0, "TickG" => 0, "TickB" => 0, "TickAlpha" => 20, "LabelRotation" => 90, "DrawXLines" => 1, "DrawSubTicks" => 0, "SubTickR" => 255, "SubTickG" => 0, "SubTickB" => 0, "SubTickAlpha" => 20, "DrawYLines" => ALL);
$myPicture->drawScale($Settings);
$Config = array("DisplayValues" => 0, "AroundZero" => 0, "BreakVoid" => 1, "RecordImageMap" => FALSE);
$GraphType = 'SplineChart';
switch ($GraphType) {
    case 'AreaChart':
        $myPicture->drawAreaChart($Config);
        break;
    case 'FilledSplineChart':
        $myPicture->drawFilledSplineChart($Config);
        break;
    case 'SplineChart':
        $myPicture->drawSplineChart($Config);
        break;
    case 'BarChart':
        $myPicture->drawBarChart($Config, 'tetimes');
        break;
    case 'StackedBarChart':
        $myPicture->drawStackedBarChart($Config);
        break;
    case 'PlotChart':
        $myPicture->drawPlotChart($Config);
开发者ID:nakoukal,项目名称:raspi_www,代码行数:31,代码来源:render_graph.php

示例3: pImage

$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" => "../fonts/Silkscreen.ttf", "FontSize" => 6));
$myPicture->drawText(10, 13, "drawAreaChart() - draw an 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));
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
$myPicture->drawAreaChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO));
/* 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));
$myPicture->drawAreaChart();
/* 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.drawAreaChart.png");
开发者ID:OndroNR,项目名称:bitcoin-hal10k,代码行数:31,代码来源:example.drawAreaChart.php

示例4: array

$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);
/* 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" => 255, "GridG" => 255, "GridB" => 255, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Write the chart legend */
$myPicture->drawLegend(540, 20, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Draw the area chart */
$MyData->setSerieDrawable("Probe 1", TRUE);
$MyData->setSerieDrawable("Probe 2", FALSE);
$myPicture->drawAreaChart();
/* Draw a line and a plot chart on top */
$MyData->setSerieDrawable("Probe 2", TRUE);
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$myPicture->drawLineChart();
$myPicture->drawPlotChart(array("PlotBorder" => TRUE, "PlotSize" => 3, "BorderSize" => 1, "Surrounding" => -60, "BorderAlpha" => 80));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.Combo.area.lines.png");
开发者ID:OndroNR,项目名称:bitcoin-hal10k,代码行数:31,代码来源:example.Combo.area.lines.php

示例5: array

/* 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");
开发者ID:OUARKA,项目名称:qcm-cms,代码行数:31,代码来源:example.drawAreaChart.threshold.php

示例6: drawImage

 public function drawImage()
 {
     $qr_result = $this->values;
     //var_dump($qr_result);die();
     $va_columns = $this->parameters["columns"];
     $width = $this->parameters["width"];
     $format = $this->parameters["format"];
     $va_charting_columns = $this->parameters["charting_columns"];
     $va_chart_types = $this->parameters["chart_types"];
     $qr_result->seek();
     if ($qr_result->numRows() == 0) {
         //if no result nothing to do
         return false;
     }
     // Loading chart format specifications
     // TODO : this coding part should be out of this function, sending values in 1 parameter
     if (is_array($va_chart_types)) {
         foreach ($va_chart_types as $type => $settings) {
             if ($type == $format) {
                 $chart_type = $settings["googletype"];
                 $message = $settings["message"];
             }
         }
     }
     /* Create and populate the pData object */
     $MyData = new pData();
     // Fulfillment of the results
     $va_row_no = 0;
     $va_content = array();
     while ($qr_result->nextRow()) {
         $va_column_no = 0;
         foreach ($va_columns as $va_column => $va_column_label) {
             // only render columns specified in XML field charting_columns
             if (in_array($va_column_label, $va_charting_columns)) {
                 $va_content[$va_column_label][$va_row_no] = $qr_result->get($va_column_label);
                 $va_column_no++;
             }
         }
         $va_row_no++;
     }
     //var_dump($va_content);
     $va_row_no = 0;
     foreach ($va_charting_columns as $va_column_label) {
         //print "MyData->addPoints(\"".implode("\",\"",$va_content[$va_column_label])."\",\"".$va_column_label."\");<br/>";
         $MyData->addPoints($va_content[$va_column_label], $va_column_label);
         if ($va_row_no == 0) {
             //print "MyData->setAbscissa(\"Labels\")<br/>";
             $MyData->setAbscissa($va_column_label);
         } else {
             //print "MyData->setSerieDescription(\"".$va_column_label."\",\"".$va_column_label."\");<br/>";
             $MyData->setSerieDescription($va_column_label, $va_column_label);
         }
         $va_row_no++;
     }
     /* Create the pChart object */
     $myPicture = new pImage($width, $width / 2, $MyData);
     /* Set the common properties */
     $myPicture->setFontProperties(array("FontName" => __CA_STATISTICSVIEWER_CLASS_DIR__ . "/fonts/verdana.ttf", "FontSize" => 0.014 * $width, "R" => 80, "G" => 80, "B" => 80));
     $RectangleSettings = array("R" => 200, "G" => 200, "B" => 200);
     $myPicture->drawRectangle(1, 1, $width - 1, $width / 2 - 1, $RectangleSettings);
     $myPicture->setGraphArea($width / 9, $width / 10, $width * 0.75, $width * 0.4);
     // if not pie, draw the legend
     if ($format != "pie") {
         $myPicture->drawLegend($width * 0.8, $width * 0.05, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
     }
     switch ($format) {
         case "bar":
             $myPicture->drawScale(array("Pos" => SCALE_POS_TOPBOTTOM, "DrawSubTicks" => FALSE, "RemoveYAxis" => TRUE, "GridAlpha" => 90, "DrawXLines" => FALSE));
             $myPicture->drawBarChart();
             break;
         case "column":
             $myPicture->drawScale(array("DrawSubTicks" => FALSE, "RemoveYAxis" => TRUE, "GridAlpha" => 90, "DrawXLines" => FALSE));
             $myPicture->drawBarChart();
             break;
         case "step":
             $myPicture->drawScale(array("DrawXLines" => FALSE, "DrawYLines" => ALL, "GridR" => 127, "GridG" => 127, "GridB" => 127));
             $myPicture->drawStepChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO));
             break;
         case "area":
             $myPicture->drawScale(array("DrawXLines" => FALSE, "DrawYLines" => ALL, "GridR" => 127, "GridG" => 127, "GridB" => 127));
             $myPicture->drawAreaChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO));
             break;
         case "pie":
             $PieChart = new pPie($myPicture, $MyData);
             $PieChart->draw2DPie(0.4 * $width, 0.25 * $width, array("WriteValues" => PIE_VALUE_PERCENTAGE, "ValueR" => 95, "ValueG" => 95, "ValueB" => 95, "ValuePadding" => 0.03 * $width, "Radius" => 0.16 * $width, "SecondPass" => TRUE, "Border" => TRUE, "Precision" => 0));
             $myPicture->setShadow(FALSE);
             $myPicture->setFontProperties(array("FontName" => __CA_STATISTICSVIEWER_CLASS_DIR__ . "/fonts/verdana.ttf", "FontSize" => 0.018 * $width, "R" => 80, "G" => 80, "B" => 80));
             $PieChart->drawPieLegend(0.8 * $width, 0.05 * $width, array("Style" => LEGEND_NOBORDER, "BoxSize" => $width / 60, "FontR" => 0, "FontG" => 0, "FontB" => 0));
             break;
         case "line":
         default:
             $myPicture->drawScale(array("DrawXLines" => FALSE, "DrawYLines" => ALL, "GridR" => 127, "GridG" => 127, "GridB" => 127));
             $myPicture->drawLineChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO));
             break;
     }
     /* Render the picture (choose the best way) */
     $myPicture->autoOutput();
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:98,代码来源:chartpChartClass.php

示例7: pImage

            $data->addPoints($readings, 'Disk Used');
            $data->setAxisName(0, "Gigabytes");
        }
    }
}
// Read data from the database, and add it
$data->addPoints($times, "Labels");
$data->setSerieDescription("Labels", "Time of day");
$data->setAbscissa("Labels");
$chart = new pImage(700, 230, $data);
/* Turn of Antialiasing */
$chart->Antialias = FALSE;
/* Add a border to the picture */
$chart->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
/* Write the chart title */
$chart->setFontProperties(array("FontName" => FONT_PATH . "/Forgotte.ttf", "FontSize" => 11));
$chart->drawText(150, 35, $title, array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Set the default font */
$chart->setFontProperties(array("FontName" => FONT_PATH . "/pf_arma_five.ttf", "FontSize" => 6));
/* Define the chart area */
$chart->setGraphArea(60, 40, 650, 200);
/* Draw the scale */
$chart->drawScale($scaleSettings);
/* Write the chart legend */
$chart->drawLegend(540, 20, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Turn on Antialiasing */
$chart->Antialias = TRUE;
/* Draw the area chart */
$chart->drawAreaChart();
/* Render the picture (choose the best way) */
$chart->stroke();
开发者ID:TuffLuck,项目名称:status2,代码行数:31,代码来源:graph.php

示例8: drawCharts

 private function drawCharts($filename, $yAxisLabel, $dataSeriesAllTime, $labelSeriesAllTime, $dataSeriesLast2Month, $labelSeriesLast2Month)
 {
     /* Build the dataset for all time*/
     $allTimeData = new pData();
     $allTimeData->addPoints($dataSeriesAllTime, "members");
     $allTimeData->setAxisName(0, $yAxisLabel);
     $allTimeData->addPoints($labelSeriesAllTime, "Labels");
     $serieSettings = array("R" => 74, "G" => 102, "B" => 27, "Alpha" => 90);
     $allTimeData->setPalette("members", $serieSettings);
     // $allTimeData->setSerieOnAxis("Labels", 1);
     $allTimeData->setAbscissa("Labels");
     /* Create the chart*/
     $allTimePicture = new pImage(400, 250, $allTimeData, true);
     $allTimePicture->setFontProperties(array("FontName" => "../lib/pchart-2.1.3/fonts/verdana.ttf", "FontSize" => 6));
     /* Add a border to the picture */
     $allTimePicture->setGraphArea(50, 20, 380, 210);
     $allTimePicture->drawFilledRectangle(50, 20, 380, 210, array("R" => 232, "G" => 238, "B" => 248, "Alpha" => 100));
     $allTimePicture->drawScale(array("XMargin" => 0, "DrawSubTicks" => true, "DrawXLines" => false, "Mode" => SCALE_MODE_START0, "CycleBackground" => true, "LabelSkip" => 52, "ForceTransparency" => 0));
     $allTimePicture->drawAreaChart(array("DisplayValues" => false, "DisplayColor" => DISPLAY_AUTO, ""));
     $allTimePicture->render($filename . "-alltime.png");
     /* Build the dataset for the last two month */
     $last2MonthData = new pData();
     $last2MonthData->addPoints($dataSeriesLast2Month, "members");
     $last2MonthData->setAxisName(0, $yAxisLabel);
     $last2MonthData->addPoints($labelSeriesLast2Month, "Labels");
     $last2MonthData->setPalette("members", $serieSettings);
     $last2MonthData->setAbscissa("Labels");
     /* Create the chart*/
     $last2MonthPicture = new pImage(400, 250, $last2MonthData, true);
     $last2MonthPicture->setFontProperties(array("FontName" => "../lib/pchart-2.1.3/fonts/verdana.ttf", "FontSize" => 6));
     $last2MonthPicture->Antialias = true;
     /* Add a border to the picture */
     $last2MonthPicture->setGraphArea(50, 20, 380, 210);
     $miny = min($dataSeriesLast2Month);
     $maxy = max($dataSeriesLast2Month);
     $axisBoundaries = array(0 => array("Min" => $miny, "Max" => $maxy));
     $last2MonthPicture->drawFilledRectangle(50, 20, 380, 210, array("R" => 232, "G" => 238, "B" => 248, "Alpha" => 100));
     $last2MonthPicture->drawScale(array("DrawSubTicks" => true, "DrawXLines" => true, "CycleBackground" => true, "LabelSkip" => 13, "Mode" => SCALE_MODE_MANUAL, "ManualScale" => $axisBoundaries));
     // get min and max values set scales accordingly
     $last2MonthPicture->drawAreaChart(array("DisplayValues" => false, "DisplayColor" => DISPLAY_AUTO, ""));
     $last2MonthPicture->render($filename . "-last2month.png");
 }
开发者ID:gpuenteallott,项目名称:rox,代码行数:42,代码来源:stats.model.php

示例9: createGraphe

function createGraphe($vData, $hData, $titre, $vLabel, $hLabel)
{
    $MyData = new pData();
    /*Je présente ma série de données à utiliser pour le graphique et je détermine le titre de l'axe vertical avec setAxisName*/
    $MyData->addPoints($vData, "vertical");
    $MyData->setSerieWeight("vertical", 2);
    $MyData->setAxisName(0, $vLabel);
    /*J'indique les données horizontales du graphique. Il doit y avoir le même nombre que pour ma série de données précédentes (logique)*/
    $MyData->addPoints($hData, "horizontal");
    $MyData->setSerieDescription("horizontal", $hLabel);
    $MyData->setAbscissa("horizontal");
    $MyData->setPalette("vertical", array("R" => 255, "G" => 0, "B" => 0));
    /* Je crée l'image qui contiendra mon graphique précédemment crée */
    $myPicture = new pImage(900, 400, $MyData);
    /* Je crée une bordure à mon image */
    $myPicture->drawRectangle(0, 0, 899, 399, array("R" => 0, "G" => 0, "B" => 0));
    /* J'indique le titre de mon graphique, son positionnement sur l'image et sa police */
    $myPicture->setFontProperties(array("FontName" => "./pChart2.1.4/fonts/Forgotte.ttf", "FontSize" => 11));
    $myPicture->drawText(200, 25, $titre, array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
    /* Je choisi la font de mon graphique */
    $myPicture->setFontProperties(array("FontName" => "./pChart2.1.4/fonts/pf_arma_five.ttf", "FontSize" => 6));
    /* Je détermine la taille du graphique et son emplacement dans l'image */
    $myPicture->setGraphArea(60, 40, 800, 380);
    /* Paramètres pour dessiner le graphique à partir des deux abscisses */
    $scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => FALSE, "CycleBackground" => TRUE, "LabelSkip" => 4);
    $myPicture->drawScale($scaleSettings);
    /* Je dessine mon graphique en fonction des paramètres précédents */
    $myPicture->drawAreaChart();
    $myPicture->drawLineChart();
    /* J'indique le chemin où je souhaite que mon image soit créée */
    $myPicture->Render("img/" . $titre . ".png");
}
开发者ID:adib0u,项目名称:Model_math_finance,代码行数:32,代码来源:emprunt.php

示例10: pch_vertical_graph


//.........这里部分代码省略.........
        $MyData->addPoints($values, $point_id);
        if (!empty($rgb_color)) {
            $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']));
            /*$palette_color = array();
            			if (isset($rgb_color[$i]['color'])) {
            				$palette_color["R"] = $rgb_color[$i]['color']["R"];
            				$palette_color["G"] = $rgb_color[$i]['color']["G"];
            				$palette_color["B"] = $rgb_color[$i]['color']["B"];
            			}
            	 		if (isset($rgb_color[$i]['color'])) {
            				$palette_color["BorderR"] = $rgb_color[$i]['border']["R"];
            				$palette_color["BorderG"] = $rgb_color[$i]['border']["G"];
            				$palette_color["BorderB"] = $rgb_color[$i]['border']["B"];
            			}
            			if (isset($rgb_color[$i]['color'])) {
            				$palette_color["Alpha"] = $rgb_color[$i]['Alpha'];
            			}
            		
            			$MyData->setPalette($point_id, $palette_color);*/
        }
        $MyData->setSerieWeight($point_id, 1);
    }
    //$MyData->addPoints($data,"Yaxis");
    $MyData->setAxisName(0, $yaxisname);
    $MyData->addPoints($index, "Xaxis");
    $MyData->setSerieDescription("Xaxis", $xaxisname);
    $MyData->setAbscissa("Xaxis");
    /* Create the pChart object */
    $myPicture = new pImage($width, $height, $MyData);
    /* Turn of Antialiasing */
    $myPicture->Antialias = $antialiasing;
    /* 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));
    if (isset($legend)) {
        /* Set horizontal legend if is posible */
        $legend_mode = LEGEND_HORIZONTAL;
        $size = $myPicture->getLegendSize(array("Style" => LEGEND_NOBORDER, "Mode" => $legend_mode));
        if ($size['Width'] > $width - 5) {
            $legend_mode = LEGEND_VERTICAL;
            $size = $myPicture->getLegendSize(array("Style" => LEGEND_NOBORDER, "Mode" => $legend_mode));
        }
        /* Write the chart legend */
        $myPicture->drawLegend($width - $size['Width'], 8, array("Style" => LEGEND_NOBORDER, "Mode" => $legend_mode));
    }
    //Calculate the bottom margin from the size of string in each index
    $max_chars = 0;
    foreach ($index as $string_index) {
        if (empty($string_index)) {
            continue;
        }
        $len = strlen($string_index);
        if ($len > $max_chars) {
            $max_chars = $len;
        }
    }
    $margin_bottom = 10 * $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, $height - $water_mark_height - $margin_bottom, $water_mark);
    }
    if (isset($size['Height'])) {
        /* Define the chart area */
        $myPicture->setGraphArea(40, $size['Height'], $width - $water_mark_width, $height - $margin_bottom);
    } else {
        /* Define the chart area */
        $myPicture->setGraphArea(40, 5, $width - $water_mark_width, $height - $margin_bottom);
    }
    /* Draw the scale */
    $scaleSettings = array("GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE, "Mode" => SCALE_MODE_START0, "LabelRotation" => 60, "XMargin" => 0);
    $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";
            break;
        default:
            $ForceTransparency = "50";
            break;
    }
    /* Draw the chart */
    $settings = array("ForceTransparency" => $ForceTransparency, "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 "stacked_area":
        case "area":
            $myPicture->drawAreaChart($settings);
            break;
        case "line":
            $myPicture->drawLineChart($settings);
            break;
    }
    /* Render the picture */
    $myPicture->stroke();
}
开发者ID:articaST,项目名称:integriaims,代码行数:101,代码来源:functions_pchart.php

示例11: array

    }
} else {
    if ($_GET['title']) {
        $Test->drawText($left_border, $title_top_offset, $_GET['title'], array("FontSize" => $title_fontsize, "R" => 250, "G" => 250, "B" => 250, "Align" => TEXT_ALIGN_BOTTOMLEFT));
    } else {
        $Test->drawText($left_border, $title_top_offset, $p, array("FontSize" => $title_fontsize, "R" => 250, "G" => 250, "B" => 250, "Align" => TEXT_ALIGN_BOTTOMLEFT));
    }
}
// рисуем график
if ($_GET['gtype'] == 'curve') {
    //рисуем сглаженый график
    //$Test->drawCubicCurve($DataSet->GetData(),$DataSet->GetDataDescription());
    //$Test->clearShadow();
    //$Test->drawFilledCubicCurve($DataSet->GetData(),$DataSet->GetDataDescription(),.1,30, FALSE);
    $Test->drawSplineChart(array("DisplayValues" => FALSE, "BreakVoid" => FALSE, "VoidTicks" => 0, "DisplayColor" => DISPLAY_AUTO));
    $Test->drawAreaChart(array("AroundZero" => FALSE));
    // заполнение снизу до кривой графика
    // $Test->drawAreaChart(array("AroundZero"=>TRUE)); // заполнение от нуля до кривой графика
} elseif ($_GET['gtype'] == 'bar') {
    //рисуем столбы
    //$Test->drawFilledRectangle(60,60,450,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));
    //$Test->drawScale(array("DrawSubTicks"=>TRUE));
    $Test->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
    //$Test->setFontProperties(array("FontName"=>"../fonts/pf_arma_five.ttf","FontSize"=>6));
    $Test->drawBarChart(array("DisplayValues" => FALSE, "Interleave" => 0.2, "Gradient" => TRUE, "DisplayColor" => DISPLAY_AUTO, "Rounded" => FALSE, "AroundZero" => TRUE, "Surrounding" => 0));
} else {
    //рисуем прямолинейный график
    //$Test->drawLineGraph($DataSet->GetData(),$DataSet->GetDataDescription());
    //$Test->clearShadow();
    //$Test->drawFilledLineGraph($DataSet->GetData(),$DataSet->GetDataDescription(), 30);
    $Test->drawLineChart(array("DisplayValues" => FALSE, "BreakVoid" => FALSE, "VoidTicks" => 0, "DisplayColor" => DISPLAY_AUTO));
开发者ID:NioFBI,项目名称:majordomo,代码行数:31,代码来源:index.php

示例12: displayGraph


//.........这里部分代码省略.........
                         $mydatat[$name] = array();
                     }
                     array_push($mydatat[$name], $value);
                 }
             }
             $ret = $pmServiceevent->getRef($rrdtool_template);
             $a_ref = $ret[0];
             break;
         case '1y':
             $begin = date('Y-m-d H:i:s', date('U') - 365 * 24 * 3600);
             $query = "SELECT * FROM `" . $this->getTable() . "`\n               WHERE `plugin_monitoring_services_id`='" . $items_id . "'\n                  AND `type`='10d'\n               ORDER BY `date`";
             $result = $DB->query($query);
             while ($edata = $DB->fetch_array($result)) {
                 $dat = importArrayFromDB($edata['data']);
                 if (count($dat) > 0) {
                     $datemod = $edata['date'];
                     $daynum = date('m', PluginMonitoringServiceevent::convert_datetime_timestamp($edata['date']));
                     $daynum = $daynum - 1;
                     $split = explode(' ', $datemod);
                     $day = explode("-", $split[0]);
                     array_push($a_labels, $LANG['calendarM'][$daynum] . " " . $day[2]);
                 }
                 foreach ($dat as $name => $value) {
                     if (!isset($mydatat[$name])) {
                         $mydatat[$name] = array();
                     }
                     array_push($mydatat[$name], $value);
                 }
             }
             $ret = $pmServiceevent->getRef($rrdtool_template);
             $a_ref = $ret[0];
             break;
     }
     $i = 0;
     foreach ($mydatat as $name => $data) {
         $i++;
         if ($i == '2') {
             $datat = $data;
             $data = array();
             foreach ($datat as $val) {
                 array_push($data, -$val);
             }
         }
         if (empty($data)) {
             array_push($data, 0);
         }
         $MyData->addPoints($data, $name);
         $color = str_split($a_ref[$name]);
         $MyData->setPalette($name, array("R" => hexdec($color[0] . $color[1]), "G" => hexdec($color[2] . $color[3]), "B" => hexdec($color[4] . $color[5])));
     }
     $MyData->setAxisDisplay(0, AXIS_FORMAT_METRIC, 1);
     //    $MyData->setSerieTicks("Probe 2",4);
     //    $MyData->setAxisName(0,"Temperatures");
     $MyData->addPoints($a_labels, "Labels");
     //    $MyData->setSerieDescription("Labels","Months");
     $MyData->setAbscissa("Labels");
     $myPicture = new pImage(700, 230, $MyData);
     $myPicture->Antialias = FALSE;
     $Settings = array("R" => 225, "G" => 204, "B" => 123);
     $myPicture->drawFilledRectangle(0, 0, 700, 230, $Settings);
     $Settings = array("R" => 255, "G" => 255, "B" => 255);
     $myPicture->drawFilledRectangle(60, 40, 650, 200, $Settings);
     /* 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" => "../lib/pChart2.1.3/fonts/verdana.ttf", "FontSize" => 11));
     $myPicture->drawText(350, 20, $a_jsong->data[0]->labels[0]->title, array("FontSize" => 13, "Align" => TEXT_ALIGN_MIDDLEMIDDLE));
     /* Set the default font */
     $myPicture->setFontProperties(array("FontName" => "../lib/pChart2.1.3/fonts/verdana.ttf", "FontSize" => 7));
     /* Define the chart area */
     $myPicture->setGraphArea(60, 40, 650, 200);
     /* Draw the scale */
     $labelskip = round(count($a_labels) / 8);
     if ($time == '1d') {
         $labelskip = 3;
     } else {
         if ($time == '1m') {
             $labelskip = 3;
         } else {
             if ($time == '0y6m') {
                 $labelskip = 4;
             } else {
                 if ($time == '1y') {
                     $labelskip = 3;
                 }
             }
         }
     }
     $scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 158, "GridG" => 158, "GridB" => 158, "GridAlpha" => 80, "DrawSubTicks" => TRUE, "CycleBackground" => FALSE, "LabelSkip" => $labelskip);
     $myPicture->drawScale($scaleSettings);
     /* Write the chart legend */
     $myPicture->drawLegend(540, 20, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
     /* Turn on Antialiasing */
     $myPicture->Antialias = TRUE;
     $Config = array("ForceTransparency" => 60);
     /* Draw the area chart */
     $myPicture->drawAreaChart($Config);
     $myPicture->render(GLPI_PLUGIN_DOC_DIR . "/monitoring/" . $itemtype . "-" . $items_id . "-" . $time . $timezonefile . ".png");
     return;
 }
开发者ID:RubichonL,项目名称:glpi_monitoring,代码行数:101,代码来源:servicegraph.class.php


注:本文中的pImage::drawAreaChart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。