Convert layers to JS and fix chart source