refactoring timelinechart.js (change global var)