Fix bugs in the chart tooltip regarding averages