-
-
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
AutoScaling yAxis during panning / zooming #95
Conversation
Cool! I'll look into it |
Yes, I've noticed some inconsistencies during committing the files. I hope I kept all the formatting identical to the coding style of the library here on GitHub. |
Nice :) I've managed to fix the re-drawing cycle issue on the candle chart be making the following changes: CandleChartDataSet.swift (line 74) change BarLineChartViewBase.swift - call calcMinMax() only upon index change
_rightAxis.axisMinimum = !isnan(_rightAxis.customAxisMin) ? _rightAxis.customAxisMin : (minRight - bottomSpaceRight); when _rightAxis.axisMinimum value jumps "sporadically" between 0.15f and -0.01f Because I'm using only the right axis and my y values are always > 0 I've added the following to calcMinMax (line 311) if (_rightAxis.axisMinimum < 0) { And fixed the re-drawing cycle issue for my data set |
Let me try that @dorsoft . If that does the the issue for the demo data set as well (I haven't had this issue on a CandleStickChart using our DataSets either), I'll merge your changes into my fork and create a new pull request. |
I still haven't managed to debug and find the source for the render loop, On Tue, May 26, 2015 at 2:21 PM, AlBirdie [email protected] wrote:
|
I believe that the root cause for the render loop issue is an axisMinimum miscalculation in BarLineChartViewBase, calcMinMax(), line 309 (@AlBirdie pull request) |
Yes, seems like that did the trick. |
I'm testing it at this moment, and it doesn't compile because you forgot the bubble charts... |
Whoops, sorry, totally forgot about those. |
Well @dorsoft it doesn't seem to be the root cause, as @AlBirdie did not actually touch anything around line 309. Line 309 derives from Something there seems weird to me - they are initialized with values that are not calculated yet (ymin/ymax of dataset[0], not calculated yet) and then iterating over all datasets. It should actually initialize with FLT_MIN/FLT_MAX. I'm trying this, along with your fixes |
This adds the auto scaling we've talked about in #89 . There is an issue that I haven't been able to solve yet, though. Sometimes during panning, the chart is kind of stuck in a re-drawing cycle which. I've got no idea why this is happening, but maybe you've got an idea, so please don't merge this as it is.
With autoscaling enabled, the drawRect method runs about 10% slower for the datasets of the ChartsDemo application. In our finance chart with 250 candles, this slow down isn't noticeable on an actual device.