petesiss/phphc 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

petesiss/phphc

Composer 安装命令:

composer require petesiss/phphc

包简介

Wrapper for HighCharts js charting lib

README 文档

README

Wrapper for highcharts js lib, allowing for easy config of charts via php arrays.

<?php

use Petesiss\PhpHc\ChartFactory;
use Petesiss\PhpHc\Renderer\Renderer;

$factory = new ChartFactory();

$chart = $factory->create()
    ->setChart(array('renderTo' => 'container', 'type' => 'line'))
    ->setTitle(array('text' => 'Traffic Flow'))
    ->setXAxis(array('categories' => array('Mon', 'Tue', 'Wed', 'Thurs', 'Fri')))
    ->setYAxis(array('title' => array('text' => 'Vehicles per minute')))
;

// add data series
$chart->addSeries('Main Street', array(44, 30, 34, 29, 48));
$chart->addSeries('Tower Road', array(29, 24, 27, 24, 28));

$renderer = new Renderer();

echo $renderer->render($chart);

Once a chart is created it can be configured using php arrays matching the highcharts API (http://api.highcharts.com/highcharts). There are accessor methods for each of the top level items - some of these shown in the example above.

The script block for the chart js can be easily rendered using the renderer as in the example. For more flexability just take the json from $chart->getJson() and deal with the rendering as required.

##Installation

Use composer to install, and make use of the autoload file composer will generate.

####Add to your composer.json

{
    "require": {
        "petesiss/phphc": "dev-master"
    }
}

####Then update your project dependencies

php composer.phar update petesiss/phphc

####Require composers generated autoload file

<?php
require 'vendor/autoload.php';

Alternatively the lib follows the PSR-0 convention so you can clone the repo and use any compatible autoloader.

This lib doesnt redistribute the highcharts js - you need to include that in your project yourself. It is currently available via the highcharts CDN (http://code.highcharts.com).

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-02-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固