FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

nightflyza/ChartMancer: ChartMancer - PHP library to charts generation using GD · GitHub

Latest commit

 

History

50 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
  • Easily customizable

Requirements

  • PHP >=5.3 (yes PHP 7.4-8.5 are 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);

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);

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);

Acid trip example

Basic pie chart

$chartMancer->setDebug(true);
$chartMancer->setImageWidth(600);
$chartMancer->setImageHeight(600);
$chartMancer->setChartTitle('Sales 2024');
$chartMancer->setChartLegend(array('Nissan', 'Toyota', 'Jeep'));
$chartMancer->setPiePercent(true);

$data = array(
    'Toyota' => 10.8,
    'Nissan' => 3.35,
    'Jeep' => 1.01,
);

$chartMancer->renderPie($data);

Practical usage examples

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

About

ChartMancer - PHP library to charts generation using GD

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages


Back | FazBrowse Home | New Git URL