start totals for line charts. refactor threshold generation to move it out of preplot function.