Showing/Hiding individual labels in a PieChart

11 views
Skip to first unread message

Levi Gustin

unread,
Feb 17, 2020, 9:49:52 PM2/17/20
to coreplot-discuss
Hi,

I am trying to find the ability to show and hide individual labels rather than all in a Pie Chart. My problem revolves around when certain wedges are quite small. I would like to hide the labels for the small wedges. However I am only finding
CPTPieChart.showLabels

which is all or nothing and the delegate function
number(for plot: CPTPlot, field fieldEnum: UInt, record idx: UInt) -> Any?

which allows the setting of the value for the wedge size and the corresponding label. 

Is there an ability to show certain labels where I can get the labels as an array? Or the ability to set the value for the wedge size but provide the value for the wedge label separately so I could fill it with an empty string?

Here's an example for reference: 

IMG_0005.PNG

Thank you for any and all help,


~Swift 4.2, Coreplot 2.2




Disclaimer: The information and attachments transmitted by this e-mail are proprietary to Velentium, LLC and the information and attachments may be confidential and legally protected under applicable law and are intended for use only by the individual or entity to whom it was addressed. If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message and attachments is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and delete this message from your system immediately hereafter.

Eric

unread,
Feb 22, 2020, 8:36:59 AM2/22/20
to coreplot-discuss
The superclass, CPTPlot, has datasource methods that will let you hide labels easily.

    func dataLabels(for plot: CPTPlot, recordIndexRange indexRange: NSRange) -> [CPTLayer]?

    func dataLabel(for plot: CPTPlot, record idx: UInt) -> CPTLayer?



Eric

Levi Gustin

unread,
Feb 24, 2020, 3:42:09 PM2/24/20
to coreplot-discuss
Thank you very much. This allowed the flexibility I needed. 
Reply all
Reply to author
Forward
0 new messages