PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Lucas de Oliveira   FusionCharts PHP Class API   README.md   Download  
File: README.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: FusionCharts PHP Class API
Generate graphical charts using FusionCharts API
Author: By
Last change: Update README.md
refactor code, add namespaces and fix psr2
Date: 6 years ago
Size: 2,485 bytes
 

Contents

Class file image Download

FusionCharts - API

__http://www.fusioncharts.com/__

PHPClasses

Description

This package can provide the data to generate graphical charts using the FusionCharts Library.

It provides a base class that can generate JSON for rendering several types of charts supported by the FusionCharts taking XML code that defines the parameters of the charts.

The package comes also with specialized classes that can generate the necessary XML code with the parameters for several types of charts.

Currently it comes with classes for rendering charts of types column, line, plot, pie and pareto.

The chart classes provide a fluent interface to define any of the supported parameters like the chart data values, chart size, colors, labels, fonts, and other chart specific parameters.

Requirement

  • PHP 5.3 >
  • Download the FusionCharts Javascript library in the oficial website
  • Import these two files to your HTML page: fusioncharts.charts.js and fusioncharts.js

Install

composer require deoliveiralucas/fusion-charts-api

Example

  • Columns
    use FusionCharts\Chart\ColumnLine;
    use FusionCharts\Tag\Categories;
    use FusionCharts\Tag\Category;
    use FusionCharts\Tag\DataSet as Columns;
    use FusionCharts\Tag\Set as Column;
    
    

// Data from db $months = array('Jan', 'Feb', 'Mar', 'Apr'); $values = array(100, 200, 150, 210);

$chart = new ColumnLine('chart-container');

$categories = new Categories(); foreach ($months as $month) {

$category = new Category($month);
$categories->addCategory($category);

}

$columns = new Columns(); foreach ($values as $value) {

$column = new Column($value);
$columns->addSet($column);

}

$chart

->setName('Chart Columns Example')
->setWidth(800)
->setHeight(400)
->setLabelRotate(true)
->setXdescription('x values')
->setYdescription('y values')
->setAttribute('showyaxisvalues', '0')
->addCategories($categories)
->addColumns($columns);

// render chart in the index.php


- Please see EXAMPLES for details.

## Contributing ##

- Please see CONTRIBUTING for details.

## License

- GNU General Public License Versions. Please see License File for more information.