Skip to content
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

Line chart: Circle for first value is missing #490

Closed
c-goettert opened this issue Mar 11, 2019 · 3 comments
Closed

Line chart: Circle for first value is missing #490

c-goettert opened this issue Mar 11, 2019 · 3 comments

Comments

@c-goettert
Copy link

c-goettert commented Mar 11, 2019

I recognized that on LineCharts, the first value never has a circle on top of it. This is happening per default, also in the examples. See the following screenshot for reference:

1

I played around with some settings (zooming, scrolling, styling, etc.) but couldn't find any working setup where the first value would also display a circle. In my scenario the first circle is necessary because some datasets might only contain one single value (which won't be visible otherwise).

This issue seems to be related to the wrapper-project, because in the Example-App of MPAndroidChart it's possible to see one single value in Line-Charts and you see a Circle on top of the first value as well:

123

Does anyone know why this happens or has a suggestion to fix this for my case?


Update: On Android the circles draw just fine, this seems to be only an issue with iOS.

@c-goettert
Copy link
Author

Update: This seems to be an issue of Charts library for iOS (see related issue). Hope that this will be fixed in the next release. Closing this issue now.

@c-goettert
Copy link
Author

Update #2: For anyone suffering from the same problem: It's possible to fix this with a quick hack until this is merged. Presuming you have installed the library manually, you can apply the fix in the Native XCode-Project of the Charts library. You need to adjust the file BarLineScatterCandleBubbleRenderer.swift:

         public mutating func next() -> Int? {
-            guard value < bounds.max else { return  nil }
-            value += 1
+            guard value <= bounds.max else { return  nil }
+            defer { value += 1 }
             return value
         }

This fixed it for me.

@mogluszka
Copy link

Thank you so much @c-goettert, your solution saved me a lot of time. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants