ChartMancer - PHP library to charts generation using GD

Nightfly fe9fddf05d pffff 1 month ago
assets 57f2ee4dba naming update 1 year ago
examples 09181f3749 Columns render buffer now loops from tail. Why not? 1 month ago
src fe9fddf05d pffff 1 month ago
.gitignore dead4bbf29 few usage examples here 1 year ago
LICENSE ff4bcd8dd1 Initial commit 1 year ago
README.md 85271d5a51 omg 3 months ago
composer.json d3ba85a4ef files section 1 year ago

README.md

cmlogo_transp

ChartMancer

ChartMancer class automates the generation of graphs based on data provided in an array. It utilizes the GD library to create visually appealing charts, allowing developers to easily visualize and display data trends. With ChartMancer, you can customize various aspects of the graph, such as colors, labels, and other chart properties, providing a versatile tool for data representation in PHP applications.

Description

  • Minimalistic
  • Generates bar charts based on simple array datasets
  • Automatically adjusts chart properties to fit data
  • Outputs charts into browser or saves into files
  • Easy customizable

Requirements

  • PHP >=5.3 (PHP 7.4, 8.2, 8.3 is also compatible)
  • GD Library
  • Mbstring extension

Usage

Minimal example


$cm=new ChartMancer();

$data=array('Mon'=>8,'Tue'=>4,'Wed'=>7,'Thu'=>3,'Fri'=>6,'Sat'=>4,'Sun'=>0);

$cm->renderChart($data);

basic0

Nested data example


    $data = array();
    for ($i = 0; $i <= 249; $i++) {
        $data[$i] = array(rand(0, 129), rand(0, 79), rand(0, 54), rand(0, 4));
    }

$cm=new ChartMancer();
$cm->renderChart($data);

basic1

Large dataset with custom palette

$legend=array('Total','Disk 1','Disk 2','Disk 3','Disk 4','Disk 5','Disk 6');
$chartMancer->setDebug(true);
$chartMancer->setDrawFirstColumn(true);
$chartMancer->setChartLegend($legend);
$chartMancer->setPalette('0-M-G!!!');
$chartMancer->setChartTitle('Disks IO');
$chartMancer->setChartYaxisName('w/s');

$chartMancer->renderChart($data);

cmdio

Acid trip example

basic3

Practical usage examples

of1

of2

of3

Full class description

can be found here

Installation

The recommended method of installing this library is via Composer

Terminal

composer require chartmancer/chartmancer

License

MIT