added a legend to bar chart