Added legend and edited main.js and data.js to make it work