Fixed sorting issues on bar graph