Dynamic CSS Bar Graphs
There's been a lot of talk going around lately about CSS bar graphs. Just go to delicious and type in "css graphs" and you'll find hundreds of links to Apples to Oranges post "CSS for Bar Graphs." There's even a rails plugin based on that post.
But what happens when you need a simple, reusable CSS bar graph? A graph where you don't have to determine the width and height for each bar? That's where Javascript comes in.

This script allows you to declare the total width and height for the graph, add items, and then automatically sizes the bars accordingly. That way if you have one page with four bars and another with three, you can use the same exact code and not have to worry about styling the CSS, creating the xHTML elements, and finding out what 77% of 300 is in pixels.
There are ways to do this with PHP and other scripting languages, but Javascript solves the problem where you need a graph with static data and prefer not to mess with a scripting language.
That's great, now tell me how it works
The script is pretty simple. You include the graph.js file (see below) in your header, merge the graph CSS into your own or keep it as a separate file, and give the graph some data.
Once the graph is built, the script creates two unordered lists. The first contains the colored bars and the second contains the legend, each of which can be styled to fit your design.
The script is even versatile enough to write your own custom graph functions.
Okay, but where do I get it and how can I see it?
You can see the complete documentation, along with a working demo, here.
You can also see it live on the National Breast Cancer Foundation website.
- NickC's blog
- Login or register to post comments
An Abercrombie And Fitch
An Abercrombie And Fitch employee in northern California is alleging she was fired for refusing to remove her hijab, or headscarf marking her Muslim observance. Abercrombie pursuit of a homogeneous army of "perfect" employees appears to have snared it again!
Abercrombie Clothing to the AP, "the Council on Abercrombie UK Relations said Wednesday it filed an Equal Abercrombie London Opportunity Commission complaint on behalf of Hani Khan." Abercrombie Fitch says she was told she would be allowed to wear a Abercrombie Outlet, but a visiting district manager disputed that. She says she was fired when she refused to take it off.
In 2008, an Abercrombie And Fitch accused Abercrombie of refusing to hire her because her head scarf "didn't fit the chain's image." That lawsuit, filed last year, is still in progress.
Abercrombie in the company's serious on-the-ground sensitivity issues: Abercrombie Clothing to let a woman help her autistic sister try on Abercrombie UK, for which they were fined $115,264, and banishing an employee with a prosthetic arm from the store floor. That employee, Riam Dean, was awarded £8,000 for unlawful harassment, although the tribunal ruled that she hadn't suffered disability discrimination.
Abercrombie London has a well-documented mission of selling its idea of youthful physical perfection, Abercrombie Fitch the Bruce Weber ad campaigns to the employees that fit its ideal of American beauty. The company conceded that that ideal didn't include black, Abercrombie Outlet, and Asian employees in 2004 when it paid $40 million to employees and job applicants of those demographics to settle a class-action federal discrimination lawsuit. They had been accused of "engaging in recruiting and hiring practices that exclude minorities and adopting a virtually all-white marketing campaign."
ed hardy ed hardy
ed hardy clothing ed hardy clothing
ed hardy shop ed hardy shop
cheap ed hardy cheap ed hardy
ed hardy uk ed hardy uk
ed hardy sale ed hardy sale
ed hardy clothes ed hardy clothes
ed hardy outlet ed hardy outlet
ed hardy ed hardy
ed hardy clothing ed hardy clothing
ed hardy shop ed hardy shop
cheap ed hardy cheap ed hardy
ed hardy uk ed hardy uk
ed hardy sale ed hardy sale
ed hardy clothes ed hardy clothes
ed hardy outlet ed hardy outlet
I like the dynamic plays. WE
I like the dynamic plays. WE can spot transformation and changes in trend much faster. Thank you. Will have a deeper look. free ads |employment |adjustable beds