solve d3.js styling issue and dialog clean up and chart legend