76 Pie Chart Freshman Sophamore Seylior Juhier
Develop a class named PieChart that extends Canvas for displaying a pie chart using the following constructor:
PieChart(parent, data, width = 400, height = 300)
Where data is a list, each element in the list is a nested list that consists of a value, a title for the value, and a color for the wedge in the pie chart. For example, for data = [[40, "CS", "red"], [30, "IS", "blue"], [50,
"IT", "yellow"]], the pie chart is as shown in the left part of Figure 12.29.
For data = [[140, "Freshman", "red"], [130, "Sophomore",
"blue"], [150, "Junior", "yellow"], [80, "Senior",
"green"]], the pie chart is as shown in the right part of Figure 12.29. Write a
test program that displays two pie charts, as shown in Figure 12.29.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images