My *nix world

Lightweight free PHP chart library

This project has a weird history (like any other project, though).

I have an application and its dedicated website where I'm collecting some sort of data/statistics of the application usage. The statistics are automatically send to me by e-mail in a tabular report layout.

So, two weeks ago I said: "OK, but it should be nice if I would see some kind of trends, so I would grasp in a second what's going on without chewing 1000 data rows from the tabular report". That was the moment when I understood that I need some sort of PHP charts. I've googled the Internet, I've found some candidates, they've looked nice and mature projects. But they were more complex than I really need. So, naively like always I've said to myself : "it will take me less time to write 100 lines of code then getting a lightweight bar chart than deploying a mammoth library and trying to figure how it works".

So I've wrote the vertical|horizontal bar chart in like one-two days, then I've thought it will require only few hours to extend the code so that it supports points/lines. Then I've said it should be a breeze to draw few arcs and to get a pie. Later I've seen a pattern so I've rewritten some parts of the code, moving the common parts to a base class. After one week, after playing with these charts and some real-life data I've understood that they really need to support multiple data sets so I've began to rewrite some parts of the code.

One week later it get a final shape so now I am using it in real live. A lightweight free PHP chart library!
I've thought that it would be nice if someone else could join to the project team and improve the work already done or at least if some other people might try using it.

The whole project has about 1000+ lines of code, the code is fully OOP oriented, well documented and more than anything else is open and free.
I call it "Poor man's PHP chart library" and it can be found at its repository.


  • 1000+ full (documented) source code
  • fast speed and small memory footprint
  • easy to setup and to integrate into your PHP apps
  • fully OOP oriented code
  • 2D chart control with header, footer, legend
  • 3D pie chart class
  • standard series style (horizontal|vertical bar and 100% stacked bar, scattered points and line charts with regression line)
  • single and multiple data sets
  • add data by code or load it from CSV files
  • customization of title and axes names, their visibility, fg/bg colour, fonts, grid visibility, legend visibility, margins, bar orientation (vertical|horizontal), tool-tip visibility, anti-aliasing on|off, etc.
  • PHP 5 compatible
  • no external dependency, only PHP with GD support is required


This project is licensed under the Apache License, Version 2.0.


lightweight free php chart library

click to open its screen shots Wiki page

Here you can try some LIVE charts randomly generated.

Now, if you think that this article was interesting don't forget to rate it. It shows me that you care and thus I will continue write about these things.

The following two tabs change content below.
Lightweight free PHP chart library

Eugen Mihailescu

Founder/programmer/one-man-show at Cubique Software
Always looking to learn more about *nix world, about the fundamental concepts of math, physics, electronics. I am also passionate about programming, database and systems administration. 16+ yrs experience in software development, designing enterprise systems, IT support and troubleshooting.
Lightweight free PHP chart library

Latest posts by Eugen Mihailescu (see all)

Tagged on: , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *


Get every new post on this blog delivered to your Inbox.

Join other followers: