PHPackages                             shawnmccool/jpgraph - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. shawnmccool/jpgraph

ActiveLibrary[Image &amp; Media](/categories/media)

shawnmccool/jpgraph
===================

jpGraph, library to make graphs and charts

4.0.3(6y ago)06QPL-1.0PHPPHP &gt;=7.0.0

Since Jul 27Pushed 6y agoCompare

[ Source](https://github.com/ShawnMcCool/jpgraph)[ Packagist](https://packagist.org/packages/shawnmccool/jpgraph)[ Docs](http://jpgraph.net/)[ RSS](/packages/shawnmccool-jpgraph/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (8)Versions (26)Used By (0)

JPGRAPH v4.0.0 Community Edition
--------------------------------

[](#jpgraph-v400-community-edition)

You're seeing the README for version ^4, which requires PHP v7.0 or newer. If you need to run under PHP 5.6, please check [release v3.6](https://github.com/HuasoFoundries/jpgraph/tree/v3.6.21)

[![Packagist](https://camo.githubusercontent.com/51c57b9f927d38dc9cbd87c515ecbb5d15e049563b845731d192aaab4650a42f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f616d656e616469656c2f6a7067726170682e737667)](https://packagist.org/packages/amenadiel/jpgraph) [![FOSSA Status](https://camo.githubusercontent.com/72599b40b7ce48454497877d54c0d4f9f62f9bb062ecfa5b23014589e59982d3/68747470733a2f2f6170702e666f7373612e696f2f6170692f70726f6a656374732f6769742532426769746875622e636f6d253246487561736f466f756e64726965732532466a7067726170682e7376673f747970653d736869656c64)](https://app.fossa.io/projects/git%2Bgithub.com%2FHuasoFoundries%2Fjpgraph?ref=badge_shield)

[![Code Climate](https://camo.githubusercontent.com/1c3af62592675f7a469f79ddf5b332e61965f1a8c9d76bccfe1bd7b2d223a9ea/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f487561736f466f756e64726965732f6a7067726170682f6261646765732f6770612e737667)](https://codeclimate.com/github/HuasoFoundries/jpgraph)[![Codacy Badge](https://camo.githubusercontent.com/c0bc0e40ea4a9a77462c45862813884eaad5b883bb35bbfdc7cab446abbc75a7/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3161376561306361633164383462633739353435633966366666383563643235)](https://www.codacy.com/app/amenadiel/jpgraph?utm_source=github.com&utm_medium=referral&utm_content=HuasoFoundries/jpgraph&utm_campaign=Badge_Grade)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/af767938412fc574eed68a8f7b94d441d5c27ca6ada1c00664ef70957093f2ee/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f487561736f466f756e64726965732f6a7067726170682f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/HuasoFoundries/jpgraph/?branch=master)[![Build Status](https://camo.githubusercontent.com/f9dfbb8c144e48ffd8f51da17ea052433650ee1b04f40be2e693247582ebde78/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f487561736f466f756e64726965732f6a7067726170682f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/HuasoFoundries/jpgraph/build-status/master)[![StyleCI](https://camo.githubusercontent.com/ada56fcc91fe3223301075583d942b452c4f1c0ed59a4b63009c283e5e5844f3/68747470733a2f2f7374796c6563692e696f2f7265706f732f33393539303431322f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/39590412)[![Code Coverage](https://camo.githubusercontent.com/ce590e8f26c7dff3539fc3f6e89d949f555cddf893c635d8d3a29f529057d96a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f487561736f466f756e64726965732f6a7067726170682f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/HuasoFoundries/jpgraph/?branch=master)[![FOSSA Status](https://camo.githubusercontent.com/72599b40b7ce48454497877d54c0d4f9f62f9bb062ecfa5b23014589e59982d3/68747470733a2f2f6170702e666f7373612e696f2f6170692f70726f6a656374732f6769742532426769746875622e636f6d253246487561736f466f756e64726965732532466a7067726170682e7376673f747970653d736869656c64)](https://app.fossa.io/projects/git%2Bgithub.com%2FHuasoFoundries%2Fjpgraph?ref=badge_shield)

For a long time, [JpGraph](http://jpgraph.net/) got stalled at version 3.5.x (see its [README](README.3.5.md)), so we decided to refactor and release a **Community Edition** with a few improvements:

- The app was fully refactored adding namespaces, proper folder hierarchy, separating each class in its own file and stripping the use of `require` and `include` to the bare minimum
- It requires PHP 7.0 or newer
- it provides full composer compatibility
- it has PSR-4 autoloading
- it makes requirement checks so you can't go wrong
- it has release tags, to let `composer install` use your cached packages instead of pulling from github every time
- I stripped the docs because they are useless weight in a dependency. [You can find them here](http://jpgraph.net/doc/)
- The Examples folder were moved upwards, althought they are now in categories. Not all of them work at this point
- Examples pointing to features not present in the free tool were stripped from said folder (e.g. Barcodes)
- If the chosen font isn't found, it falls back to existing fonts instead of crashing
- If you try to use antialiasing functions not present in your current GD installation, it disables them instead of crashing

How to install
--------------

[](#how-to-install)

Using composer

```
composer require amenadiel/jpgraph:^4
```

How to use
----------

[](#how-to-use)

See the [examples folder](https://github.com/amenadiel/jpgraph/tree/master/Examples) for working samples.

The examples work the same way you should use this library:

- run `composer install`
- require `vendor/autoload.php` it the top of your script
- generate a graph with a snippet like the following

```
   require_once './vendor/autoload.php';
   use Amenadiel\JpGraph\Graph;
   use Amenadiel\JpGraph\Plot;

   // Create the Pie Graph.
   $graph = new Graph\PieGraph(350, 250);
   $graph->title->Set("A Simple Pie Plot");
   $graph->SetBox(true);

   $data = array(40, 21, 17, 14, 23);
   $p1   = new Plot\PiePlot($data);
   $p1->ShowBorder();
   $p1->SetColor('black');
   $p1->SetSliceColors(array('#1E90FF', '#2E8B57', '#ADFF2F', '#DC143C', '#BA55D3'));

   $graph->Add($p1);
   $graph->Stroke();
```

- **important** always instance your graph (of any kind) before creating its contents. This will in turn load all needed constants to the global scope.

See the examples working by performing the following steps:

- run `composer install`
- run `make start` **or** `php -S localhost:8000 -t Examples`
- Open your browser at

### Change the config

[](#change-the-config)

You can override some configs set on [config.inc.php](src/config.inc.php) by creating a `.env` file in your project root. See [.env.example](.env.example) as a reference.

### Wishlist

[](#wishlist)

- Get all the examples working (half of them have yet to be transformed from the old code to the new PSR-4 format)
- Add more tests (We need to test more classes and methods besides the ones in the examples, as well as perform more assetions on the current tests)
- Add alternative use of [imagick](http://php.net/manual/en/imagick.setup.php)

[![jpgraph_logo](https://raw.githubusercontent.com/HuasoFoundries/jpgraph/master/jpgraph_logo.jpg)](https://raw.githubusercontent.com/HuasoFoundries/jpgraph/master/jpgraph_logo.jpg)

License
-------

[](#license)

[![FOSSA Status](https://camo.githubusercontent.com/222503bdb8cb3cb2209fea8a838f3e1c5956be9fcc26ec2f9d3b217245380bf9/68747470733a2f2f6170702e666f7373612e696f2f6170692f70726f6a656374732f6769742532426769746875622e636f6d253246487561736f466f756e64726965732532466a7067726170682e7376673f747970653d6c61726765)](https://app.fossa.io/projects/git%2Bgithub.com%2FHuasoFoundries%2Fjpgraph?ref=badge_large)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 94.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~73 days

Recently: every ~89 days

Total

23

Last Release

2314d ago

Major Versions

3.6.21 → 4.0.02019-01-15

PHP version history (4 changes)3.6.0PHP &gt;=5.3.0

3.6.7PHP &gt;=5.4.0

3.6.19PHP &gt;=5.6.0

4.0.0PHP &gt;=7.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/6da00bb361f9beaa0dbd9577dd2b3c35089dd5d6ae9a3b57003d09f7737739b0?d=identicon)[ShawnMcCool](/maintainers/ShawnMcCool)

---

Top Contributors

[![ffflabs](https://avatars.githubusercontent.com/u/238439?v=4)](https://github.com/ffflabs "ffflabs (176 commits)")[![CorWatts](https://avatars.githubusercontent.com/u/220260?v=4)](https://github.com/CorWatts "CorWatts (2 commits)")[![eisberg](https://avatars.githubusercontent.com/u/9015003?v=4)](https://github.com/eisberg "eisberg (2 commits)")[![MoT3rror](https://avatars.githubusercontent.com/u/5009981?v=4)](https://github.com/MoT3rror "MoT3rror (2 commits)")[![asterion](https://avatars.githubusercontent.com/u/194420?v=4)](https://github.com/asterion "asterion (1 commits)")[![fossabot](https://avatars.githubusercontent.com/u/29791463?v=4)](https://github.com/fossabot "fossabot (1 commits)")[![funkjedi](https://avatars.githubusercontent.com/u/9314?v=4)](https://github.com/funkjedi "funkjedi (1 commits)")[![iquito](https://avatars.githubusercontent.com/u/973653?v=4)](https://github.com/iquito "iquito (1 commits)")[![abidaks](https://avatars.githubusercontent.com/u/20839618?v=4)](https://github.com/abidaks "abidaks (1 commits)")

---

Tags

datachartgraphpiejpgraph

###  Code Quality

TestsCodeception

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/shawnmccool-jpgraph/health.svg)

```
[![Health](https://phpackages.com/badges/shawnmccool-jpgraph/health.svg)](https://phpackages.com/packages/shawnmccool-jpgraph)
```

###  Alternatives

[amenadiel/jpgraph

Composer Friendly, full refactor of JpGraph, library to make graphs and charts

1492.2M7](/packages/amenadiel-jpgraph)[samchristy/piechart

A simple class for drawing pie charts with ImageMagick or GD in PHP.

3347.4k1](/packages/samchristy-piechart)[alimranahmed/laraocr

Laravel Optical Character Reader(OCR) package using different OCR engines like Tesseract

17081.9k](/packages/alimranahmed-laraocr)[ianw/quickchart

QuickChart chart API

46638.6k](/packages/ianw-quickchart)[gregwar/gnuplot

GnuPlot library

299.7k](/packages/gregwar-gnuplot)[ottaviano/faker-gravatar

Faker Gravatar image provider

1055.7k6](/packages/ottaviano-faker-gravatar)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
