|
| Firefox: | 33.7% |
| IE5: | 1.5% |
| IE6: | 38.1% |
| IE7: | 19.2% |
| Mozilla: | 1.3% |
| Opera: | 1.6% |
| Safari: | 1.5% |
is done by simply running the script on the command line:
php simplechart.php -d "Firefox=33.7|IE5=1.5|IE6=38.1|IE7=19.2|Mozilla=1.3|Opera=1.6|Safari=1.5" -t "Browser market share: May 2007" -u "%" -c "royalblue|limegreen|gold|crimson"
This will create the following output, which you can simply copy and paste into your website page content:
<div id="simplechart">
<table>
<caption>Browser market share: May 2007</caption>
<tr><td class="key first">Firefox:</td><td class="value first"><div class="bar" style="background: royalblue; width: 75%"> </div><div class="figure">33.7%</div></td></tr>
<tr><td class="key">IE5:</td><td class="value"><div class="bar" style="background: limegreen; width: 3%"> </div><div class="figure">1.5%</div></td></tr>
<tr><td class="key">IE6:</td><td class="value"><div class="bar" style="background: gold; width: 85%"> </div><div class="figure">38.1%</div></td></tr>
<tr><td class="key">IE7:</td><td class="value"><div class="bar" style="background: crimson; width: 42%"> </div><div class="figure">19.2%</div></td></tr>
<tr><td class="key">Mozilla:</td><td class="value"><div class="bar" style="background: royalblue; width: 2%"> </div><div class="figure">1.3%</div></td></tr>
<tr><td class="key">Opera:</td><td class="value"><div class="bar" style="background: limegreen; width: 3%"> </div><div class="figure">1.6%</div></td></tr>
<tr><td class="key last">Safari:</td><td class="value last"><div class="bar" style="background: gold; width: 3%"> </div><div class="figure">1.5%</div></td></tr>
</table>
</div>
The script accepts up to four arguments which dictate the output:
- -d: data values, delimited by a pipe (|) character and the key/value pairs assigned with an equals (=) character.
- -t: optional chart title.
- -u: optional unit of measure.
- -c: optional colour values, delimited by a pipe (|) character.
The CSS declaration required (which should be placed in a separate file) is included in the source code archive.
Some basic rules for commenting:
- Watch your language.
- Keep comments on-topic and relevant.
- You can use basic XHTML tags for formatting and linking but not bbcode.
- Comments are moderated, so don't double post if your comment doesn't appear immediately.
- Please proof-read your comments for spelling and grammar mistakes.
- Watch your language.
URI: http://lutrov.com/blog/simple-html-chart/
Copyright © 1999-2008 Lutrov Communications. Some rights reserved, read the legal stuff.
Copyright © 1999-2008 Lutrov Communications. Some rights reserved, read the legal stuff.
Search
Related
Popular
Chatty
Recent
Categories
Archives
Recommended
Standards
License


