本文整理汇总了PHP中Canvas::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Canvas::render方法的具体用法?PHP Canvas::render怎么用?PHP Canvas::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Canvas
的用法示例。
在下文中一共展示了Canvas::render方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Canvas
*/
namespace graph_library;
require_once '../Autoloader.php';
header('Content-Type:image/png');
$platno = new Canvas();
$pieChart = new PieChart('naslov pie charta', 300, 300);
$legend = new Legend();
$legend->addItem(new LegendItem('1. item legende'));
$legend->addItem(new LegendItem('2. item legende'));
$podatak = new DataCollection();
$podatak->addItem(new DataCollectionItem([5]));
$id_podataka = $pieChart->addData($podatak);
$pieChart->colorData(56, 80, 57, $id_podataka);
$podatak = new DataCollection();
$podatak->addItem(new DataCollectionItem([17]));
$id_podataka = $pieChart->addData($podatak);
$pieChart->colorData(16, 20, 17, $id_podataka);
$podatak = new DataCollection();
$podatak->addItem(new DataCollectionItem([35]));
$id_podataka = $pieChart->addData($podatak);
$pieChart->colorData(36, 40, 57, $id_podataka);
$podatak = new DataCollection();
$podatak->addItem(new DataCollectionItem([35]));
$id_podataka = $pieChart->addData($podatak);
$pieChart->colorData(170, 0, 0, $id_podataka);
$pieChart->setLegend($legend, 10, 100);
$platno->addChart($pieChart, 0, 0);
$slika = $platno->render();
imagepng($slika);
$platno->save('pie.png');