34

How can I generate graphs and charts from a mysql database using php?

I'm trying to use "chart director" but I can't even install it properly, because I'm using php version 5.3, and it's using a deprecated function dl.

Do you know of any alternatives that:

  • fully support php 5.3
  • are easy to use for beginners
  • can access the mysql database and chart its data
Matt Fenwick
  • 48,199
  • 22
  • 128
  • 192
Wern Ancheta
  • 22,397
  • 38
  • 100
  • 139

4 Answers4

14

You can use JPGraph and Graphpite

http://jpgraph.net/

http://graphpite.sourceforge.net/

sushil bharwani
  • 29,685
  • 30
  • 94
  • 128
  • do you have a copy of the jpgraph?I cannot download it from their site, every browser that I have used is unable to download jpgraph, its unable to determine the download site – Wern Ancheta Dec 04 '10 at 08:20
  • 1
    A very good example with php code using mysql database can be found here: http://www.css-resources.com/Make-Line-Chart-from-MySQL-Table-Data.html – Dexter Sep 30 '14 at 18:59
  • Try [www.chartphp.com](http://chartphp.com) – Azghanvi Feb 12 '16 at 06:53
14

I use highcharts. They are very interactive (and very fancy I might add). You do have to get a little creative to access data from MySQL database, but if you have a general understanding of JavaScript and PHP, you should have no problems.

Brett
  • 721
  • 2
  • 10
  • 20
  • Hi @Brett, could you explain a little about what you mean by having to get creative to get the Data from the MySQL database? I'm in the situation where I need to draw graphs to a website from a database and highcharts looks great, I'm not very proficient at JS however. – Gideon Sep 18 '12 at 21:50
10

I use Google Chart Tools https://developers.google.com/chart/ It's well documented and the charts look great. Being javascript, you can feed it json data via ajax.

belteshazzar
  • 2,163
  • 2
  • 21
  • 30
3

http://pchart.sourceforge.net/ looks very good and it's free.

dsomnus
  • 1,391
  • 14
  • 21