- 授权协议: MIT
- 开发语言: PHP
- 操作系统: 跨平台
- 软件首页: https://demo.hisune.com/echarts-php/
- 软件文档: http://git.oschina.net/hisune/Echarts-PHP/blob/master/README.md
软件介绍
Echarts-PHP 是一个对echarts js封装的PHP库。
安装方法:
composer require "hisune/echarts-php"
Echarts-PHP使用PHP的property来绑定echarts js的options,同时支持所有options的IDE代码提示,使用非常方便。
所有IDE自动提示的PHPDoc都由脚本自动生成,因此当echarts js的options的属性有变动时,PHPDoc的更新变得异常简单。
我们可以通过直接对property赋值来指定options:
// The most simple example
use Hisune\EchartsPHP\ECharts;
$chart = new ECharts();
$chart->tooltip->show = true;
$chart->legend->data[] = '销量';
$chart->xAxis[] = array(
'type' => 'category',
'data' => array("衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子")
);
$chart->yAxis[] = array(
'type' => 'value'
);
$chart->series[] = array(
'name' => '销量',
'type' => 'bar',
'data' => array(5, 20, 40, 10, 10, 20)
);
echo $chart->render('simple-custom-id');
对于series、xAxis、yAxis数组,也可以使用property进行赋值,例如:
use \Hisune\EchartsPHP\Doc\IDE\Series; $series = new Series(); $series->type = 'map'; $series->map = 'world'; $series->data = array( array( 'name' => 'China', 'value' => 100, ) ); $series->label->emphasis->textStyle->color = '#fff'; $series->roam = true; $series->scaleLimit->min = 1; $series->scaleLimit->max = 5; $series->itemStyle->normal->borderColor = '#F2EFF4'; $series->itemStyle->normal->areaColor = '#993399'; $series->itemStyle->emphasis->areaColor = '#993399'; $chart->addSeries($series);
或者直接可以对option数组进行赋值:
$option = array ( 'tooltip' => array ( 'show' => true, ), 'legend' => array ( 'data' => array ( 0 => '销量', ), ), // ... ) $chart->setOption($option);
除了option配置,还支持echarts js 3.x版本的事件:
use \Hisune\EchartsPHP\Config;
// Recommend standard
$chart->on('click', Config::eventMethod('console.log'));
// Or write js directly
$chart->on('mousedown', 'console.log(params);');
码云:http://git.oschina.net/hisune/Echarts-PHP
Dreamweaver CS3 Bible
Joseph W. Lowery / Wiley / May 21, 2007 / $49.99
Book Description Learn to create dynamic, data-driven Web sites using the exciting enhancements in the Dreamweaver CS3 version. You get a thorough understanding of the basics and then progress to l......一起来看看 《Dreamweaver CS3 Bible》 这本书的介绍吧!
