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


PHP pChart::drawPieLegend方法代码示例

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


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

示例1: writeData

function writeData($data, $graph)
{
    if ($data != "") {
        echo "Plottong " . $graph . "\n";
        $dataset1 = array();
        $dataset2 = array();
        foreach ($data as $key => $value) {
            array_push($dataset1, $key);
            array_push($dataset2, $value);
        }
        $DataSet = new pData();
        $DataSet->AddPoint($dataset2, "Serie1");
        $DataSet->AddPoint($dataset1, "Serie2");
        $DataSet->AddAllSeries();
        $DataSet->SetAbsciseLabelSerie("Serie2");
        $Test = new pChart(380, 200);
        $Test->drawFilledRoundedRectangle(7, 7, 373, 193, 5, 240, 240, 240);
        $Test->drawRoundedRectangle(5, 5, 375, 195, 5, 230, 230, 230);
        // Draw the pie chart
        $Test->setFontProperties("Fonts/tahoma.ttf", 8);
        $Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 150, 90, 110, TRUE, TRUE, 50, 20, 5);
        $Test->drawPieLegend(310, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
        $Test->Render("{$graph}-pie.png");
    }
}
开发者ID:nhandler,项目名称:locotools,代码行数:25,代码来源:chart.php

示例2: drawPie

 /**
  * Draw pie chart
  * @return unknown
  */
 protected function drawPie()
 {
     // prepare font & series
     $this->_prepareSerie();
     $this->_prepareFont();
     // init chart params
     $outer_w = $this->w - 5;
     // Outer frame witdh
     $outer_h = $this->h - 5;
     // Outer frame heigth
     $inner_w = $this->w - 7;
     // Inner frame witdh
     $inner_h = $this->h - 7;
     // Inner frame heigth
     $pie_x = intval(($this->w - 150) / 2);
     // Pie witdh
     $pie_y = intval(($this->h - 10) / 2);
     // Pie heigth
     $pie_r = intval($pie_x - 50);
     // Pie radius
     $title_w = $this->w - 200;
     // Title width
     $title_h = 50;
     // Title height
     $legend_w = $this->w - 120;
     // Legend width
     $legend_h = 50;
     // Legend height
     // chart styles
     $flat = isset($this->p['flat']) ? $this->p['flat'] : false;
     // fill chart
     $this->chart->drawBackground(255, 255, 255);
     $this->chart->setFontProperties($this->font, 7);
     // set font and size
     $this->chart->drawRoundedRectangle(5, 5, $outer_w, $outer_h, 10, 230, 230, 230);
     // drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$R,$G,$B)
     $this->chart->drawFilledRoundedRectangle(7, 7, $inner_w, $inner_h, 10, 240, 240, 240);
     // drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$R,$G,$B)
     // draw the pie chart
     $this->chart->setFontProperties($this->font, 8);
     // flat pie
     if ($flat) {
         $this->chart->drawFlatPieGraphWithShadow($this->data->GetData(), $this->data->GetDataDescription(), $pie_x, $pie_y, $pie_r, PIE_PERCENTAGE, 10);
         // 3d pie
     } else {
         $this->chart->drawPieGraph($this->data->GetData(), $this->data->GetDataDescription(), $pie_x, $pie_y, $pie_r, PIE_PERCENTAGE, TRUE, 50, 20, 5, 1);
     }
     $this->chart->drawPieLegend($legend_w, $legend_h, $this->data->GetData(), $this->data->GetDataDescription(), 250, 250, 250);
     // add title
     $this->chart->setFontProperties($this->font, 10);
     $this->chart->drawTitle(40, 0, $this->title, 50, 50, 50, $title_w, $title_h);
     // drawTitle($XPos,$YPos,$Value,$R,$G,$B,$XPos2=-1,$YPos2=-1,$Shadow=FALSE)
 }
开发者ID:LWFeng,项目名称:hush,代码行数:57,代码来源:Chart.php

