ARAVINDA VISHWANATHAPURA

Sorted Bar charts using AngularJS

Mar 5, 2013
1 minute read.
javascript angularjs angular

Creating bar charts/progress bars using HTML and CSS is very easy, we can create it using two DIV tags. Following image shows outer div in gray color and inner div in green color. Width of inner div can be set dynamically based on the required value.

42%
<style>
.outer{width:100%; background-color:#ddd; height:5px;}
.inner{width:42%; background-color:green; height:5px;}
.chart-label{color:#555; font-size:12px;}
</style>
<span class="chart-label">42%</span>
<div class="outer">
    <div class="inner"></div>
</div>

Today I tried to create sorted bar charts using Angular JS. Following chart shows number of blog posts I wrote each year. We can change the sort order by clicking the yellow buttons. The demo code is available here.

The idea is to write a blog post every Tuesday and celebrate as #blogTuesday. The chart shows how far I succeeded. :)

About Aravinda Vishwanathapura

Co-Founder & CTO at Kadalu Technologies, Creator of Sanka, Creator of Chitra, GlusterFS core team member, Maintainer of Kadalu Storage
Contact: Linkedin | Twitter | Facebook | Github | mail@aravindavk.in