本文整理汇总了PHP中Canvas::addChart方法的典型用法代码示例。如果您正苦于以下问题:PHP Canvas::addChart方法的具体用法?PHP Canvas::addChart怎么用?PHP Canvas::addChart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Canvas
的用法示例。
在下文中一共展示了Canvas::addChart方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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');
示例2: Canvas
*/
namespace graph_library;
require_once '../Autoloader.php';
header('Content-Type:image/png');
$platno = new Canvas();
$podaci = new DataCollection();
//line chart
$line_chart = new LineChart('Cijena dionica', 300, 300);
$legend = new Legend();
$legend->addItem(new LegendItem('Relativni odnos dionica zadnjih 5 godina'));
$podaci->addItems(array(new DataCollectionItem([2011, 10]), new DataCollectionItem([2012, 15]), new DataCollectionItem([2013, 8]), new DataCollectionItem([2014, 19]), new DataCollectionItem([2015, 22])));
$line_chart->setLegend($legend, 10, 100);
$id_podataka = $line_chart->addData($podaci);
$line_chart->colorData(16, 80, 57, $id_podataka);
$platno->addChart($line_chart, 0, 0);
//pie chart
$line_chart = new PieChart('Naslov pie charta', 300, 300);
$pieLegend = new Legend();
$pieLegend->addItem(new LegendItem('1. item legende'));
$pieLegend->addItem(new LegendItem('2. item legende'));
$line_chart->setLegend($pieLegend, 200, 100);
$podatak = new DataCollection();
$podatak->addItem(new DataCollectionItem([5]));
$id_podataka = $line_chart->addData($podatak);
$line_chart->colorData(56, 80, 57, $id_podataka);
$podatak = new DataCollection();
$podatak->addItem(new DataCollectionItem([17]));
$id_podataka = $line_chart->addData($podatak);
$line_chart->colorData(16, 20, 17, $id_podataka);
$podatak = new DataCollection();
示例3: Canvas
* Date: 06/03/16
* Time: 18:25
*/
namespace graph_library;
require_once '../Autoloader.php';
header('Content-Type:image/png');
$platno = new Canvas();
$podaci = new DataCollection();
$barchart = new BarChart('Cijena dionica', 295, 500);
$legend = new Legend();
$legend->addItem(new LegendItem('Relativni odnos dionica zadnjih 5 godina'));
$podaci->addItems(array(new DataCollectionItem([2011, 10]), new DataCollectionItem([2012, 15]), new DataCollectionItem([2013, 8]), new DataCollectionItem([2014, 19]), new DataCollectionItem([2015, 22])));
$barchart->setLegend($legend, 10, 25);
$barchart->colorData(16, 80, 57, $barchart->addData($podaci));
$platno->addChart($barchart, 30, 305);
$lineChart = new LineChart('Cijena dionica', 300, 300);
$lineChart->setLegend($legend, 10, 30);
$lineChart->colorData(16, 80, 57, $lineChart->addData($podaci));
$platno->addChart($lineChart, 2, 0);
// pie chart
$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]));
示例4: Canvas
<?php
/**
* Created by PhpStorm.
* User: martinmatak
* Date: 06/03/16
* Time: 18:12
*/
namespace graph_library;
require_once '../Autoloader.php';
header('Content-Type:image/png');
$platno = new Canvas();
$podaci = new DataCollection();
$barchart = new BarChart('Cijena dionica', 300, 300);
$legend = new Legend();
$legend->addItem(new LegendItem('Relativni odnos dionica zadnjih 5 godina'));
$podaci->addItems(array(new DataCollectionItem([2011, 10]), new DataCollectionItem([2012, 15]), new DataCollectionItem([2013, 8]), new DataCollectionItem([2014, 19]), new DataCollectionItem([2015, 22])));
$barchart->setLegend($legend, 10, 25);
$barchart->colorData(16, 80, 57, $barchart->addData($podaci));
$platno->addChart($barchart, 0, 0);
$lineChart = new LineChart('Cijena dionica', 300, 300);
$lineChart->setLegend($legend, 10, 30);
$lineChart->colorData(16, 80, 57, $lineChart->addData($podaci));
$platno->addChart($lineChart, 310, 0);
$slika = $platno->render();
imagepng($slika);
$platno->save('LineAndBar.png');