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


PHP pChart::drawBasicPieGraph方法代码示例

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


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

示例1: 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

示例2: checkRights

$pChartCfg->centerY = intval($pChartCfg->YSize / 2);
$pChartCfg->radius = 150;
$pChartCfg->legendX = 10;
$pChartCfg->legendY = 15;
$graph = new stdClass();
$graph->data = $DataSet->GetData();
$graph->description = $DataSet->GetDataDescription();
$Test = new pChart($pChartCfg->XSize, $pChartCfg->YSize);
foreach ($series_color as $key => $hexrgb) {
    $rgb = str_split($hexrgb, 2);
    $Test->setColorPalette($key, hexdec($rgb[0]), hexdec($rgb[1]), hexdec($rgb[2]));
}
// Draw the pie chart
$Test->setFontProperties(config_get('charts_font_path'), config_get('charts_font_size'));
$Test->AntialiasQuality = 0;
$Test->drawBasicPieGraph($graph->data, $graph->description, $pChartCfg->centerX, $pChartCfg->centerY, $pChartCfg->radius, PIE_PERCENTAGE, 255, 255, 218);
$Test->drawPieLegend($pChartCfg->legendX, $pChartCfg->legendY, $graph->data, $graph->description, 250, 250, 250);
$Test->Stroke();
function checkRights(&$db, &$user)
{
    return $user->hasRight($db, 'testplan_metrics');
}
/**
 * 
 *
 */
function init_args()
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    $args->tplan_id = $_REQUEST['tplan_id'];
开发者ID:tamtrong,项目名称:testlink,代码行数:31,代码来源:platformPieChart.php

示例3: pData


//.........这里部分代码省略.........
         $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":
                 if ($scatterdrawn) {
开发者ID:JorgeUlises,项目名称:higia,代码行数:67,代码来源:swgraph_pchart.php

示例4: 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

示例5: disableAllSeries

    //$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) {
                    if ($v1["type"] == "BAR" || $v1["type"] == "STACKEDBAR" || $v1["type"] == "OVERLAYBAR") {
开发者ID:lihaobin0320,项目名称:yii2-reportico,代码行数:31,代码来源:dyngraph_pchart.php

示例6: pData

$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>
<br>
<br>
开发者ID:j0rpi,项目名称:SFSDB,代码行数:31,代码来源:stats.php

示例7: _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

示例8: elseif

$Test->setFontProperties("./pChart/Fonts/tahoma.ttf", 10);
$Test->drawTitle(2, 15, $title, 150, 150, 150);
//---------------------------- Font
$Test->setFontProperties("./pChart/Fonts/tahoma.ttf", 8);
//---------------------------- Set GraphArea
$Test->setGraphArea(0, 0, $w, $h);
//---------------------------- Set background graphics (R,G,G,1/Y)
if ($bg_r != 0 && $bg_g != 0 && $bg_b != 0) {
    $Test->drawGraphAreaGradient($bg_r, $bg_g, $bg_b, 5);
}
//---------------------------- Calc center
$midX = $w / 2;
$midY = $h / 2;
//---------------------------- Draw pie
if ($_GET['gtype'] == 'pie') {
    $Test->drawBasicPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), $midX, $midY, $radius, PIE_PERCENTAGE_LABEL, $cbg, $cbg, $cbg, 1);
} elseif ($_GET['gtype'] == 'pie2') {
    $Test->drawFlatPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), $midX, $midY, $radius, PIE_PERCENTAGE_LABEL, 5, 1);
} elseif ($_GET['gtype'] == 'pie3') {
    $Test->setShadowProperties(3, 3, $csh, $csh, $csh, 90);
    $Test->drawFlatPieGraphWithShadow($DataSet->GetData(), $DataSet->GetDataDescription(), $midX, $midY, $radius, PIE_PERCENTAGE_LABEL, 5, 1);
} elseif ($_GET['gtype'] == 'pie4') {
    $Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), $midX, $midY, $radius, PIE_PERCENTAGE_LABEL, TRUE, 60, 20, 5, 1);
} else {
    //
}
//---------------------------- Border
if ($_GET['border'] == '1') {
    $Test->AddBorder(1, 200, 200, 200);
}
//---------------------------- Image PNG
开发者ID:cdkisa,项目名称:majordomo,代码行数:31,代码来源:pie.php

示例9: pData

<?php

