Updates to sorting and mean calculations

Refactoring to sorting and averaging to fix some bugs in the new front page charts.

I also added a showPoints() function to LineSeries to make the points optional. Longer term, this could take an options argument for how the points should be displayed.
orderFunction is used to define the comparison function used by the Javsacript sort method, I have added a link to the MDN description page that describes the behaviour and requirements of these functions.