Refactoring javascript for chart rendering and adding support for multiple sensors on one chart