本文整理汇总了PHP中pChart::drawFlatPieGraphWithShadow方法的典型用法代码示例。如果您正苦于以下问题:PHP pChart::drawFlatPieGraphWithShadow方法的具体用法?PHP pChart::drawFlatPieGraphWithShadow怎么用?PHP pChart::drawFlatPieGraphWithShadow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pChart
的用法示例。
在下文中一共展示了pChart::drawFlatPieGraphWithShadow方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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)
}
示例2: 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;
}
示例3: pData
<?php
/*
Example13: A 2D exploded 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->setFontProperties("Fonts/tahoma.ttf", 8);
$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->AntialiasQuality = 0;
$Test->setShadowProperties(2, 2, 200, 200, 200);
$Test->drawFlatPieGraphWithShadow($DataSet->GetData(), $DataSet->GetDataDescription(), 120, 100, 60, PIE_PERCENTAGE, 8);
$Test->clearShadow();
$Test->drawPieLegend(230, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
$Test->Render("example13.png");
示例4: elseif
$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
Header("Content-type:image/png");
imagepng($Test->Picture);
//$Test->Render();
//---------------------------- Disconnect
$db->Disconnect();
示例5: 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);
}