示例3: pie

 function pie($valores, $label, $titulo)
 {
     $nombre = tempnam('/tmp', 'g') . '.png';
     $DataSet = new pData();
     $DataSet->AddPoint($valores, 'Serie1');
     $DataSet->AddPoint($label, 'Serie2');
     $DataSet->AddAllSeries();
     $DataSet->SetAbsciseLabelSerie('Serie2');
     $Test = new pChart(300, 200);
     $Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 8);
     $Test->drawFilledRoundedRectangle(7, 7, 293, 193, 5, 240, 240, 240);
     $Test->drawRoundedRectangle(5, 5, 295, 195, 5, 230, 230, 230);
     $Test->AntialiasQuality = 0;
     $Test->setShadowProperties(2, 2, 200, 200, 200);
     $Test->drawFlatPieGraphWithShadow($DataSet->GetData(), $DataSet->GetDataDescription(), 120, 110, 60, PIE_PERCENTAGE, 8);
     $Test->clearShadow();
     $Test->drawPieLegend(210, 30, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
     $Test->drawTitle(10, 22, $titulo, 50, 50, 50, 300);
     $Test->Render($nombre);
     return $nombre;
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:21,代码来源:imgraf.php

示例4: preGraphCreation


//.........这里部分代码省略.........
     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);
             $this->objChart->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
             //if given, render the line-plots on top
             if ($this->bitAdditionalDatasetAdded) {
                 //the line itself
                 $this->objChart->drawLineGraph($this->objAdditionalDataset->GetData(), $this->objAdditionalDataset->GetDataDescription());
                 //the dots
                 $this->objChart->drawPlotGraph($this->objAdditionalDataset->GetData(), $this->objAdditionalDataset->GetDataDescription(), 3, 2, 255, 255, 255);
             }
         } else {
             if ($this->intCurrentGraphMode == $this->GRAPH_TYPE_STACKEDBAR) {
                 //the zero-line
                 $this->objChart->setFontProperties(class_resourceloader::getInstance()->getCorePathForModule("module_system", true) . "/module_system/system" . $this->strFont, 6);
                 $this->objChart->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
                 $this->objChart->drawStackedBarGraph($this->objDataset->GetData(), $this->objDataset->GetDataDescription(), 75);
             } else {
                 if ($this->intCurrentGraphMode == $this->GRAPH_TYPE_PIE) {
                     $this->objChart->drawPieGraph($this->objDataset->GetData(), $this->objDataset->GetDataDescription(), ceil($this->intWidth / 2) - 20, ceil($this->intHeight / 2), ceil($intHeight / 2) + 20, PIE_PERCENTAGE, TRUE, 50, 20, 5);
                 }
             }
         }
     }
     //render values?
     if (count($this->arrValueSeriesToRender) > 0) {
         $this->objChart->writeValues($this->objDataset->GetData(), $this->objDataset->GetDataDescription(), $this->arrValueSeriesToRender);
     }
     // Finish the graph
     $this->objChart->setFontProperties(class_resourceloader::getInstance()->getCorePathForModule("module_system", true) . "/module_system/system" . $this->strFont, 7);
     //set up the legend
     if ($this->bitRenderLegend) {
         if ($this->intCurrentGraphMode == $this->GRAPH_TYPE_PIE) {
             $this->objChart->drawPieLegend($this->intWidth - $intLegendWidth - $intRightMargin + 10 - $this->intLegendAdditionalMargin, $intTopStart, $this->objDataset->GetData(), $this->objDataset->GetDataDescription(), 255, 255, 255);
         } else {
             $arrLegend = $this->objDataset->GetDataDescription();
             //merge legends
             if ($this->bitAdditionalDatasetAdded) {
                 $arrAdditionalLegend = $this->objAdditionalDataset->GetDataDescription();
                 foreach ($arrAdditionalLegend["Description"] as $strKey => $strName) {
                     $arrLegend["Description"][$strKey] = $strName;
                 }
             }
             $this->objChart->drawLegend($this->intWidth - $intLegendWidth - $intRightMargin + 10 - $this->intLegendAdditionalMargin, $intTopStart, $arrLegend, 255, 255, 255);
         }
     }
     //draw the title
     if ($this->strGraphTitle != "") {
         $this->objChart->setFontProperties(class_resourceloader::getInstance()->getCorePathForModule("module_system", true) . "/module_system/system" . $this->strFont, 10);
         $this->objChart->drawTitle(0, $intTopMargin, $this->strGraphTitle, $arrFontColors[0], $arrFontColors[1], $arrFontColors[2], $this->intWidth, 10);
     }
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:101,代码来源:class_graph_pchart.php

示例5: grafico2

