refactored barChart.js --Ravi