CSS Bar Chart Script

CSS Bar Chart Script

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
192 views

The above bar charts do not reflect the usage on this site, which suprisingly is visited more by Gecko based browsers than IE6.

These charts are nothing more than a styled definition list with just classes defining each line.

The second chart has been added to rectify the problem that can happen in the first chart when values get closer to 100% (thanks to Chris Hunt for pointing this out).
Cascading Style Sheet – chart #1

dl {
  margin:0;
  padding:0 0 15px 0;
  width:401px;
  height:auto;
  background:#fff url(bar.gif) bottom left no-repeat;
  }

dt {
  text-align:center;
  font-size:1.5em;
  border-bottom:3px solid #fff;
  }

dd {
  margin:0;
  display:block;
  width:400px;
  height:2em;
  background:#0a0;
  border-bottom:1px solid #fff;
  }

dd b {
  float:right;
  display:block;
  margin-left:auto;
  background:#cec;
  height:2em;
  line-height:2em;
  text-align:right;
  } 

dd.p670 b {width:33%;}
dd.p67 b {width:93.3%;}
dd.p12 b {width:98.8%;}
dd.p197 b {width:80.3%;}
dd.p26 b {width:97.3%;}
dd.p08 b {width:99.2%;}

Cascading Style Sheet – chart #2

#mk2 {
  margin:20px 0 0 0;
  padding:0;
  width:401px;
  height:auto;
  background:#fc6 url(grid.gif) repeat-y left bottom;
  position:relative;
  }
#mk2 dt {
  background:#fff;
  text-align:center;
  font-size:1.5em;
  padding:2px 0;
  }
#mk2 dd {
  margin:0;
  display:block;
  width:100%;
  height:20px;
  background:#f80;
  border-bottom:1px solid #000;
  border-top:1px solid #fff;
  }
* html #mk2 dd {
  height:21px; he\ight:20px;
  }
#mk2 dd b {
  position:absolute;
  text-align:left;
  right:-111px;
  display:block;
  background:#fff;
  padding-right:2px;
  height:2em;
  line-height:2em;
  width:100px;
  }
#mk2 dd.p670 {width:67%;}
#mk2 dd.p67 {width:6.7%;}
#mk2 dd.p14 {width:1.4%;}
#mk2 dd.p197 {width:19.7%;}
#mk2 dd.p26 {width:2.6%;}
#mk2 dd.p11 {width:1.1%;}

xhtml

<dl>
<dt>Browser usage (%) - July 2005</dt>
<dd class="p670"><b>IE.6 = 67% </b></dd>
<dd class="p67"><b>IE.5 = 6.7% </b></dd>
<dd class="p12"><b>Opera = 1.2% </b></dd>
<dd class="p197"><b>Firefox = 19.7% </b></dd>
<dd class="p26"><b>Mozilla = 2.6% </b></dd>
<dd class="p08"><b>NN7 = 0.8% </b></dd>
</dl>

Demo: http://www.cssplay.co.uk/menu/barchart.html

Source: http://www.cssplay.co.uk/menu/barchart.html

http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/stumbleupon_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/delicious_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/blinklist_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/furl_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/technorati_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/magnolia_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/google_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/myspace_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/facebook_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/sphinn_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/mixx_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/twitter_32.png

Related Listings:

  1. Simple Accessible Charts Easy, fast, accessible way to display simple Data and beautify...
  2. Vertical bar graph using php Who wants to use Excel to make a new graph...
  3. Dojox Data Chart Script The latest addition in the Dojo 1.3 release is the...
  4. CSS For Bar Graphs Having a working knowledge of XHTML and CSS when developing...
  5. Sliding Box Script As part of the design of this site, I’m using...

Do you like this post?

Email:     

Tags: , , , , , , , , , , , , , , , , , , , , ,

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment



Web Design & CSS (Templates) - TOP.ORG