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


PHP pChart::drawPieGraph方法代码示例

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


在下文中一共展示了pChart::drawPieGraph方法的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:

$Test->setColorPalette(2, 209, 135, 237);
$Test->setColorPalette(3, 197, 101, 233);
$Test->setColorPalette(4, 176, 46, 224);
$Test->setColorPalette(5, 188, 224, 46);
$Test->setColorPalette(6, 224, 100, 46);
$Test->setColorPalette(7, 224, 214, 46);
/* $Test->setColorPalette(5,155,206,240); 
 $Test->setColorPalette(6,107,183,233); 
 $Test->setColorPalette(7,81,170,230); 
*/
$Test->setColorPalette(8, 46, 151, 224);
//$Test->drawFilledRoundedRectangle(7,7,453,343,5,240,240,240);
// $Test->drawRoundedRectangle(5,5,455,345,5,230,230,230);
// $Test->createColorGradientPalette(205,194,251,103,50,251,9);
// $Test->createColorGradientPalette(225,250,251,103,200,50,9);
// Draw the pie chart
$Test->AntialiasQuality = 0;
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
if ($time > 0) {
    $Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 230, 180, 140, PIE_PERCENTAGE_LABEL, TRUE, 70, 20, 5);
}
//$Test->drawPieLegend(420,15,$DataSet->GetData(),$DataSet->GetDataDescription(),250,250,250);
$Test->setFontProperties("Fonts/MankSans.ttf", 12);
if ($time) {
    $Test->drawTitle(10, 20, "Activities for " . $time . " hours", 100, 100, 100);
} else {
    $Test->drawTitle(10, 20, "No Activity data", 100, 100, 100);
}
$Test->addBorder(2);
// Write the title
$Test->Stroke();
开发者ID:kkskipper,项目名称:KNOWME,代码行数:31,代码来源:pie.php

示例4: elseif

//---------------------------- 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
Header("Content-type:image/png");
imagepng($Test->Picture);
//$Test->Render();
//---------------------------- Disconnect
$db->Disconnect();
// closing database connection
开发者ID:cdkisa,项目名称:majordomo,代码行数:31,代码来源:pie.php

