add pie chart function and work fine