add selection chart
js refactoring