示例5: pieChart

 function pieChart($r, $percents, $legend, $imgname = '', $title = '', $bottom_label = '', $config = array())
 {
     $settings = array('Skew' => 90, 'SpliceHeight' => 10, 'SpliceDistance' => 0, 'PieFontSize' => 8, 'TitleFontSize' => 10, 'LegendFontSize' => 8, 'LabelFontSize' => 10, 'PieFontName' => 'tahoma.ttf', 'TitleFontName' => 'tahoma.ttf', 'LegendFontName' => 'tahoma.ttf', 'LabelFontName' => 'tahoma.ttf', 'TitleBGR' => 0, 'TitleBGG' => 0, 'TitleBGB' => 0, 'TitleFGR' => 0, 'TitleFGG' => 0, 'TitleFGB' => 0, 'ImgR' => 240, 'ImgG' => 240, 'ImgB' => 240, 'BorderR' => 0, 'BorderG' => 0, 'BorderB' => 0, 'LegendR' => 250, 'LegendG' => 250, 'LegendB' => 250, 'LabelBGR' => 0, 'LabelBGG' => 0, 'LabelBGB' => 0, 'LabelFGR' => 0, 'LabelFGG' => 0, 'LabelFGB' => 0);
     // Get the custom settings
     if (is_array($config)) {
         foreach ($config as $key => $val) {
             $settings[$key] = $val;
         }
     }
     if ($settings['SpliceHeight'] == 0) {
         $settings['SpliceHeight'] = 1;
     }
     // avoid division by zero in pChart
     $PieFontSize = $settings['PieFontSize'];
     $TitleFontSize = $settings['TitleFontSize'];
     $LegendFontSize = $settings['LegendFontSize'];
     $LabelFontSize = $settings['LabelFontSize'];
     $PieFontName = $this->_ext_path . "/fonts/" . $settings['PieFontName'];
     $TitleFontName = $this->_ext_path . "/fonts/" . $settings['TitleFontName'];
     $LegendFontName = $this->_ext_path . "/fonts/" . $settings['LegendFontName'];
     $LabelFontName = $this->_ext_path . "/fonts/" . $settings['LabelFontName'];
     $Skew = $settings['Skew'];
     // Calc legend size
     $Wmax = 0;
     $TextHeight = 0;
     foreach ($legend as $lg) {
         $Position = imageftbbox($LegendFontSize, 0, $LegendFontName, $lg);
         $TextWidth = $Position[2] - $Position[0];
         $TextHeight = $TextHeight + $Position[1] - $Position[7];
         $Wmax = $TextWidth > $Wmax ? $TextWidth : $Wmax;
         // Maximum width of the legend
     }
     $legendW = $Wmax + 30;
     if (strlen($title) > 0) {
         $Position = imageftbbox($TitleFontSize, 0, $TitleFontName, $title);
         $titleWidth = $Position[2] - $Position[0] + 40;
         $titleHeight = $Position[1] - $Position[7] + 8;
     } else {
         $titleWidth = 0;
         $titleHeight = 0;
     }
     if (strlen($bottom_label) > 0) {
         $Position = imageftbbox($LabelFontSize, 0, $LabelFontName, $bottom_label);
         $labelWidth = $Position[2] - $Position[0] + 8;
         $labelHeight = $Position[1] - $Position[7] + 8;
     } else {
         $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) {
//.........这里部分代码省略.........
开发者ID:ohjack,项目名称:mallerp_standard,代码行数:101,代码来源:Charts.php

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

示例7: pData

// Standard inclusions
include $DOCROOT . $ROOTPATH . "/pChart/pChart/pData.class";
include $DOCROOT . "/" . $ROOTPATH . "/pChart/pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint(array(9, 8, 3), "Serie1");
//$DataSet->AddPoint(array(9, 8, 3), "Serie2");
$DataSet->AddPoint(array("Kirby Sentria", "Shampooer", "Zipp Brush"), "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
// Initialise the graph
$Test = new pChart(700, 500);
$Test->setFontProperties($DOCROOT . "/" . $ROOTPATH . "/pChart/Fonts/tahoma.ttf", 13);
// Finish the graph
$Test->setFontProperties($DOCROOT . "/" . $ROOTPATH . "/pChart/Fonts/tahoma.ttf", 13);
$Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 250, 210, 240, PIE_PERCENTAGE_LABEL, TRUE, 50, 20, 5);
$Test->drawPieLegend(510, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
$Test->Render($TempDir . "/example1.png");
?>




<div id="container">
	<a href="#" onclick="pdfReport( $('#reportDiv') ); return false;">PDF</a>
	<div style="background-color: white; width:1020px;" id="reportDiv">

		<center>
		<h1>General Sales Report</h1>
		<h2>Monday November 30, 2009</h2>
		<h3><?php 
开发者ID:aedvalson,项目名称:Nexus,代码行数:31,代码来源:report1.php

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

示例9: pData

/*
 Example13: A 2D exploded pie graph
*/
// Standard inclusions
require_once "../pChart/pData.class";
require_once "../pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
$data = array(10, 12, 13);
$sum = array_sum($data);
$DataSet->AddPoint(array(10, 12, 13), "Serie1");
$DataSet->AddPoint(array("Charcoal", "Firewood", "Kerosene"), "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
// Initialise the graph
$Test = new pChart(420, 250);
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
$Test->drawFilledRoundedRectangle(7, 7, 413, 243, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 415, 245, 5, 230, 230, 230);
//$Test->drawRoundedRectangle(5, 5, 295, 195, 5, 230, 230, 230);
// Draw the pie chart
$Test->AntialiasQuality = 0;
$Test->setShadowProperties(2, 2, 200, 200, 200);
//$Test->drawFlatPieGraphWithShadow($DataSet->GetData(), $DataSet->GetDataDescription(), 150,130,90, PIE_PERCENTAGE, 8);
$Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 150, 130, 90, PIE_PERCENTAGE, 8);
$Test->clearShadow();
$Test->drawPieLegend(330, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
$Test->setFontProperties("../Fonts/tahoma.ttf", 13);
$Test->drawTitle(10, 20, "Fuel Usage in 2015", 114, 16, 46);
$Test->drawTitle(320, 220, 'Total :' . $sum . 'kg', 224, 46, 147);
$Test->Render("fuel.png");
开发者ID:bettirosengugi,项目名称:My-Web-Projects,代码行数:31,代码来源:fuelGraph.php

示例10: pData


//.........这里部分代码省略.........
             $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) {
                     break;
                 }
                 $scatterdrawn = true;
                 $series1 = false;
                 $series2 = false;
开发者ID:JorgeUlises,项目名称:higia,代码行数:67,代码来源:swgraph_pchart.php

示例11: pieGraph

 /**
  * Build The Pie Graph images with given params 
  * and store in upload/pChart directory.
  *
  * @param  array $params    an assoc array of name/value pairs          
  * @return array $filesPath created image files Path.
  *
  * @static
  */
 static function pieGraph($params)
 {
     if (empty($params)) {
         return;
     }
     //configure the directory for pChart.
     $config =& CRM_Core_Config::singleton();
     //get the currency.
     $currency = $config->defaultCurrency;
     $pChartPath = str_replace('templates', 'packages', $config->templateDir);
     $pChartPath .= 'pChart/Fonts/';
     $uploadDirURL = str_replace('persist/contribute/', 'upload/pChart/', $config->imageUploadURL);
     $uploadDirPath = $config->uploadDir . 'pChart/';
     //create pchart directory, if exist clean and then create again.
     if (!is_dir($uploadDirPath)) {
         CRM_Utils_File::cleanDir($uploadDirPath);
         CRM_Utils_File::createDir($uploadDirPath);
     } else {
         CRM_Utils_File::createDir($uploadDirPath);
     }
     require_once 'packages/pChart/pData.class.php';
     require_once 'packages/pChart/pChart.class.php';
     $chartCount = 0;
     $filesValues = array();
     foreach ($params as $chartIndex => $chartValues) {
         $chartCount++;
         $shades = 0;
         $names = $values = $lengths = array();
         foreach ($chartValues['values'] as $indexName => $indexValue) {
             if ($indexValue) {
                 $names[] = $indexName;
                 $values[] = $indexValue;
                 $lengths[] = strlen($indexName);
                 $shades++;
             }
         }
         $legend = CRM_Utils_Array::value('legend', $chartValues);
         $xname = CRM_Utils_Array::value('xname', $chartValues);
         $yname = CRM_Utils_Array::value('yname', $chartValues);
         $dataSet = new pData();
         $dataSet->AddPoint($names, "Serie2");
         $dataSet->AddPoint($values, "Serie1");
         $dataSet->AddAllSeries();
         $dataSet->SetAbsciseLabelSerie("Serie2");
         //Initialise the graph variables.
         //with only radius we can resize entire image.
         $radius = 150;
         $skew = 50;
         $spliceHeight = 20;
         $spliceDistance = 4;
         //get the length for legend.
         $legendLength = 45 + 7 * max($lengths);
         //cofigure all other parameters at run time.
         $xSize = 2 * ($radius + $legendLength) + 60;
         $ySize = 2 * $radius + 40;
         //resize vertically if more values.
         if (count($values) > 18) {
             $ySize = $ySize + 15 * (count($values) - 18);
         }
         $xPosition = ($xSize - $legendLength) / 2;
         $yPosition = $ySize / 2;
         //Initialise the graph
         $chart = new pChart($xSize, $ySize);
         $chart->drawFilledRoundedRectangle(0, 0, $xSize, $ySize, 5, 240, 240, 240);
         $chart->drawRoundedRectangle(0, 0, $xSize, $ySize, 5, 230, 230, 230);
         //set color shades.
         $chart->setColorShades($shades, self::$_colors);
         //Draw the pie chart
         $chart->setFontProperties($pChartPath . 'tahoma.ttf', 10);
         $chart->AntialiasQuality = 0;
         $chart->drawPieGraph($dataSet->GetData(), $dataSet->GetDataDescription(), $xPosition, $yPosition, $radius, PIE_PERCENTAGE_LABEL, FALSE, $skew, $spliceHeight, $spliceDistance);
         $chart->drawPieLegend($xSize - $legendLength, 10, $dataSet->GetData(), $dataSet->GetDataDescription(), 250, 250, 250);
         //write the title
         if ($legend) {
             $chart->setFontProperties($pChartPath . "tahoma.ttf", 10);
             $chart->drawTitle($xPosition - strlen($legend) * 3, 22, $legend, 50, 50, 50);
         }
         if ($xname) {
             $chart->setFontProperties($pChartPath . "tahoma.ttf", 8);
             $chart->drawTitle($xPosition - (strlen($xname) - 158), 8, $xname, 10, 10, 10);
         }
         if ($yname) {
             $chart->setFontProperties($pChartPath . "tahoma.ttf", 8);
             $chart->drawTitle($yPosition - (strlen($yname) - 254), 8, $yname, 5, 30, 10);
         }
         $fileName = "pChart{$chartCount}" . time() . '.png';
         $chart->Render($uploadDirPath . $fileName);
         //get the created file path.
         $filesValues[$chartIndex]['file_name'] = $uploadDirURL . $fileName;
         //get the coordinates.
         $allCoords = $chart->coordinates();
//.........这里部分代码省略.........
开发者ID:ksecor,项目名称:civicrm,代码行数:101,代码来源:PChart.php

示例12: foreach

            $DataSet = new pData;

            $DataSet->AddPoint($series[1], "Serie1");
            // Invert/Reverse Hebrew labels so it can be rendered using PHP imagettftext()
            foreach ($series[0] as $key => $value) {
                $invertedlabels[$key] = strip_tags((preg_match("/[\xE0-\xFA]/", iconv("UTF-8", "ISO-8859-8", $value))) ? $reportclass->utf8_strrev($value) : $value);
            }
            $DataSet->AddPoint($invertedlabels /* $series[0] */, "Serie2");
            $DataSet->AddAllSeries();
            $DataSet->SetAbsciseLabelSerie("Serie2");

            // Initialise the graph
            $Test = new pChart(450, 200 + (count($series[0]) * 10));
            $Test->drawFilledRoundedRectangle(7, 7, 293, 193, 5, 240, 240, 240);
            $Test->drawRoundedRectangle(5, 5, 295, 195, 5, 230, 230, 230);
            $Test->createColorGradientPalette(195, 204, 56, 223, 110, 41, 5);

            // Draw the pie chart
            $Test->setFontProperties($CFG->dirroot . "/blocks/cobalt_reports/lib/Fonts/tahoma.ttf", 8);
            $Test->AntialiasQuality = 0;
            //$Test->drawFlatPieGraph($DataSet->GetData(),$DataSet->GetDataDescription(),120,100,60,TRUE,10);
            //$Test->drawBasicPieGraph($DataSet->GetData(),$DataSet->GetDataDescription(),120,100,70,PIE_PERCENTAGE,255,255,218);
            $Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 150, 90, 110, PIE_PERCENTAGE, TRUE, 50, 20, 5);
            $Test->drawPieLegend(300, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);

            ob_clean(); // Hack to clear output and send only IMAGE data to browser
            $Test->Stroke();
        }
    }
}
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:30,代码来源:graph.php

示例13: generate_statistics


//.........这里部分代码省略.........
                        {
                            $lblout=$lblrtl;
                        }
                        else
                        {
                            $lblout=$lbl;
                        }


                        //create new 3D pie chart
                        if ($usegraph==1)
                        {
                            $DataSet = new pData;
                            $DataSet->AddPoint($gdata,"Serie1");
                            $DataSet->AddPoint($lblout,"Serie2");
                            $DataSet->AddAllSeries();
                            $DataSet->SetAbsciseLabelSerie("Serie2");

                            if ($MyCache->IsInCache("graph".$surveyid,$DataSet->GetData()))
                            {
                                $cachefilename=basename($MyCache->GetFileFromCache("graph".$surveyid,$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);
                                $MyCache->WriteToCache("graph".$surveyid,$DataSet->GetData(),$graph);
                                $cachefilename=basename($MyCache->GetFileFromCache("graph".$surveyid,$DataSet->GetData()));
                                unset($graph);
                            }
                            //print_r($DataSet->GetData()); echo "<br/><br/>";
                        }

                    }	//end else -> pie charts

                    //introduce new counter
                    if (!isset($ci)) {$ci=0;}

                    //increase counter, start value -> 1
                    $ci++;
                    switch($outputType)
                    {
                        case 'xls':

                            /**
                             * No Image for Excel...
                             */

                            break;
                        case 'pdf':

                            $pdf->AddPage('P','A4');

                            $pdf->titleintopdf($pdfTitle,$titleDesc);
                            $pdf->Image($tempdir."/".$cachefilename, 0, 70, 180, 0, '', $homeurl."/admin.php?sid=$surveyid", 'B', true, 150,'C',false,false,0,true);
开发者ID:nmklong,项目名称:limesurvey-cdio3,代码行数:66,代码来源:statistics_function.php

示例14: disableAllSeries

$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") {
                        setSerieDrawable($plot, $graphData, $v1["name"] . $k1, TRUE);
                    }
                }
            }
            $stackeddrawn = true;
开发者ID:lihaobin0320,项目名称:yii2-reportico,代码行数:31,代码来源:dyngraph_pchart.php

示例15: _

    $Point1[] = $myrow['value'];
    $Point2[] = $myrow['stockid'];
}
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($Point1, "Serie1");
$DataSet->AddPoint($Point2, "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
// 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("includes/pchart/Fonts/tahoma.ttf", 8);
$Test->AntialiasQuality = 0;
$Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 180, 130, 110, PIE_PERCENTAGE_LABEL, FALSE, 50, 20, 5);
$Test->drawPieLegend(330, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
// Write the title
$Test->setFontProperties("includes/pchart/Fonts/MankSans.ttf", 10);
$Test->drawTitle(10, 20, "Sales per month", 100, 100, 100);
$Test->Render("example10.png");
echo '<tr><th colspan="5"><font color="navy" size="2">';
echo _('Income for the previous week');
echo '</font></th></tr>';
echo '<td>';
echo '<img src=example10.png />';
echo '</td></tr></table>';
echo '</td></table>';
include 'includes/footer.inc';
开发者ID:sunilburli,项目名称:webERP-Medical,代码行数:31,代码来源:KCMCRadiologyReport.php


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