continued code for scrollable  linechart. new algorithms for flywheel
calculations