本文整理汇总了PHP中pChart::render方法的典型用法代码示例。如果您正苦于以下问题:PHP pChart::render方法的具体用法?PHP pChart::render怎么用?PHP pChart::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pChart
的用法示例。
在下文中一共展示了pChart::render方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* Save chart as picture
* @param string $pic
* @return unknown
*/
public function save($pic)
{
if (empty($this->cdata)) {
require_once 'Hush/Chart/Exception.php';
throw new Hush_Chart_Exception('Empty data exception, please add data first');
}
$method = 'draw' . ucfirst($this->type);
if (method_exists($this, $method)) {
$this->{$method}();
$this->chart->render($pic);
}
}
示例2: pData
//.........这里部分代码省略.........
$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;
$graphImage->reportWarnings("GD");
$ct = 0;
foreach ($this->plot as $k1 => $v1) {
if ($v1["type"] == "SCATTER") {
if ($ct == 0) {
$series1 = $v1["name"] . $k1;
}
if ($ct == 1) {
$series2 = $v1["name"] . $k1;
}
$ct++;
setSerieDrawable($this->plot, $graphData, $v1["name"] . $k1, TRUE);
}
}
if (count($v["data"]) == 1) {
$v["data"][] = 0;
}
$graphImage->drawXYScale($graphData->GetData(), $graphData->GetDataDescription(), $series1, $series2, 0, 0, 0);
//$graphImage->drawXYGraph($graphData->GetData(), $graphData->GetDataDescription(), $series1, $series2);
$graphImage->drawXYPlotGraph($graphData->GetData(), $graphData->GetDataDescription(), $series1, $series2);
$graphImage->writeValues($graphData->GetData(), $graphData->GetDataDescription(), $series2);
break;
case "LINE":
default:
if ($linedrawn) {
break;
}
$linedrawn = true;
foreach ($this->plot as $k1 => $v1) {
if ($v1["type"] == "LINE") {
setSerieDrawable($this->plot, $graphData, $v1["name"] . $k1, TRUE);
}
}
if (count($v["data"]) == 1) {
$v["data"][] = 0;
}
$graphImage->LineWidth = 1;
$graphImage->drawLineGraph($graphData->GetData(), $graphData->GetDataDescription());
$graphImage->drawPlotGraph($graphData->GetData(), $graphData->GetDataDescription());
$graphImage->LineWidth = 1;
break;
}
}
foreach ($this->plot as $k1 => $v1) {
setSerieDrawable($this->plot, $graphData, $v1["name"] . $k1, TRUE);
}
// Draw Legend if legend value has been set
$drawlegend = false;
foreach ($this->plot as $k => $v) {
if (isset($v["legend"]) && $v["legend"]) {
// Temporarily Dont draw legend for Pie
//if ( $piechart )
//$graphImage->drawPieLegend($this->width_pdf_actual - 180,30,$graphData->GetData(), $graphData->GetDataDescription(), 250, 250, 250);
if (!$piechart) {
$graphImage->drawLegend($this->width_pdf_actual - 120, 30, $graphData->GetDataDescription(), 254, 254, 254, 0, 0, 0);
}
break;
}
}
$graphImage->setFontProperties(PCHARTFONTS_DIR . $this->xtitlefont, $this->titlefontsize);
$graphImage->drawTitle(0, 24, $this->title_actual, 50, 50, 50, $this->width_pdf_actual);
//$graphImage->setShadow(TRUE,array("X"=>0,"Y"=>0,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
//$graphImage->Render("example.png");
//$graphImage->Stroke();
$graphImage->render($outputfile);
return true;
}
示例3: render
/**
* Рендерит график и сохраняет его на диск
*
* @param pChart $chart
* @param array $points
*
* @return string
*/
private function render(pChart $chart, array $points)
{
$fileName = md5($this->dataProvider->getCampaign()->id . $this->dataProvider->getDateFrom() . $this->dataProvider->getDateTo() . serialize($points)) . '.png';
// Render the chart
$path = Yii::app()->params['tmpPath'] . DIRECTORY_SEPARATOR . $fileName;
$chart->render($path);
return $path;
}