Drawing dynamic arcs with PHP
A few years ago I was managing a web project where part of the requirement was to render a coloured rainbow representing achievement against a number of dimensions. The (existing) solution used Flash to achieve this, but this caused our users a lot of issues because they (variously) had flash disabled, the wrong version etc etc
Our developers at the time had dismissed alternate versions as not possible. However, I had a little spare time one weekend and built a solution using PHP.
The code
This page is just a simple html form allowing the values to be entered as percentages. In the production system these would be calculated from a range of metrics, which I’m emulating here using the form. Then, these values are used to dynamically create the image using this PHP. The approach I’ve taken is to draw a series of concentric segments, decreasing in size, so the subsequent segments are drawn on top of the previous segments, resulting in the concentric arcs.
The demo
Here’s the result:
Thanks, bon site