function grafico2($dados, $eixo, $grafico)
{
    include_once "pChart/pChart/pData.class";
    include_once "pChart/pChart/pChart.class";
    $DataSet = new pData();
    $DataSet->AddPoint($dados, "Serie1");
    $DataSet->AddPoint($eixo, "Serie2");
    $DataSet->AddAllSeries();
    $DataSet->SetAbsciseLabelSerie("Serie2");
    $Test = new pChart(700, 400);
    $Test->drawFilledRoundedRectangle(7, 7, 700, 430, 5, 180, 216, 216);
    $Test->setFontProperties("pChart/Fonts/tahoma.ttf", 10);
    $Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 270, 210, 210, PIE_PERCENTAGE, TRUE, 50, 20, 5);
    $Test->drawPieLegend(520, 70, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
    $Test->Render("images/" . $grafico);
}
开发者ID:ederfogo00,项目名称:php_robobombeiro,代码行数:16,代码来源:estatistica.php

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

示例7: count

<?php

/* Répartion des pronostics */
require "fonctions.php";
require "../config.php";
ouverture();
include "../lib/pChart/pData.class";
include "../lib/pChart/pChart.class";
$queryRepartitionPronoUser = "SELECT pronostic, count(*) FROM phpl_pronostics \n\t\tWHERE id_champ={$gr_champ}\n\t\tGROUP BY pronostic";
$resultRepartitionPronoUser = mysql_query($queryRepartitionPronoUser) or die(mysql_error());
// Dataset definition
$DataSet = new pData();
$tabKeys = array();
$tabVals = array();
for ($i = 0; $rowRepartitionPronoUser = mysql_fetch_array($resultRepartitionPronoUser); $i++) {
    $tabKeys[$i] = $rowRepartitionPronoUser[0];
    $tabVals[$i] = $rowRepartitionPronoUser[1];
}
$DataSet->AddPoint($tabVals, "Serie1");
$DataSet->AddPoint($tabKeys, "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
// Initialise the graph
$chart = new pChart(350, 200);
$chart->drawFilledRoundedRectangle(7, 7, 373, 193, 5, 240, 240, 240);
$chart->drawRoundedRectangle(5, 5, 375, 195, 5, 230, 230, 230);
// Draw the pie chart
$chart->setFontProperties("../lib/Fonts/tahoma.ttf", 8);
$chart->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 150, 90, 110, PIE_PERCENTAGE, TRUE, 50, 20, 5);
$chart->drawPieLegend(310, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
$chart->Stroke();
开发者ID:pronoschallenge,项目名称:PronosChallenge,代码行数:31,代码来源:stats_repartition_pronos.php

示例8: array

require_once "../gd-star-config.php";
$wpconfig = get_wpconfig();
require $wpconfig;
global $gdsr;
$data = GDSRChart::votes_counter();
$values = array();
$titles = array();
foreach ($data as $row) {
    $values[] = $row->counter;
    $titles[] = $row->vote;
}
include STARRATING_CHART_PATH . "pchart/pData.class";
include STARRATING_CHART_PATH . "pchart/pChart.class";
$data_set = new pData();
$data_set->AddPoint($values, "Serie1");
$data_set->AddPoint($titles, "Serie2");
$data_set->AddAllSeries();
$data_set->SetAbsciseLabelSerie("Serie2");
$chart = new pChart(430, 240);
$chart->loadColorPalette(STARRATING_CHART_PATH . "colors/default.palette");
$chart->drawFilledRoundedRectangle(7, 7, 423, 233, 5, 240, 240, 240);
$chart->drawRoundedRectangle(5, 5, 425, 235, 5, 230, 230, 230);
$chart->setFontProperties(STARRATING_CHART_PATH . "fonts/quicksand.ttf", 8);
$chart->drawPieGraph($data_set->GetData(), $data_set->GetDataDescription(), 180, 130, 130, PIE_PERCENTAGE, TRUE, 50, 20, 5);
$chart->drawPieLegend(370, 15, $data_set->GetData(), $data_set->GetDataDescription(), 250, 250, 250);
$chart->drawFilledRoundedRectangle(16, 16, 301, 34, 5, 220, 220, 220);
$chart->drawFilledRoundedRectangle(15, 15, 300, 33, 5, 250, 250, 250);
$chart->setFontProperties(STARRATING_CHART_PATH . "fonts/quicksand.ttf", 11);
$chart->drawTitle(20, 29, __("Chart with votes distribution", "gd-star-rating"), 250, 50, 50);
$chart->Stroke();
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:30,代码来源:chart_pie_votes_summary.php

示例9: createChart


//.........这里部分代码省略.........
            }
            $counter = 0;
            foreach ($lbl as $label) {
                $DataSet->SetSerieName($label, "Serie{$counter}");
                $counter++;
            }
            if ($cache->IsInCache("graph" . $language . $iSurveyID, $DataSet->GetData())) {
                $cachefilename = basename($cache->GetFileFromCache("graph" . $language . $iSurveyID, $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->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(255, 255, 255, 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(), 255, 255, 255);
                $cache->WriteToCache("graph" . $language . $iSurveyID, $DataSet->GetData(), $graph);
                $cachefilename = basename($cache->GetFileFromCache("graph" . $language . $iSurveyID, $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;
            while (isset($gdata[$i])) {
                if ($gdata[$i] == 0 || $type == "O" && substr($lbl[$i], 0, strlen($statlang->gT("Comments"))) == $statlang->gT("Comments")) {
                    array_splice($gdata, $i, 1);
                    array_splice($lbl, $i, 1);
                } else {
                    $i++;
                }
            }
            $lblout = array();
            if ($language == 'ar') {
                $lblout = $lbl;
                //reset text order to original
                Yii::import('application.libraries.admin.Arabic', true);
                $Arabic = new Arabic('ArGlyphs');
                foreach ($lblout as $kkey => $kval) {
                    if (preg_match("^[A-Za-z]^", $kval)) {
                        //auto detect if english
                        //eng
                        //no reversing
                    } else {
                        $kval = $Arabic->utf8Glyphs($kval, 50, false);
                        $lblout[$kkey] = $kval;
                    }
                }
            } elseif (getLanguageRTL($language)) {
                $lblout = $lblrtl;
            } else {
                $lblout = $lbl;
            }
            //create new 3D pie chart
            $DataSet = new pData();
            $DataSet->AddPoint($gdata, "Serie1");
            $DataSet->AddPoint($lblout, "Serie2");
            $DataSet->AddAllSeries();
            $DataSet->SetAbsciseLabelSerie("Serie2");
            if ($cache->IsInCache("graph" . $language . $iSurveyID, $DataSet->GetData())) {
                $cachefilename = basename($cache->GetFileFromCache("graph" . $language . $iSurveyID, $DataSet->GetData()));
            } else {
                $gheight = ceil($gheight);
                $graph = new pChart(690, $gheight);
                $graph->loadColorPalette($homedir . '/styles/' . $admintheme . '/limesurvey.pal');
                $graph->drawFilledRoundedRectangle(7, 7, 687, $gheight - 3, 5, 254, 255, 254);
                $graph->drawRoundedRectangle(5, 5, 689, $gheight - 1, 5, 230, 230, 230);
                // Draw the pie chart
                $graph->setFontProperties($rootdir . "/fonts/" . $chartfontfile, $chartfontsize);
                $graph->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 225, round($gheight / 2), 170, PIE_PERCENTAGE, TRUE, 50, 20, 5);
                $graph->setFontProperties($rootdir . "/fonts/" . $chartfontfile, $chartfontsize);
                $graph->drawPieLegend(430, 12, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
                $cache->WriteToCache("graph" . $language . $iSurveyID, $DataSet->GetData(), $graph);
                $cachefilename = basename($cache->GetFileFromCache("graph" . $language . $iSurveyID, $DataSet->GetData()));
                unset($graph);
            }
        }
        //end else -> pie charts
    }
    return $cachefilename;
}
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:101,代码来源:statistics_helper.php

示例10: get_chart

 /**
  * Displays a chart.
  *
  * @return void
  */
 public function get_chart()
 {
     $input = JFactory::getApplication()->input;
     error_reporting(E_ALL);
     include JPATH_COMPONENT . '/helpers/pchart/pData.class.php';
     include JPATH_COMPONENT . '/helpers/pchart/pChart.class.php';
     JFactory::getDocument()->setMimeEncoding('image/jpg');
     $data = $input->getVar('data', '');
     $labels = $input->getVar('labels', '');
     $colorChart = $input->getInt('color', 8);
     $colorPath = JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'pchart' . DS . 'colours' . DS . 'tones-' . $colorChart . '.txt';
     $DataSet = new pData();
     if ($data) {
         $data = explode(',', $data);
         $labels = explode(',', $labels);
         $DataSet->AddPoint($data, 'Serie1');
         $DataSet->AddPoint($labels, 'Serie2');
     } else {
         $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
     $chart = new pChart(380, 200);
     if (JFile::exists($colorPath)) {
         $chart->loadColorPalette($colorPath);
     }
     /*
                           $chart->drawFilledRoundedRectangle(7, 7, 373, 193, 5, 240, 240, 240);
                            $chart->drawRoundedRectangle(5, 5, 375, 195, 5, 230, 230, 230);
     */
     //-- Draw the pie chart
     $chart->setFontProperties(JPATH_COMPONENT . DS . 'helpers' . DS . 'pchart/Fonts/MankSans.ttf', 10);
     $chart->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 150, 90, 110, PIE_PERCENTAGE, true, 50, 20, 5);
     $chart->drawPieLegend(290, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
     //-- Spit it out
     $chart->Stroke();
     return;
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:45,代码来源:codeeyeajax.php

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

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

示例13: componentPieChart

 public function componentPieChart()
 {
     $DataSet = new pData();
     if (count($this->values) > 0) {
         $DataSet->AddPoint($this->values, "Serie1");
         $DataSet->AddPoint($this->labels, "Serie2");
         $DataSet->AddAllSeries();
         $DataSet->SetAbsciseLabelSerie("Serie2");
     }
     // Draw the pie chart
     // Initialise the graph
     $Test = new pChart($this->width, $this->height);
     $Test->setFontProperties(THEBUGGENIE_MODULES_PATH . 'pchart' . DS . 'fonts' . DS . 'DroidSans.ttf', 8);
     $Test->drawFilledRoundedRectangle(2, 2, $this->width - 3, $this->height - 3, 5, 240, 240, 240);
     $Test->drawRoundedRectangle(0, 0, $this->width - 1, $this->height - 1, 5, 230, 230, 230);
     if ($this->height > 200 && $this->width > 250) {
         if (count($this->values) > 0) {
             $Test->drawPieLegend($this->width / 3 + $this->width / 3, 40, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
         }
         $title_font_size = 10;
         $left = $this->width / 3;
         $pie_labels = PIE_PERCENTAGE_AND_VALUES;
     } else {
         $title_font_size = 7;
         $left = $this->width / 2;
         $pie_labels = PIE_NOLABEL;
     }
     if (isset($this->style) && $this->style == '3d' && count($this->values) > 0) {
         $Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), floor($left), floor($this->height / 2), floor(($this->width + $this->height) / 6), $pie_labels, TRUE, 40, 10, 3);
     }
     $Test->setFontProperties(THEBUGGENIE_MODULES_PATH . 'pchart' . DS . 'fonts' . DS . 'DroidSansBold.ttf', $title_font_size);
     $Test->drawTitle(50, 22, $this->title, 50, 50, 50, $this->width - 30);
     $Test->Stroke();
     //("example2.png");
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:35,代码来源:actioncomponents.class.php

示例14: pChart

        $Test->setFontProperties($CFG->dirroot . "/local/iomad/pchart/Fonts/tahoma.ttf", 10);
        $Test->drawTitle(0, 22, "Sample size", 50, 50, 50, 210);
        $Test->Stroke("SmallStacked.png");
        exit;
    } else {
        if ($charttype == "course") {
            // Initialise the graph
            $Test = new pChart(420, 250);
            $Test->drawFilledRoundedRectangle(7, 7, 413, 243, 5, 240, 240, 240);
            $Test->drawRoundedRectangle(5, 5, 415, 245, 5, 230, 230, 230);
            $Test->createColorGradientPalette(195, 204, 56, 223, 110, 41, 5);
            // Draw the pie chart
            $Test->setFontProperties($CFG->dirroot . "/local/iomad/pchart/Fonts/tahoma.ttf", 8);
            $Test->AntialiasQuality = 0;
            $Test->drawPieGraph($chartdata->GetData(), $chartdata->GetDataDescription(), 180, 130, 110, PIE_PERCENTAGE_LABEL, FALSE, 50, 20, 5);
            $Test->drawPieLegend(330, 15, $chartdata->GetData(), $chartdata->GetDataDescription(), 250, 250, 250);
            // Finish the graph
            $Test->setFontProperties($CFG->dirroot . "/local/iomad/pchart/Fonts/tahoma.ttf", 8);
            $Test->drawLegend(135, 150, $chartdata->GetDataDescription(), 255, 255, 255);
            $Test->setFontProperties($CFG->dirroot . "/local/iomad/pchart/Fonts/tahoma.ttf", 10);
            $Test->drawTitle(0, 22, "Course Completion", 50, 50, 50, 210);
            $Test->Stroke("SmallStacked.png");
            exit;
        }
    }
}
if (empty($dodownload) && !empty($charttype)) {
    $params['showchart'] = true;
    echo "<center><img src='" . new moodle_url('/local/report_completion/index.php', $params) . "'></center>";
}
if (!empty($dodownload)) {
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:31,代码来源:index.php

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


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