PHP Graphing – Pie Charts
We've built up a bar chart script, and now we draw a pie chart.
Drawing a pie chart is more complex than drawing a bar chart. We will need to create a script that takes the data from the data holding class and convert it into proportional amounts. With line and bar charts we were simply plotting a value along the vertical axis and the series along the horizontal axis, but with a pie chart, all of the data is represented in a circle. This means that we will need to work out proportionately how much each of our plot values will take up of the 360° that makes up a full circle. Once we have worked out the proportional amounts, we will then have to use some maths to determine where and how to draw the wedges of the circle that will represent the data.
Overview
Table of Content:
- Changing the data class
- Properties
- Methods
- Drawing the pie chart
- The last step
Allan comes from Cape Town, South Africa. He has been implicated in writing for several WROX, glasshaus, Wiley and Apress publications, generally in the 'cool stuff that PHP can do' sections.
You can catch up with him at his website http://www.mediafrenzy.co.za.
See All Postings From Allan Kent >>
Reviews
Be the first to write a review
You must me logged in to write a review.