Added conditions to show pie chart.