-
-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DrawValuesEnabled variable unreachable (Swift 4.2) #3665
Comments
|
To turn off both value and labels you can do the following:
|
Ok thanks, I'll try that instead. |
I don't think it's a bug. Pie chart value labels have both x and y value label: let drawXOutside = drawEntryLabels && xValuePosition == .outsideSlice
let drawYOutside = drawValues && yValuePosition == .outsideSlice
let drawXInside = drawEntryLabels && xValuePosition == .insideSlice
let drawYInside = drawValues && yValuePosition == .insideSlice
in the beginning of drawValues loop: if !drawValues && !drawEntryLabels && !dataSet.isDrawIconsEnabled
{
continue
} it's designed to let you can disable x and y entry label respectively. Check out the pie chart demo to toggle x and y values |
What did you do?
I wanted to implement PieCharts into my app without many of the labels associated. I tried many of the available functions but couldn't find any that would turn off the values (not just the value names) on the pie chart itself. Looking into the library, I found that if I set drawValues on line 335 of Source > Charts > Renderers > PieChartRenderer.swift to false (overriding dataSet.isDrawValuesEnabled) it achieves the solution I was looking for.
I imagine there is probably a function call that was meant to achieve this for the user but it appears in Swift 4.2 it isn't reachable anymore. I'm not sure of this fix but I thought I'd bring it to your attention.
What did you expect to happen?
I thought that by turning off drawEntryLabelsEnabled, it would disable both the label and the value from the pie chart.
What happened instead?
The value label remained and there didn't seem to be a function call that would disable them.
Charts Environment
Charts version/Branch/Commit Number:
Xcode version:
Swift version:
Platform(s) running Charts:
macOS version running Xcode:
Demo Project
The text was updated successfully, but these errors were encountered: