created pie chart and legend