Fix bar chart javascript functionality