/*
    Example14: A smooth flat pie graph
*/
// Standard inclusions
include "pChart/pData.class";
include "pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint(array(10, 2, 3, 5, 3), "Serie1");
$DataSet->AddPoint(array("Jan", "Feb", "Mar", "Apr", "May"), "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);
// Draw the pie chart
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->drawBasicPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 120, 100, 70, TRUE, 255, 255, 218);
$Test->drawPieLegend(230, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
$Test->Render("example14.png");
开发者ID:andersongimino,项目名称:area51,代码行数:24,代码来源:Example14.php

示例10: 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

示例11: gerarGraficoPizza

 public function gerarGraficoPizza($tipoPizza)
 {
     // Montando plotagens com os arrays de dados passados
     $DataSet = new pData();
     // Definindo labels dos eixos
     if (!empty($this->_tituloEixoX)) {
         $DataSet->SetXAxisName($this->_tituloEixoX);
         $DataSet->SetYAxisName($this->_tituloEixoY);
     }
     // Definindo labels dos dados
     if (count($this->_tituloItens) > 0) {
         $DataSet->AddPoint($this->_tituloItens, "labels");
         $DataSet->SetAbsciseLabelSerie("labels");
     }
     // Montando plotagens com os arrays de dados passados
     for ($i = 0; $i < count($this->_dados); $i++) {
         $DataSet->AddPoint($this->_dados[$i], $this->_tituloDados[$i]);
         $DataSet->AddSerie($this->_tituloDados[$i]);
         // Initialise the graph
         /*$Test = new pChart($this->_larguraGrafico,$this->_alturaGrafico);
           $Test->setFontProperties(CAMINHO_PCHART_FONT."/tahoma.ttf",8);
           $Test->setGraphArea($this->_margem,$this->_margem+30,75*$this->_larguraGrafico/100,80*$this->_alturaGrafico/100-15);
           $Test->drawFilledRoundedRectangle(7,7,98*$this->_larguraGrafico/100,98*$this->_alturaGrafico/100,5,$this->_corFundo["r"],$this->_corFundo["g"],$this->_corFundo["b"]);
           $Test->drawRoundedRectangle(5,5,98*$this->_larguraGrafico/100+3,98*$this->_alturaGrafico/100+3,5,$this->_corMargem["r"],$this->_corMargem["g"],$this->_corMargem["b"]);*/
         $Test = new pChart($this->_larguraGrafico * 2, $this->_alturaGrafico * 2);
         $Test->setFontProperties(CAMINHO_PCHART_FONT . "/tahoma.ttf", 8);
         $Test->setGraphArea($this->_margem + 100, $this->_margem + 50, 120 * $this->_larguraGrafico / 100, 130 * $this->_alturaGrafico / 100 - 10);
         $Test->drawFilledRoundedRectangle(7, 7, 190 * $this->_larguraGrafico / 100, 130 * $this->_alturaGrafico / 100, 5, $this->_corFundo["r"], $this->_corFundo["g"], $this->_corFundo["b"]);
         $Test->drawRoundedRectangle(5, 5, 190 * $this->_larguraGrafico / 100 + 3, 130 * $this->_alturaGrafico / 100 + 3, 5, $this->_corMargem["r"], $this->_corMargem["g"], $this->_corMargem["b"]);
         // Draw the 0 line
         $Test->setFontProperties(CAMINHO_PCHART_FONT . "/tahoma.ttf", 10);
         if ($this->_exibirValores == true) {
             $auxExibirValores = PIE_VALUES;
         } else {
             $auxExibirValores = PIE_NOLABEL;
         }
         // Draw the limit graph
         if ($tipoPizza == "pizza") {
             $Test->drawBasicPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 35 * $this->_larguraGrafico / 100, 55 * $this->_alturaGrafico / 100 - 15, 25 * $this->_larguraGrafico / 100, $auxExibirValores, TRUE, 50, 20, 5);
         } else {
             $Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 35 * $this->_larguraGrafico / 100, 55 * $this->_alturaGrafico / 100 - 15, 25 * $this->_larguraGrafico / 100, $auxExibirValores, TRUE, 50, 20, 5);
         }
         $Test->drawPieLegend(70 * $this->_larguraGrafico / 100, 35 * $this->_alturaGrafico / 100 - 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 255, 249, 223, 15, 15, 15);
         $Test->setFontProperties(CAMINHO_PCHART_FONT . "/tahoma.ttf", 14);
         $Test->drawTitle($this->_larguraGrafico / 2 - 20, 30, $this->_tituloGrafico . ": " . $this->_tituloDados[$i], $this->_corLabels["r"], $this->_corLabels["g"], $this->_corLabels["b"]);
         $Test->Render(CAMINHO_PCHART . "/../../../../../public/pizza{$i}.png");
         echo "<img src='" . $_SERVER['REQUEST_URI'] . "/../../public/pizza{$i}.png'>";
         $DataSet->removeAllSeries();
     }
 }
开发者ID:hackultura,项目名称:novosalic,代码行数:50,代码来源:Grafico.php

示例12: genratePieChartImage

 function genratePieChartImage($dataAr)
 {
     //debug('DATA',$dataAr,2);
     $s1 = array();
     $s2 = array();
     foreach ($dataAr as $key => $val) {
         $s1[] = $val;
         $s2[] = $key;
     }
     // Dataset definition
     require_once APPPATH . '3rdparty/pchart/pChart/pData.class';
     require_once APPPATH . '3rdparty/pchart/pChart/pChart.class';
     $path = $this->config->item('csv_upload_path');
     $DataSet = new pData();
     $DataSet->AddPoint($s1, "Serie1");
     $DataSet->AddPoint($s2, "Serie2");
     $DataSet->AddAllSeries();
     $DataSet->SetAbsciseLabelSerie("Serie2");
     // Initialise the graph
     $Test = new pChart(1000, 458);
     $Test->drawBackground(232, 234, 234);
     $Test->loadColorPalette(APPPATH . '3rdparty/pchart/softtones.txt');
     // Draw the pie chart
     $Test->setFontProperties(APPPATH . '3rdparty/pchart/Fonts/tahoma.ttf', 8);
     $Test->drawBasicPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 480, 229, 175);
     $Test->drawPieLegend(650, 75, $DataSet->GetData(), $DataSet->GetDataDescription(), 232, 234, 234);
     $imgName = uniqid('graph_') . '.png';
     $Test->Render($path . $imgName);
     return upload_to_amazon_graphImage($imgName, $path);
 }
开发者ID:kostya1017,项目名称:our,代码行数:30,代码来源:whois.php


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