问题
I have ten values in the dataset, numbers 1 - 10 and corresponding values. Some of the values are coming back as zero, so they are not added to the chart, BUT, the legend is still listing 1 - 10. Because there is values missing in the chart, the colour coding is knocked off. ie
Item 1, has a value of zero, its passed over in the chart, the colour in the legend is red, Item 2, has a value of 4, the percentage is calculated, and the chart gives it the colour red which is the colour for item 1 in the legend.
Hope that makes sense.
How can I print the legend just for the values that are displayed in the chart?
--Mark
回答1:
just strip down zero values before creating the chart. in other words, create the chart only with valid values.
来源:https://stackoverflow.com/questions/2473021/pchart-pie-chart-legend-and-graph-not-correlating