functions to generate js file for time series graph