Woistmeinhandy
Woistmeinhandy

Reputation: 19

Populating a pie chart with mysql field values

Is there any way to create,populate a pie chart in php with mysql column values?

I have a column called subject that contains 40 or so different values and I would like to create a pie chart and display the top 10 values. I have tried with rgraph but can not get it to work at all, are there solutions that are easier to set up out there?

Upvotes: 0

Views: 334

Answers (1)

blarg
blarg

Reputation: 3893

You could use ORDER BY to sort the column by values and retrieve them from your database then a for loop in PHP to take the first ten and save them to an array. You can then populate a javascript pie chart from your array.

Upvotes: 1

Related Questions