rockyangs / php-chart
A PHP chart library, implemented 2D / 3D broken line chart, bar chart, pie chart etc.
v1.0.0
2020-04-14 10:02 UTC
Requires
- php: >=5.3.0
- ext-gd: >=2.1.0
This package is auto-updated.
Last update: 2024-12-14 21:09:01 UTC
README
一个 PHP 图表生成工具,开箱即用,生成各种折线图,2D/3D 饼状图,条形图等。
如何使用
composer install rockyangs/php-chart
Sample code
require_once("./vendor/autoload.php"); $data = array( '2005' => '60', '2006' => '90', '2007' => '120', '2008' => '160', '2009' => '240', '2010' => '300', '2011' => '320', '2012' => '400', '2013' => '540' ); //Y坐标抽参数 步长 => 点数 $axisy = array(100, 6); $config = array( 'data' => $data, 'axisy' => $axisy, 'title' => 'Sample Broken Line Chart', 'unit' => 'IP/次', 't_fsize' => 18, 't_font' => 0, 'bg_size' => array(800, 600) ); $chart = ChartFactory::create(BrokenChart::class, $config); // show image in browser $chart->showChart(); // save image to file $chart->saveChart("{$dir}/broken-chart.png", 'png');