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


PHP pChart::drawFilledRectangle方法代码示例

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


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

示例1: draw_rectangle

/**
 * Draws a rectangle on the provided chart
 *
 * @param  pChart   $chart        The chart to draw on
 * @param  int      $x1           Leftmost x value
 * @param  int      $y1           Topmost y value
 * @param  int      $x2           Rightmost x value
 * @param  int      $y2           Topmost y value
 * @param  array    $color_array  The colors to use
 * @param  boolean  $filled       Whether to fill the area
 */
function draw_rectangle(&$chart, $x1, $y1, $x2, $y2, $color_array, $filled = true)
{
    if ($filled) {
        $chart->drawFilledRectangle($x1, $y1, $x2, $y2, $color_array['r'], $color_array['g'], $color_array['b']);
    } else {
        $chart->drawRectangle($x1, $y1, $x2, $y2, $color_array['r'], $color_array['g'], $color_array['b']);
    }
}
开发者ID:jamesmcq,项目名称:elis,代码行数:19,代码来源:horizontalbar.php

示例2: createGraphToFile

/**
 * Генерация графика
 * @param DataSet $DataSet
 * @param String $GraphTitle
 * @param String $safeToFile
 */
function createGraphToFile($DataSet, $GraphTitle, $safeToFile, $scaleFormat)
{
    // Rotrate
    $rotate = 30;
    // Initialise the graph
    $GraphImage = new pChart(594, 344);
    $GraphImage->setDateFormat($scaleFormat);
    // $GraphImage->loadColorPalette(DIR_FONT.'/tones-3.txt');
    $GraphImage->setFontProperties(DIR_FONT . "/segoepr.ttf", 8);
    $GraphImage->setGraphArea(80, 50, 580, 300);
    $GraphImage->drawFilledRectangle(3, 3, 590, 340, 240, 240, 240);
    $GraphImage->drawRectangle(0, 0, 593, 343, 230, 230, 230);
    $GraphImage->drawGraphArea(255, 255, 255, TRUE);
    $GraphImage->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, $rotate, 0, FALSE);
    $GraphImage->drawGrid(4, TRUE, 230, 230, 230, 50);
    // Draw the 0 line
    $GraphImage->setFontProperties(DIR_FONT . "/segoepr.ttf", 6);
    $GraphImage->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
    // Просто пунктирная линия
    // Draw the cubic curve graph
    $GraphImage->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
    // Draw the line graph
    //$GraphImage->drawLineGraph($DataSet->GetData(),$DataSet->GetDataDescription());
    $GraphImage->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
    // Finish the graph
    $GraphImage->setFontProperties(DIR_FONT . "/segoepr.ttf", 12);
    $GraphImage->drawTitle(60, 32, $GraphTitle, 50, 50, 50, 600);
    //$GraphImage->Render(DIR_CACHE . './' . $safeToFile . '.png');
    $GraphImage->Stroke();
}
开发者ID:rootree,项目名称:vk-footboller-content-system,代码行数:36,代码来源:graph.php

示例3: createChart


