Bar Graph

[Total: 1    Average: 3/5]

This script creates a table that is a bar graph of the data given to it.

Body Code:

<script>
var stats_array=new Array(23,9,15,22,27,19,23);
var total_count=10002;
var bar_width=30;
document.write('<table cellpadding=0 cellspacing=0><tr><td colspan=9 align=left><font size=1>');
document.write(total_count);
document.write('</font></td></tr><tr valign=Bottom><td>&nbsp;</td>');
for(var i=0;i<stats_array.length;i++)
{
document.write('<td align=center width=');
document.write(bar_width);
document.write('><img src="http://www.js-examples.com/js/ltgreen.gif" height=');
document.write(stats_array[i]);
document.write(' width=');
document.write(bar_width);
document.write(' border=0 hspace=0></td>');
}
document.write('<td>&nbsp;</td></tr></table>');
</script>

Times Viewed: 9

Leave a Reply

Your email address will not be published. Required fields are marked *