adding bar chart function