luismarto/phpopenchart

PHP library to draw Column, Bar, Line and Pie Charts

3.0.2 2017-03-05 23:37 UTC

This package is auto-updated.

Last update: 2024-04-10 07:35:56 UTC


README

Phpopenchart was based on Libchart and allows you to create charts using PHP. It's specially useful when you need to create charts on the server-side and so you can't use a front-end library such as Highcharts.

68747470733a2f2f6765656b616c6963696f75732e70742f7068706f70656e63686172742f6173736574732f696d616765732f7068706f70656e63686172742d73616d706c652d322e706e67

use Phpopenchart\Chart\Column;

$chart = new Column([
    'chart' => [
        'width' => 1000,
        'height' => 300,
    ],
    'title' => [
        'text' => 'Values'
    ],
    'dataset' => [
        'series' => ['Product A', 'Product B', 'Product C'],
        'labels' => ['Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'],
        'data' => [
            [3296, 4852, 2010, 6004, 5014, 7695],
            [2036, 1816, 687, 1025, 3074, 3651],
            [123, 984, 102, 707, 853, 696],
        ]
    ]
]);

$chart->render();

Documentation & examples

There's an extensive documentation here with all the available options, methods and datasets.

If you're looking for examples check the examples page for all the available options or the /tests/actual.

Installation

Require the package in your composer.json file and update composer, using the following data:

"luismarto/phpopenchart": "3.*"

Roadmap

In a forseable future

  • Improve demo/examples section (display comparison between libchart and phpopenchart)
  • Make this easily integrated with Laravel

License

This library is is based on the original work of Jean-Marc Trémeaux (check the original website). Also used the fork from Alexander Stehlik.

Phpopenchart is distributed under the terms of the GNU GPL v3. This includes everything in the source code distribution except where otherwise stated.

Third Party Content

The following third party software is distributed with Phpopenchart and is provided under other licenses and/or has source available from other locations.

Files in the fonts directory are distributed under their own licence, which is located under the fonts directory.