CPTPieChart pie with one element

21 views
Skip to first unread message

Stephen Korow

unread,
Jan 2, 2019, 6:04:42 AM1/2/19
to coreplot-discuss
When I create a CPTPieChart and it has only one element, the color of the pie slice, in this case the entire circle, does not display.  This is also true of the example code.  Is there a way around this?  

Thanks. 

Stephen 

Stephen Korow

unread,
Jan 2, 2019, 9:53:59 AM1/2/19
to coreplot-discuss
For the demo app, the SimplePieChart class, if I don't use a gradient it fills.  If I user the CPTGradient for the overlayFill property, I get the background; not the fill color.  I tried switching the gradientType to a Axial, as suggested in a previous thread.  The fill color still didn't display.  

Eric

unread,
Jan 2, 2019, 8:18:03 PM1/2/19
to coreplot-discuss
Try a non-zero data value for the single data value. That works for me in the SimplePieChart on the release-2.3 branch.

It doesn't make sense to plot a pie chart with a net total value of zero. The width of each slice is the fraction of the total value. When the total is zero, you get a divide-by-zero and an undefined slice width. That's why no slices are drawn in that case.

Eric

Stephen Korow

unread,
Jan 2, 2019, 10:24:15 PM1/2/19
to coreplot-discuss
Thanks for the response.  However, I am not using a zero value data element.  Using the SimplePieChart class as an example, the generateData class creates a three element array 

     self.plotData = @[@20.0, @30.0, @60.0];

I changed it to a single element array:

     self.plotData = @[ @60.0];


This change will recreate the problem.

Stephen Korow

unread,
Jan 2, 2019, 10:33:05 PM1/2/19
to coreplot-discuss
make that "generateData method", not "generateData class". 

Stephen Korow

unread,
Jan 2, 2019, 10:35:56 PM1/2/19
to coreplot-discuss
I was using release 2.2.  I tested on the 2.3 branch and it is working as expected.  Problem solved.  Thank you. 
Reply all
Reply to author
Forward
0 new messages