working version for bargraph