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


PHP pChart::drawFilledCircle方法代码示例

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


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

示例1: pData


//.........这里部分代码省略.........
     if ($scalerequired) {
         $graphImage->setGraphArea($this->marginleft_actual, $this->margintop_actual, $this->width_pdf_actual - $this->marginright, $this->height_pdf_actual - $this->marginbottom_actual);
         $graphImage->drawGraphAreaGradient(240, 240, 240, -20);
         // Automatic generation of x tick interval based on number of ticks
         if ($this->xticklabelinterval_actual == "AUTO") {
             $labct = count($this->plot[0]["data"]);
             $this->xticklabelinterval_actual = floor($labct / 35) + 1;
         }
         if ($scalerequired == "NORMAL") {
             $graphImage->drawScale($graphData->GetData(), $graphData->GetDataDescription(), $scale_drawing_mode, 0, 0, 0, TRUE, 40, FALSE, TRUE, $this->xticklabelinterval_actual, FALSE);
         }
         $graphImage->drawGrid(2, TRUE, 230, 230, 230, 45);
     } else {
         $this->marginright = 5;
         $this->marginbottom = 5;
         $this->marginleft = 5;
         $this->marginright_actual = 5;
         $this->marginbottom_actual = 5;
         $this->marginleft_actual = 5;
         //$this->margintop_actual = 5;
         $graphImage->setGraphArea($this->marginleft, $this->margintop_actual, $this->width_pdf_actual - $this->marginright, $this->height_pdf_actual - $this->marginbottom);
         $graphImage->drawGraphAreaGradient(240, 240, 240, -10);
     }
     // If there's a Pie chart we want to draw different legends
     $piechart = false;
     foreach ($this->plot as $k => $v) {
         disableAllSeries($this->plot, $graphData);
         $series = $v["name"] . $k;
         setSerieDrawable($this->plot, $graphData, $series, TRUE);
         switch ($v["type"]) {
             case "PIE":
                 $piedrawn = true;
                 $piechart = true;
                 $graphImage->drawFilledCircle($this->width_pdf_actual / 2 + 2, $this->margintop_actual + 2 + ($this->height_pdf_actual - $this->margintop_actual - $this->marginbottom_actual) / 2, ($this->height_pdf_actual - $this->marginbottom_actual - $this->margintop_actual - 20) * 0.45 + 1, 200, 200, 200);
                 $graphImage->drawBasicPieGraph($graphData->GetData(), $graphData->GetDataDescription(), $this->width_pdf_actual / 2, $this->margintop_actual + ($this->height_pdf_actual - $this->margintop_actual - $this->marginbottom_actual) / 2, ($this->height_pdf_actual - $this->marginbottom_actual - $this->margintop_actual - 20) * 0.45, PIE_PERCENTAGE_LABEL, 255, 255, 218);
                 break;
             case "PIE3D":
                 $piedrawn = true;
                 $piechart = true;
                 $graphImage->drawPieGraph($graphData->GetData(), $graphData->GetDataDescription(), $this->width_pdf_actual / 2, $this->margintop_actual + ($this->height_pdf_actual - $this->margintop_actual - $this->marginbottom_actual) / 2, ($this->height_pdf_actual - $this->marginbottom_actual - $this->margintop_actual - 20) * 0.5, PIE_PERCENTAGE_LABEL, true, 60, 20, 0, 0);
                 break;
             case "OVERLAYBAR":
             case "STACKEDBAR":
             case "BAR":
                 if ($stackeddrawn) {
                     break;
                 }
                 if ($barexists || $overlayexists) {
                     foreach ($this->plot as $k1 => $v1) {
                         if ($v1["type"] == "BAR" || $v1["type"] == "STACKEDBAR" || $v1["type"] == "OVERLAYBAR") {
                             setSerieDrawable($this->plot, $graphData, $v1["name"] . $k1, TRUE);
                         }
                     }
                 }
                 $stackeddrawn = true;
                 if ($stackedexists) {
                     $graphImage->drawStackedBarGraph($graphData->GetData(), $graphData->GetDataDescription(), 90);
                 } else {
                     if ($overlayexists) {
                         $graphImage->drawOverlayBarGraph($graphData->GetData(), $graphData->GetDataDescription(), 90);
                     } else {
                         $graphImage->drawBarGraph($graphData->GetData(), $graphData->GetDataDescription());
                     }
                 }
                 break;
             case "SCATTER":
开发者ID:JorgeUlises,项目名称:higia,代码行数:67,代码来源:swgraph_pchart.php

示例2: pData

echo $data1 = 0;
echo $data2 = 0;
echo $data3 = 0;
echo $data4 = 0;
echo $data5 = 400;
echo $data6 = 0;
$val = "";
for ($i = 1; $i < 7; $i++) {
}
// Standard inclusions
include "pChart/pData.class";
include "pChart/pChart.class";
//  Dataset definition
$DataSet = new pData();
$DataSet->AddPoint(array($data1, $data2, $data3, $data4, $data5, $data6), "Serie1");
$DataSet->AddPoint(array("January", "February", "March", "April", "May", "June"), "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
// Initialise the graph
$Test = new pChart(300, 200);
$Test->loadColorPalette("Sample/softtones.txt");
$Test->drawFilledRoundedRectangle(7, 7, 293, 193, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 295, 195, 5, 230, 230, 230);
// This will draw a shadow under the pie chart
$Test->drawFilledCircle(122, 102, 70, 200, 200, 200);
// Draw the pie chart
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->AntialiasQuality = 0;
$Test->drawBasicPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 120, 100, 70, PIE_PERCENTAGE, 255, 255, 218);
$Test->drawPieLegend(230, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
$Test->Render("example14.png");
开发者ID:OmondiKevin,项目名称:CD4,代码行数:31,代码来源:Example14.php

示例3: pchartAction

 public function pchartAction()
 {
     //		$this->_helper->layout->disableLayout();
     $this->_helper->layout->setLayout("layout_admin");
     include "pData.class";
     include "pChart.class";
     $this->view->showArray = $this->testdemoAction();
     $showdate = array();
     $showreport = array();
     foreach ($this->view->showArray as $show) {
         array_push($showdate, substr($show['date'], strlen($show['date']) - 4, 4));
         array_push($showreport, $show['count']);
     }
     // Dataset definition
     $DataSet = new pData();
     $DataSet->AddPoint(array_slice($showreport, 0, 26), "Serie1");
     $DataSet->AddPoint(array_slice($showdate, 0, 26), "Serie2");
     $DataSet->AddSerie("Serie1");
     $DataSet->SetAbsciseLabelSerie("Serie2");
     $DataSet->SetSerieName("Reports", "Serie1");
     $DataSet->SetYAxisName('Report Count');
     $DataSet->SetXAxisName('Date');
     // Initialise the graph
     $Test = new pChart(900, 250);
     $Test->setFontProperties("xihei.ttf", 8);
     $Test->setGraphArea(50, 30, 780, 200);
     $Test->drawFilledRoundedRectangle(7, 7, 793, 248, 5, 255, 255, 255);
     $Test->drawRoundedRectangle(5, 5, 795, 249, 5, 230, 230, 230);
     $Test->drawGraphArea(255, 255, 255, TRUE);
     $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, TRUE);
     $Test->drawGrid(4, TRUE, 230, 230, 230, 50);
     // Draw the 0 line
     $Test->setFontProperties("xihei.ttf", 6);
     $Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
     // Draw the bar graph
     $Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE);
     // Finish the graph
     $Test->setFontProperties("xihei.ttf", 8);
     $Test->drawLegend(596, 50, $DataSet->GetDataDescription(), 255, 255, 255);
     $Test->setFontProperties("xihei.ttf", 10);
     $Test->drawTitle(200, 22, "Reports by Day in Jue.", 50, 50, 50, 585);
     $Test->Render("Naked1.png");
     //=====================================================================================
     // Dataset definition
     $DataSet2 = new pData();
     $DataSet2->AddPoint(array(38, 22, 606), "Serie1");
     $DataSet2->AddPoint(array("Male", "Female", "Unkown"), "Serie2");
     $DataSet2->AddAllSeries();
     $DataSet2->SetAbsciseLabelSerie("Serie2");
     // Initialise the graph
     $Test2 = new pChart(300, 200);
     $Test2->loadColorPalette("softtones.txt");
     $Test2->drawFilledRoundedRectangle(7, 7, 293, 193, 5, 255, 255, 255);
     $Test2->drawRoundedRectangle(5, 5, 295, 195, 5, 230, 230, 230);
     // This will draw a shadow under the pie chart
     $Test2->drawFilledCircle(122, 102, 70, 200, 200, 200);
     // Draw the pie chart
     $Test2->setFontProperties("tahoma.ttf", 8);
     $Test2->drawBasicPieGraph($DataSet2->GetData(), $DataSet2->GetDataDescription(), 120, 100, 70, PIE_PERCENTAGE, 255, 255, 218);
     $Test2->drawPieLegend(230, 15, $DataSet2->GetData(), $DataSet2->GetDataDescription(), 250, 250, 250);
     $Test2->Render("Naked2.png");
     //=====================================================================================
     // select province
     $db = Zend_Registry::get('db');
     $selectprovince = $db->select();
     $selectprovince->from('consumer', array("province", "count(*) as count"))->where("pest is null")->group("consumer.province")->order("count desc");
     $provinceArray = $db->fetchAll($selectprovince);
     $this->view->showprovince = '';
     $this->view->showprovincecount = '';
     $showprovince = array();
     $showprovincecount = array();
     foreach ($provinceArray as $province) {
         if ($province['province'] == null || $province['province'] == '') {
             array_push($showprovince, 'Unkown');
         } else {
             array_push($showprovince, $province['province']);
         }
         array_push($showprovincecount, $province['count']);
     }
     // Dataset definition
     $DataSet3 = new pData();
     $DataSet3->AddPoint(array_slice($showprovincecount, 0, 20), "Serie1");
     $DataSet3->AddPoint(array_slice($showprovince, 0, 20), "Serie2");
     $DataSet3->AddSerie("Serie1");
     $DataSet3->SetAbsciseLabelSerie("Serie2");
     $DataSet3->SetSerieName("Spark Count", "Serie1");
     $DataSet3->SetYAxisName('Spark Count');
     $DataSet3->SetXAxisName('Province');
     Zend_Debug::dump($DataSet3->GetDataDescription());
     // Initialise the graph
     $Test3 = new pChart(900, 250);
     $Test3->setFontProperties("xihei.ttf", 8);
     $Test3->setGraphArea(50, 30, 780, 200);
     $Test3->drawFilledRoundedRectangle(7, 7, 793, 248, 5, 255, 255, 255);
     $Test3->drawRoundedRectangle(5, 5, 795, 249, 5, 230, 230, 230);
     $Test3->drawGraphArea(255, 255, 255, TRUE);
     $Test3->drawScale($DataSet3->GetData(), $DataSet3->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, TRUE);
     $Test3->drawGrid(4, TRUE, 230, 230, 230, 50);
     // Draw the 0 line
     $Test3->setFontProperties("xihei.ttf", 6);
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:wildfire_php,代码行数:101,代码来源:TestController.php

示例4: disableAllSeries

    $marginleft = 5;
    //$margintop = 5;
    $graphImage->setGraphArea($marginleft, $margintop, $width - $marginright, $height - $marginbottom);
    $graphImage->drawGraphAreaGradient(240, 240, 240, -10);
}
// If there's a Pie chart we want to draw different legends
$piechart = false;
foreach ($plot as $k => $v) {
    disableAllSeries($plot, $graphData);
    $series = $v["name"] . $k;
    setSerieDrawable($plot, $graphData, $series, TRUE);
    switch ($v["type"]) {
        case "PIE":
            $piedrawn = true;
            $piechart = true;
            $graphImage->drawFilledCircle($width / 2 + 2, $margintop + 2 + ($height - $margintop - $marginbottom) / 2, ($height - $marginbottom - $margintop - 20) * 0.45 + 1, 200, 200, 200);
            $graphImage->drawBasicPieGraph($graphData->GetData(), $graphData->GetDataDescription(), $width / 2, $margintop + ($height - $margintop - $marginbottom) / 2, ($height - $marginbottom - $margintop - 20) * 0.45, PIE_PERCENTAGE_LABEL, 255, 255, 218);
            break;
        case "PIE3D":
            $piedrawn = true;
            $piechart = true;
            $graphImage->drawPieGraph($graphData->GetData(), $graphData->GetDataDescription(), $width / 2, $margintop + ($height - $margintop - $marginbottom) / 2, ($height - $marginbottom - $margintop - 20) * 0.5, PIE_PERCENTAGE_LABEL, true, 60, 20, 0, 0);
            break;
        case "OVERLAYBAR":
        case "STACKEDBAR":
        case "BAR":
            if ($stackeddrawn) {
                break;
            }
            if ($barexists || $overlayexists) {
                foreach ($plot as $k1 => $v1) {
开发者ID:lihaobin0320,项目名称:yii2-reportico,代码行数:31,代码来源:dyngraph_pchart.php

示例5: _createSourcesGraph

 protected function _createSourcesGraph()
 {
     // load pChart graphic library
     $this->_loadLibs();
     // définition des données à afficher
     $dataSet = new pData();
     // need config, to know which data user wants to display : visits, unique visitors, pageviews
     $sefConfig = Sh404sefFactory::getConfig();
     // Google does not allow combining dimension=ga:medium with metric = unique visitors
     $dataType = $sefConfig->analyticsDashboardDataType == 'ga:visitors' ? 'ga:visits' : $sefConfig->analyticsDashboardDataType;
     $dataTypeString = str_replace('ga:', '', $dataType);
     // sort data for proper display
     usort($this->_rawData['sources'], array($this, '_sortSourcesDataCompareFunction'));
     // we walk the array, pulling out alternatively
     // the first and last items
     // making the new array having the largest item
     // followed by the smallest, then second largest
     // then second smallest, ...
     // which makes drawing labels much easier
     $tmpArray = array();
     $even = false;
     $max = count($this->_rawData['sources']);
     for ($i = 0; $i < $max; $i++) {
         if ($even) {
             // pull last item in sorted array
             $tmpArray[] = array_pop($this->_rawData['sources']);
         } else {
             // pull array first item
             $tmpArray[] = array_shift($this->_rawData['sources']);
         }
         // flag inversion
         $even = !$even;
     }
     // get data from response
     $data = array();
     $types = array();
     foreach ($tmpArray as $entry) {
         $value = $entry->{$dataTypeString};
         // do not add empty values, as pChart would choke on that and display a warning
         if (!empty($value)) {
             $data[] = $value;
             $types[] = Sh404sefHelperAnalytics::getReferralLabel($entry->dimension['medium']);
         }
     }
     $dataSet->AddPoint($data, "visits");
     $dataSet->AddPoint($types, "types");
     $dataSet->addSerie('visits');
     $dataSet->SetAbsciseLabelSerie("types");
     $label = JText::_('COM_SH404SEF_ANALYTICS_REPORT_SOURCES') . JText::_('COM_SH404SEF_ANALYTICS_REPORT_BY_LABEL') . Sh404sefHelperAnalytics::getDataTypeTitle();
     $dataSet->SetSerieName($label, "visits");
     // Initialise the graph
     $w = intval(0.45 * $this->_options['cpWidth']);
     $w = empty($w) ? 160 : $w;
     $radius = intval($w * 0.22);
     $margin = 5;
     $h = intval($w * 0.8);
     $centreX = intval(0.5 * $w);
     $centreY = intval(0.5 * $h);
     $chart = new pChart($w, $h);
     $fontSize = 8;
     // prepare graph
     $chart->setFontProperties($this->_baseChartPath . DS . 'Fonts/arial.ttf', $fontSize);
     $chart->loadColorPalette($this->_baseChartPath . DS . 'palettes' . DS . 'tones-2-green-soft.php');
     $chart->setGraphArea($margin, $margin, $w - $margin, $h - $margin);
     // This will draw a shadow under the pie chart
     $chart->drawFilledCircle($centreX + 4, $centreY + 4, $radius, 200, 200, 200);
     // Draw the pie chart
     $d = $dataSet->GetData();
     if (!empty($d)) {
         $chart->drawBasicPieGraph($d, $dataSet->GetDataDescription(), $centreX, $centreY, $radius, PIE_PERCENTAGE_LABEL_VALUE, 255, 255, 218);
     }
     // create a temporary file for
     $user =& JFactory::getUser();
     // make sure the root tmp dir exists
     $rootDir = 'tmp' . DS . 'sh404sef_analytics';
     Sh404sefHelperFiles::createDirAndIndex(JPATH_ROOT . DS . $rootDir);
     // file name is variable to avoid browser cache
     $basePath = $rootDir . DS . md5('useless_' . $user->id . '_hashing') . DS;
     // create path and make sure there's an index.html file in it
     Sh404sefHelperFiles::createDirAndIndex(JPATH_ROOT . DS . $basePath);
     $imageFileName = Sh404sefHelperAnalytics::createTempFile($basePath, $this->_options['report'] . '.' . $this->_options['accountId'] . '.sources.' . $dataTypeString);
     $chart->Render(JPATH_ROOT . DS . $imageFileName);
     // need cleaning up, so let's remove all report files for that user older than an hour or so
     Sh404sefHelperAnalytics::cleanReportsImageFiles(JPATH_ROOT . DS . $basePath, $age = 4000);
     return JURI::root() . $imageFileName;
 }
开发者ID:lautarodragan,项目名称:ideary,代码行数:86,代码来源:analyticsgareportdashboard.php

示例6: pChart

 $hei = 154;
 // light/black
 if ($black == 1) {
     $cbg = 0;
 } else {
     $cbg = 255;
 }
 // Object + GraphArea
 $Test = new pChart($wid, $hei);
 $Test->setGraphArea(0, 0, $wid, $hei);
 // Background
 $Test->drawBackground($cbg, $cbg, $cbg);
 // Body
 $Test->drawFilledRoundedRectangle(10, 10, 36, 130, 8, 200, 200, 200);
 // body
 $Test->drawFilledCircle(24, 130, 23, 200, 200, 200, 0);
 // circle body
 $Test->drawFilledRectangle(17, 15, 29, 110, 240, 240, 240, FALSE, 100);
 // white line
 // Limits
 if ($max != -1) {
     $pmax = $max;
 } else {
     $pmax = "";
 }
 if ($min != -1) {
     $pmin = $min;
 } else {
     $pmin = "";
 }
 if ($middle != -1) {
开发者ID:cdkisa,项目名称:majordomo,代码行数:31,代码来源:s.php

示例7: pData

$Test->drawRoundedRectangle(5, 5, 295, 195, 5, 0, 0, 0);
$Test->drawFilledCircle(121, 101, 75, 255, 255, 255);
$Test->setFontProperties("arial.ttf", 8);
$Test->drawBasicPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 120, 100, 70, PIE_PERCENTAGE, 255, 255, 218);
$Test->drawPieLegend(200, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
$Test->Render("accs.png");
// Profit Pie
$DataSet2 = new pData();
$DataSet2->AddPoint(array($functions->GetTotalProfitUser("j0rpi"), $functions->GetTotalProfitUser("fallbacken")), "Serie3");
$DataSet2->AddPoint(array("\$" . $functions->GetTotalProfitUser("j0rpi"), "\$" . $functions->GetTotalProfitUser("fallbacken")), "Serie2");
$DataSet2->AddAllSeries();
$DataSet2->SetAbsciseLabelSerie("Serie2");
$Test2 = new pChart(300, 200);
$Test2->drawFilledRoundedRectangle(7, 7, 293, 193, 5, 240, 240, 240);
$Test2->drawRoundedRectangle(5, 5, 295, 195, 5, 0, 0, 0);
$Test2->drawFilledCircle(121, 101, 75, 255, 255, 255);
$Test2->setFontProperties("arial.ttf", 8);
$Test2->drawBasicPieGraph($DataSet2->GetData(), $DataSet2->GetDataDescription(), 120, 100, 70, PIE_LABELS, 255, 255, 218);
$Test2->drawPieLegend(200, 15, $DataSet2->GetData(), $DataSet2->GetDataDescription(), 250, 250, 250);
$Test2->Render("users.png");
echo "<font style='font-family: Helvetica'>";
echo "<img src='stats.png' />";
echo "<br /><img src='users.png' /><br /><br /><br />";
echo "Right now, we have <b>" . mysql_num_rows($accs) . "</b> Steam accounts in the database, where <b>" . mysql_num_rows($sold) . "</b> has been sold.</br >";
echo "We have also made a total of <b>\$";
echo $functions->GetTotalProfit() . " </b> profit, where j0rpi has made <b>\$" . $functions->GetTotalProfitUser("j0rpi") . "</b>, and FallbackeN has made <b>\$" . $functions->GetTotalProfitUser('fallbacken') . "</b>";
echo "</font>";
?>

</table>
</div>
开发者ID:j0rpi,项目名称:SFSDB,代码行数:31,代码来源:stats.php

示例8: elseif

    // Background
    $Test->drawBackground($cbg, $cbg, $cbg);
    if ($currentValue == 1) {
        //$caR=100;$caG=160;$caB=230;
    } elseif ($currentValue == 0) {
        $caR = 210 - $k;
        $caG = 210 - $k;
        $caB = 210 - $k;
    } else {
        $caR = 200;
        $caG = 100;
        $caB = 100;
    }
    // Draw
    $Test->drawFilledRectangle($bodyXmin, $bodyYmin, $bodyXmax, $metrYmax, $caR, $caG, $caB);
    $Test->drawFilledCircle($metrCenter + 5, $bodyYmin - 10, 13, $caR, $caG, $caB, 0);
    $Test->drawFilledCircle($metrCenter + 5, $bodyYmin - 10, 9, $cbody, $cbody, $cbody, 0);
    $Test->drawFilledEllipse($metrCenter - 4, $bodyYmin, 16, 30, $caR, $caG, $caB);
    $Test->drawLine($bodyXmin + 4, 35, $bodyXmax - 4, 35, $cbody, $cbody, $cbody, FALSE);
    $Test->drawLine($bodyXmin + 4, 36, $bodyXmax - 4, 36, $cbody, $cbody, $cbody, FALSE);
    $Test->drawLine($bodyXmin - 2, 60, $bodyXmax + 2, 60, $cbody, $cbody, $cbody, FALSE);
    $Test->drawLine($bodyXmin - 2, 61, $bodyXmax + 2, 61, $cbody, $cbody, $cbody, FALSE);
    $Test->drawLine($bodyXmin - 5, 37, $bodyXmax - 4, 37, $caR, $caG, $caB, FALSE);
    $Test->drawLine($bodyXmin - 4, 38, $bodyXmax - 4, 38, $caR, $caG, $caB, FALSE);
    $Test->drawLine($bodyXmin - 3, 39, $bodyXmax - 4, 39, $caR, $caG, $caB, FALSE);
    $Test->drawLine($bodyXmin - 2, 40, $bodyXmax - 4, 40, $caR, $caG, $caB, FALSE);
    $Test->drawLine($bodyXmin - 1, 41, $bodyXmax - 4, 41, $caR, $caG, $caB, FALSE);
    // end of kettle1
    //-------------------------------------------------------- svet1
} elseif ($objtype == "svet1") {
    // Settings
开发者ID:cdkisa,项目名称:majordomo,代码行数:31,代码来源:pics.php

示例9: pieChart


//.........这里部分代码省略.........
         $labelWidth = 0;
         $labelHeight = 0;
     }
     // Calculate  pie size based on fontsize radius and skew
     $Position = imageftbbox($PieFontSize, 0, $PieFontName, '199%');
     $pieWidth = ($Position[2] - $Position[0]) * 2 + $r * 2;
     $sin = $Skew != 90 ? abs(sin(deg2rad($Skew))) : 1;
     // if skewed the height goes with sin($skew)
     $SpliceHeight = $Skew != 90 ? $settings['SpliceHeight'] : 0;
     // if skewed add the SpliceHeight
     $SpliceDistance = $settings['SpliceDistance'] * 2 + 30;
     $pieHeight = intval(($Position[1] - $Position[7]) * 2 + $r * 2 * $sin + $SpliceHeight);
     $h = intval($pieHeight + $SpliceDistance * $sin);
     // Img Height
     $y = intval(($pieHeight - $SpliceHeight) / 2 + $SpliceDistance / 2);
     // center y pos
     $x = intval($pieWidth / 2) + $SpliceDistance / 2;
     // center x pos
     $w = $x * 2 + ($legendW > $labelWidth ? $legendW : $labelWidth) + 10;
     if ($titleWidth > $w) {
         $w = $titleWidth;
     }
     $h2 = $labelHeight + $titleHeight + $TextHeight + 60;
     // If the legend has big height
     if ($h2 > $h) {
         $h = $h2;
     }
     //Add pixels for the title
     $h = $h + $titleHeight + 10;
     // Real height
     $y = $y + $titleHeight + 10;
     // Real center y
     // Dataset definition
     $DataSet = new pData();
     $DataSet->AddPoint($percents, "Serie1");
     $DataSet->AddPoint($legend, "Serie2");
     $DataSet->AddAllSeries();
     $DataSet->SetAbsciseLabelSerie("Serie2");
     // Initialise the graph
     $Test = new pChart($w, $h);
     $red = $settings['ImgR'];
     $g = $settings['ImgG'];
     $b = $settings['ImgB'];
     $Test->drawFilledRoundedRectangle(7, 7, $w - 7, $h - 7, 5, $red, $g, $b);
     $red = $settings['BorderR'];
     $g = $settings['BorderG'];
     $b = $settings['BorderB'];
     $Test->drawRoundedRectangle(5, 5, $w - 5, $h - 5, 5, $red, $g, $b);
     // Draw the pie chart
     $Test->setFontProperties($PieFontName, $PieFontSize);
     if ($Skew != 90) {
         $Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), $x, $y, $r, PIE_PERCENTAGE, TRUE, $Skew, $settings['SpliceHeight'], $settings['SpliceDistance']);
     } else {
         if ($settings['SpliceDistance'] == 0) {
             $Test->drawFilledCircle($x + 2, $y + 2, $r, 0, 0, 0);
             // This will draw a shadow under the pie chart
             $Test->drawBasicPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), $x, $y, $r, PIE_PERCENTAGE, 255, 255, 218);
         } else {
             $Test->setShadowProperties(2, 2, 200, 200, 200);
             $Test->drawFlatPieGraphWithShadow($DataSet->GetData(), $DataSet->GetDataDescription(), $x, $y, $r, PIE_PERCENTAGE, $settings['SpliceDistance']);
         }
     }
     // Draw the legend
     $x1 = $x * 2 - 5;
     $r = $settings['LegendR'];
     $g = $settings['LegendG'];
     $b = $settings['LegendB'];
     $Test->setFontProperties($LegendFontName, $LegendFontSize);
     $Test->drawPieLegend($x1, $titleHeight + 30, $DataSet->GetData(), $DataSet->GetDataDescription(), $r, $g, $b);
     //Draw the title
     if (strlen($title) > 0) {
         $Test->setFontProperties($TitleFontName, $TitleFontSize);
         $r = $settings['TitleFGR'];
         $g = $settings['TitleFGG'];
         $b = $settings['TitleFGB'];
         $r1 = $settings['TitleBGR'];
         $g1 = $settings['TitleBGG'];
         $b1 = $settings['TitleBGB'];
         $Test->drawTextBox(6, 6, $w - 5, $titleHeight + 10, $title, 0, $r, $g, $b, ALIGN_CENTER, FALSE, $r1, $g1, $b1, 50);
     }
     if (strlen($bottom_label) > 0) {
         $Test->setFontProperties($LabelFontName, $LabelFontSize);
         $r = $settings['LabelFGR'];
         $g = $settings['LabelFGG'];
         $b = $settings['LabelFGB'];
         $r1 = $settings['LabelBGR'];
         $g1 = $settings['LabelBGG'];
         $b1 = $settings['LabelBGB'];
         $x1 = $x * 2 - 10;
         $Test->drawTextBox($x1, $h - $labelHeight - 15, $w - 10, $h - 10, $bottom_label, 0, $r, $g, $b, ALIGN_CENTER, FALSE, $r1, $g1, $b1, 20);
     }
     if (strlen($imgname)) {
         $imgname = $this->_img_path . "/" . $imgname;
     } else {
         $this->obj->load->helper('string');
         $imgname = $this->_img_path . "/pie-" . random_string('alnum', 16) . ".png";
     }
     $Test->Render($imgname);
     return array("name" => '/' . $imgname, "w" => $w, "h" => $h);
 }
开发者ID:ohjack,项目名称:mallerp_standard,代码行数:101,代码来源:Charts.php


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