Converts the primary energy chart coffee script to plain javascript