定制 samchristy/piechart 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

samchristy/piechart

最新稳定版本:v2.0.1

Composer 安装命令:

composer require samchristy/piechart

包简介

A simple class for drawing pie charts with ImageMagick or GD in PHP.

README 文档

README

Latest Stable Version License Total Downloads Monthly Downloads

A reasonably efficient* class for drawing pie charts with ImageMagick or GD in PHP. Intended as a learning exercise for using the NetBeans IDE and the Xdebug profiler and debugger. The code is available under the GNU GPL v3.0, so feel free to use it with attribution. I recommend using the Imagick version, PieChartImagick over the GD version, PieChartGD.

Demonstration

Below is the code required to generate a pie chart and echo it to the client's browser. The example uses the method outputPNG() to tell the browser to render the image. Alternatively, the function forceDownloadPNG() can be used to instruct the browser to bring up the save dialog.

Documentation

View the documentation (generated with ApiGen).

Installation

Use Composer!

Example Usage

<?php
require 'vendor/autoload.php';  // Composer's autoloader.
use SamChristy\PieChart\PieChartGD;

$chart = new PieChartGD(600, 375);

$chart->setTitle('Browser Usage Statistics (January - April)');
// Method chaining coming soon!
$chart->addSlice('Google Chrome',   27, '#4A7EBB');
$chart->addSlice('Mozilla Firefox', 23, '#DA8137');
$chart->addSlice('Apple Safari',    11, '#9BBB59');
$chart->addSlice('Opera',            3, '#BE4B48');
$chart->addSlice('Other',            5, '#7D60A0');

$chart->draw();
$chart->outputPNG();

Output

Pie Chart

*This example took 150ms to execute on my laptop (i3-350M @ 2.27 GHz).

© Sam Christy 2013

统计信息

  • 总下载量: 46.73k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 34
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 33
  • Watchers: 4
  • Forks: 17
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2013-09-29