//.........这里部分代码省略.........
                    if (preg_match("^[A-Za-z]^", $kkey)) {
                        //auto detect if english
                        $lblout[] = $kkey . ' (' . $kval . ')';
                    } else {
                        $lblout[] = $Arabic->utf8Glyphs($kkey . ' )' . $kval . '(');
                    }
                }
            } elseif (getLanguageRTL($language)) {
                foreach ($lbl as $kkey => $kval) {
                    $lblout[] = UTF8Strrev($kkey . ' )' . $kval . '(');
                }
            } else {
                foreach ($lbl as $kkey => $kval) {
                    $lblout[] = $kkey . ' (' . $kval . ')';
                }
            }
            $counter = 0;
            foreach ($lblout as $sLabelName) {
                $DataSet->SetSerieName(html_entity_decode($sLabelName, null, 'UTF-8'), "Serie{$counter}");
                $counter++;
            }
            if ($cache->IsInCache("graph" . $iSurveyID . $language . $iQuestionID, $DataSet->GetData()) && Yii::app()->getConfig('debug') < 2) {
                $cachefilename = basename($cache->GetFileFromCache("graph" . $iSurveyID . $language . $iQuestionID, $DataSet->GetData()));
            } else {
                $graph = new pChart(1, 1);
                $graph->setFontProperties($rootdir . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR . $chartfontfile, $chartfontsize);
                $legendsize = $graph->getLegendBoxSize($DataSet->GetDataDescription());
                if ($legendsize[1] < 320) {
                    $gheight = 420;
                } else {
                    $gheight = $legendsize[1] + 100;
                }
                $graph = new pChart(690 + $legendsize[0], $gheight);
                $graph->drawFilledRectangle(0, 0, 690 + $legendsize[0], $gheight, 254, 254, 254, false);
                $graph->loadColorPalette($homedir . DIRECTORY_SEPARATOR . 'styles' . DIRECTORY_SEPARATOR . $admintheme . DIRECTORY_SEPARATOR . 'limesurvey.pal');
                $graph->setFontProperties($rootdir . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR . $chartfontfile, $chartfontsize);
                $graph->setGraphArea(50, 30, 500, $gheight - 60);
                $graph->drawFilledRoundedRectangle(7, 7, 523 + $legendsize[0], $gheight - 7, 5, 254, 255, 254);
                $graph->drawRoundedRectangle(5, 5, 525 + $legendsize[0], $gheight - 5, 5, 230, 230, 230);
                $graph->drawGraphArea(254, 254, 254, TRUE);
                $graph->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, 90, 0, TRUE, 5, false);
                $graph->drawGrid(4, TRUE, 230, 230, 230, 50);
                // Draw the 0 line
                $graph->setFontProperties($rootdir . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR . $chartfontfile, $chartfontsize);
                $graph->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
                // Draw the bar graph
                $graph->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), FALSE);
                //$Test->setLabel($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie4","1","Important point!");
                // Finish the graph
                $graph->setFontProperties($rootdir . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR . $chartfontfile, $chartfontsize);
                $graph->drawLegend(510, 30, $DataSet->GetDataDescription(), 250, 250, 250);
                $cache->WriteToCache("graph" . $iSurveyID . $language . $iQuestionID, $DataSet->GetData(), $graph);
                $cachefilename = basename($cache->GetFileFromCache("graph" . $iSurveyID . $language . $iQuestionID, $DataSet->GetData()));
                unset($graph);
            }
        } else {
            // this block is to remove the items with value == 0
            // and an inelegant way to remove comments from List with Comments questions
            $i = 0;
            $j = 0;
            $labelTmp = array();
            while (isset($gdata[$i])) {
                $aHelperArray = array_keys($lbl);
                if ($gdata[$i] == 0 || $sQuestionType == "O" && substr($aHelperArray[$i], 0, strlen($oLanguage->gT("Comments"))) == $oLanguage->gT("Comments")) {
                    array_splice($gdata, $i, 1);
                } else {
开发者ID:krsandesh,项目名称:LimeSurvey,代码行数:67,代码来源:statistics_helper.php

示例4: preGraphCreation

 /**
  * Creates the object and prepares it for rendering.
  * Does all the calculation like borders, margins, paddings ....
  *
  * @return void
  */
 private function preGraphCreation()
 {
     // Initialize the graph
     $this->objChart = new pChart($this->intWidth, $this->intHeight);
     //set the color palette to be used
     foreach ($this->arrDefaultColorPalette as $intKey => $strCurrentColor) {
         $arrCurColor = hex2rgb($strCurrentColor);
         $this->objChart->setColorPalette($intKey, $arrCurColor[0], $arrCurColor[1], $arrCurColor[2]);
     }
     //calculate all needed params, draw that funky shit
     //the outer bounding and pane - rounded and with sharp corners
     $arrBackgroundColor = hex2rgb($this->strBackgroundColor);
     if ($this->bitRoundedCorners) {
         $this->objChart->drawFilledRoundedRectangle(2, 2, $this->intWidth - 3, $this->intHeight - 3, 5, $arrBackgroundColor[0], $arrBackgroundColor[1], $arrBackgroundColor[2]);
         $arrOuterBack = hex2rgb($this->strOuterFrameColor);
         $this->objChart->drawRoundedRectangle(0, 0, $this->intWidth - 1, $this->intHeight - 1, 5, $arrOuterBack[0], $arrOuterBack[1], $arrOuterBack[2]);
     } else {
         $this->objChart->drawFilledRectangle(0, 0, $this->intWidth, $this->intHeight, $arrBackgroundColor[0], $arrBackgroundColor[1], $arrBackgroundColor[2]);
     }
     //the graph area - x and or y-axis label present?
     if ($this->bitRenderLegend) {
         $intRightMargin = 10;
     } else {
         $intRightMargin = 20;
     }
     $intTopMargin = 15;
     $intBottomMargin = 30;
     $intLeftMargin = 40;
     $intLegendWidth = 0;
     if ($this->bitRenderLegend) {
         $intLegendWidth = 120;
     }
     $intWidth = $this->intWidth - $intRightMargin - $intLegendWidth;
     $intHeight = $this->intHeight - $intBottomMargin;
     $intLeftStart = $intLeftMargin;
     $intTopStart = $intTopMargin;
     if ($this->strYAxisTitle != "") {
         $intLeftStart += 15;
         //$intWidth -= 15; //TODO: why not needed?
     }
     if ($this->strXAxisTitle != "") {
         $intHeight -= 15;
     }
     if ($this->strGraphTitle != "") {
         //$intHeight -= 12; //TODO: why not needed???
         $intTopStart += 12;
     }
     if ($this->intCurrentGraphMode != $this->GRAPH_TYPE_PIE) {
         $this->objChart->setGraphArea($intLeftStart, $intTopStart, $intWidth, $intHeight);
         $arrPaneBackground = hex2rgb($this->strGraphBackgroundColor);
         $this->objChart->drawGraphArea($arrPaneBackground[0], $arrPaneBackground[1], $arrPaneBackground[2], true);
     }
     $arrFontColors = hex2rgb($this->strFontColor);
     $this->objChart->setFontProperties(class_resourceloader::getInstance()->getCorePathForModule("module_system", true) . "/module_system/system" . $this->strFont, 8);
     //set up the axis-titles
     if ($this->intCurrentGraphMode == $this->GRAPH_TYPE_BAR || $this->intCurrentGraphMode == $this->GRAPH_TYPE_STACKEDBAR || $this->intCurrentGraphMode == $this->GRAPH_TYPE_LINE) {
         if ($this->strXAxisTitle != "") {
             $this->objDataset->SetXAxisName($this->strXAxisTitle);
         }
         if ($this->strYAxisTitle != "") {
             $this->objDataset->SetYAxisName($this->strYAxisTitle);
         }
     }
     //the x- and y axis, in- / exclusive margins
     if ($this->bitAdditionalDatasetAdded && $this->bitScaleFromAdditionalDataset) {
         $this->objChart->drawScale($this->objAdditionalDataset->GetData(), $this->objAdditionalDataset->GetDataDescription(), SCALE_START0, $arrFontColors[0], $arrFontColors[1], $arrFontColors[2], TRUE, $this->intXAxisAngle, 1, true);
     } else {
         if ($this->intCurrentGraphMode == $this->GRAPH_TYPE_BAR) {
             $this->objChart->drawScale($this->objDataset->GetData(), $this->objDataset->GetDataDescription(), SCALE_START0, $arrFontColors[0], $arrFontColors[1], $arrFontColors[2], TRUE, $this->intXAxisAngle, 1, true);
         } else {
             if ($this->intCurrentGraphMode == $this->GRAPH_TYPE_STACKEDBAR) {
                 $this->objChart->drawScale($this->objDataset->GetData(), $this->objDataset->GetDataDescription(), SCALE_ADDALLSTART0, $arrFontColors[0], $arrFontColors[1], $arrFontColors[2], TRUE, $this->intXAxisAngle, 1, true);
             } else {
                 if ($this->intCurrentGraphMode == $this->GRAPH_TYPE_LINE) {
                     $this->objChart->drawScale($this->objDataset->GetData(), $this->objDataset->GetDataDescription(), SCALE_NORMAL, $arrFontColors[0], $arrFontColors[1], $arrFontColors[2], TRUE, $this->intXAxisAngle, 1, false);
                 }
             }
         }
     }
     //the background grid
     if ($this->intCurrentGraphMode != $this->GRAPH_TYPE_PIE) {
         $arrGridColor = hex2rgb($this->strGridColor);
         $this->objChart->drawGrid(4, true, $arrGridColor[0], $arrGridColor[1], $arrGridColor[2], 50);
     }
     if ($this->intCurrentGraphMode == $this->GRAPH_TYPE_LINE) {
         // Draw the line graph
         $this->objChart->drawLineGraph($this->objDataset->GetData(), $this->objDataset->GetDataDescription());
         //dots in line
         $this->objChart->drawPlotGraph($this->objDataset->GetData(), $this->objDataset->GetDataDescription(), 3, 2, 255, 255, 255);
     } else {
         if ($this->intCurrentGraphMode == $this->GRAPH_TYPE_BAR) {
             //the zero-line
             $this->objChart->setFontProperties(class_resourceloader::getInstance()->getCorePathForModule("module_system", true) . "/module_system/system" . $this->strFont, 6);
             $this->objChart->drawBarGraph($this->objDataset->GetData(), $this->objDataset->GetDataDescription(), TRUE);
//.........这里部分代码省略.........
开发者ID:jinshana,项目名称:kajonacms,代码行数:101,代码来源:class_graph_pchart.php

示例5: elseif

            $cmR = $caR;
            $cmG = $caG;
            $cmB = $caB;
        }
    }
    // limita draw
    if ($realVol < $metrYmin) {
        $realVol = $metrYmin;
    }
    if ($realVol > $metrYmax) {
        $realVol = $metrYmax;
    }
    // Y pos of Value
    $yVal = $metrYmax - ($metrYmax - $realVol) / 2;
    $Test->drawFilledRoundedRectangle($bodyXmin, $bodyYmin, $bodyXmax, $metrYmax, 8, $cmR, $cmG, $cmB);
    $Test->drawFilledRectangle($bodyXmin, $bodyYmin + 30, $bodyXmax, $bodyYmax - 10, 100, 100, 100, FALSE, 100);
    // body
    // Current value
    $Test->setFontProperties("./pChart/Fonts/tahoma.ttf", 12);
    $Test->drawTextBox($bodyXmin, $bodyYmin + 15, $bodyXmax, $bodyYmin + 20, "{$currentValue}" . "{$unit}", 0, 245, 245, 245, ALIGN_CENTER, FALSE, -1, -1, -1, 100);
    // Draw label
    $Test->setFontProperties("./pChart/Fonts/tahoma.ttf", 8);
    $Test->drawTextBox($bodyXmin, $bodyYmax - 15, $bodyXmax, $bodyYmax - 7, "{$label}", 0, 255, 255, 255, ALIGN_CENTER, FALSE, -1, -1, -1, 100);
    //end of smartStick1
    //---------------------------- sticker1a
} elseif ($objtype == "sticker1a") {
    // Settings
    $wid = 100;
    $hei = 100;
    // light/black
    if ($black == 1) {
开发者ID:cdkisa,项目名称:majordomo,代码行数:31,代码来源:s.php

示例6: pChart

 $metrDiap = $metrYmax - $metrYmin;
 $metrCenter = $metrDiap / 2;
 $s0Ymin = $bodyYmin + 2;
 $s0Ymax = $bodyYmax - 2;
 $s0Xmin = 2;
 $s0Xmax = $bodyXmax - 3;
 $s1Xmin = 2;
 $s1Xmax = 30;
 $s2Xmin = 29;
 $s2Xmax = 60;
 $s3Xmin = 59;
 $s3Xmax = $bodyXmax - 3;
 $Test = new pChart($wid, $hei);
 $Test->setGraphArea(0, 0, $wid, $hei);
 $Test->drawBackground($cbg, $cbg, $cbg);
 $Test->drawFilledRectangle($bodyXmin, $bodyYmin, $bodyXmax, $bodyYmax, 160, 160, 160, FALSE, 100);
 $Test->drawFilledRectangle($s1Xmin, $s0Ymin, $s3Xmax, $s0Ymax, 220, 220, 220, FALSE, 100);
 $tt0 = timeConvert("00:00") - 3600;
 $tt9 = timeConvert("23:59") - 3600 + 59;
 $ttd = $tt9 - $tt0;
 $ttn = time();
 $tt1 = $ttn - $tt0;
 $ttp = $ttd / $width;
 $ttx = $tt1 / $ttp;
 if ($ttn - $tt0 > 86400) {
     $ttx = $ttx - $width;
 }
 $d1on_ = timeConvert("00:00") - 3600;
 $d1off_ = timeConvert("07:00") - 3600;
 $d2on_ = timeConvert("07:00") - 3600;
 $d2off_ = timeConvert("10:00") - 3600;
开发者ID:cdkisa,项目名称:majordomo,代码行数:31,代码来源:pics.php

示例7: initializeChart

 /**
  * Initializes the chart, sets the properties
  */
 public function initializeChart()
 {
     global $wgPChart4mwFontPath;
     // Retrieve the parameters for the chart
     $args = $this->chartArgs;
     // Create a chart object
     $pChart = new pChart($args["sizeX"], $args["sizeY"]);
     // Draw background colors. If needed, a gradient should be drawn
     if ($args["bgtype"] == "normal") {
         $pChart->drawFilledRectangle(0, 0, $args["sizeX"], $args["sizeY"], $args["bgcolor"][0], $args["bgcolor"][1], $args["bgcolor"][2]);
     } else {
         $pChart->drawGraphAreaGradient($args["bgcolor"][0], $args["bgcolor"][1], $args["bgcolor"][2], 50, TARGET_BACKGROUND);
     }
     // Set default font properties
     $pChart->setFontProperties($wgPChart4mwFontPath . "/" . $args["textfont"], $args["textsize"]);
     // Define the graph area, by computing the margins, legend size, title size etc.
     $pChart = $this->setGraphArea($pChart);
     if ($args["graphbgtype"] == "normal") {
         $pChart->drawGraphArea($args["graphbgcolor"][0], $args["graphbgcolor"][1], $args["graphbgcolor"][2]);
     } elseif ($args["graphbgtype"] == "gradient") {
         $pChart->drawGraphAreaGradient($args["graphbgcolor"][0], $args["graphbgcolor"][1], $args["graphbgcolor"][2], 50);
     }
     $this->pChart = $pChart;
     if (!$this->empty) {
         $this->drawScaleAndGrid();
         $this->setColorPalette();
     }
     return $this->pChart;
 }
开发者ID:hystrix,项目名称:pchart4mw,代码行数:32,代码来源:pChart4mw.class.php


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