-
-
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
Value labels are not always showing in horizontal bar chart #3981
Comments
I don't know why, but the value labels are shown when I change the pod version to 3.2.2. But it only works in the sample project that I've provided here, but not in my own project. Perhaps this info might help you find the issue.. |
Are you sue you are using 3.3? We had #3906 merged in 3.3.0, which is a bug fix to it. But I tested on my side with ChartsDemo, it's fine.
this hasn't been changed for long time. And when you say you get a false, it's really false means it's out of bound. I cannot say it's wrong. if you want to get the text anyway, you should shutdown clipValuesToContentEnabled if clipValuesToContentEnabled
{
context.saveGState()
context.clip(to: _viewPortHandler.contentRect)
renderer.drawValues(context: context)
context.restoreGState()
} |
Yes I'm sure. See the demo project that I've uploaded. Currently, I've solved this problem by adding |
Thank you, This solution worked. |
What did you do?
I'm using a horizontal bar chart to show some data. In my case, I've created an array with key value pairs. I've set the setDrawValues to true so that I can see the value labels next to the bar.
What did you expect to happen?
I expect to see the value labels next to the bars
What happened instead?
Depending on the values I provide, sometimes I can see the labels and other times I can't. For example:
This input shows the value labels (the difference is the value in the first key value pair):
let test: [(key: String, value: Double)] = [(key: "123", value: 10), (key: "456", value: 152), (key: "333", value: 153), (key: "890", value: 20)]
This input does not show the value labels:
let test: [(key: String, value: Double)] = [(key: "123", value: 30), (key: "456", value: 152), (key: "333", value: 153), (key: "890", value: 20)]
The difference is (what I have found till now is) that the array that works I get a false in this if statement within the HorizontalBarChartRenderer and a true in the other case:
if !viewPortHandler.isInBoundsX(rect.origin.x)
{
continue
}
Charts Environment
Charts version/Branch/Commit Number: 3.3.0
Xcode version: 10.2.1 (10E1001)
Swift version: 4.2/5
Platform(s) running Charts: iOS 11.2/12.2
macOS version running Xcode:
Demo Project
https://github.com/melkon90/Charts-ValueLabelsNotAlwaysShowing
Images
The text was updated successfully, but these errors were encountered: