refactoring

Refactored in the same style as pieChart. 
But something wrong with tooltips.