-
-
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
Handling critical Y values with autoScaleMinMaxEnabled #2053
Comments
Your code sample seems fine, the chart will recalculate and trigger a new draw(), but I am not sure what you mean
You have to debug a little to see when you translate and add new entries, what happened to your yAxisMinimum/maximum In if _autoScaleMinMaxEnabled
{
autoScale()
} in internal func autoScale()
{
guard let data = _data
else { return }
data.calcMinMaxY(fromX: self.lowestVisibleX, toX: self.highestVisibleX)
_xAxis.calculate(min: data.xMin, max: data.xMax)
// calculate axis range (min / max) according to provided data
_leftAxis.calculate(min: data.getYMin(axis: .left), max: data.getYMax(axis: .left))
_rightAxis.calculate(min: data.getYMin(axis: .right), max: data.getYMax(axis: .right))
calculateOffsets()
} I don't see obvious reason why it draw beyond, though it's another calculation, but the values should be the same when you trigger |
@liuxuan30, thanks for your reply. I'll try to find anything weird, and give you an answer as soon as possible. |
This also happens in my app ,do you have a solution?@Fahrenheit-sp |
@cartmanguo actually no, I still have this issue |
+1 - have this issue in my app And as we can see with autoscaleminmax top space is not calculated properly - http://take.ms/OAw5P |
@Fahrenheit-sp Can you check if #2177 fix your issue? |
@liuxuan30, have not much time right now. Will check in a couple of days and reply. Thank you for your participation. |
@liuxuan30 , I've checked the latest Master code and issue still exist for iOS version. |
@JokerMZD so issue is different |
Is it needed to call notifyDataSetChanged |
@liuxuan30 sorry for the late reply. Actually, no. It doesn't fix the problem. seems like handling min/max manually is the only option atm. |
@aelam it depends when you add it. If you chart is displayed, and you manually do that, you should |
@lixuan maybe try my PR to see if can solve this ? I believe some import entries which are the maxY or minY are ignored |
Debug the method calculateMinMaxY(fromX, toX) |
@aelam I've checked your pull request - it fixes my issue. Thanks. |
@aelam yes, that fixes it. Thank you a lot! |
@danielgindi I am not sure if #2229 will potentially impact other components though it fix some.. |
@xuan check out the android code. I believe it's an iOS version bug
…Sent from my iPhone
On 14 Mar 2017, at 10:03 AM, Xuan ***@***.***> wrote:
@danielgindi I am not sure if #2229 will potentially impact other components though it fix some..
―
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
yeah, what I am concerned is this could be a big change if any other code relies on it |
Just need to confirm if the indexTo needs to be included. Then it's clear |
I think this got fixed, So close it ? |
Hi. I have a LineChartView with autoScaleMinMaxEnabled option enabled. I retrieve some data from internet and dynamically add entries to my chartView, based on the data retrieved.
Here is some sample code:
everything works just well, but if receivedEntry.y is higher than my current yAxisMaximum, or lower than minimum, the new value gets drawn beyond the bounds (it means that some part of chart goes beyond the top of chartView, or beyond the bottom, depending on receivedEntry.y value), and gets autoscaled only if I translate or scale it manually.
I tried to set axisMaximum/axisMinimum manually, and then reset it by calling resetAxisMinMax, when I start scaling/translating chartView
(this gets called right before chartView.notifyDataSetChanged() from previous code sample). This solution works almost perfect, but when I translate chart to the current position, and critical value arrives, chart goes beyond the bounds anyway.
If any additional information or logs needed, please let me know. Thanks for any help and thanks again for such awesome library.
The text was updated successfully, but these errors were encountered: