Further refactoring of the chart functions; click to reset the y-max on line chart.