-
-
Notifications
You must be signed in to change notification settings - Fork 9k
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
Option to set restrictions for Y axis autoscaling. #3642
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely a good addition here! However, this can be done simply by having two bool flags, that when enabled, switches from using the strictly the mAxisMinimum
and mAxisMaximum
, to using the min and max only if the auto scale isn't enough. See my line comments.
/** | ||
* Resets min value restriction for autoscale | ||
*/ | ||
public void resetAutoScaleMinRestriction() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace both resetAutoScaleMinRestriction()
and resetAutoScaleMaxRestriction()
with appropriate setUseAutoScale???Restriction()
and isUseAutoScale???Restriction()
getters and setters.
* restriction value of autoscale min | ||
*/ | ||
|
||
private float mAutoScaleMinRestriction = 0f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove both mAutoScaleMinRestriction
and mAutoScaleMaxRestriction
variables
/** | ||
* Sets min value restriction for autoscale | ||
*/ | ||
public void setAutoScaleMinRestriction(float restrictionValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove these two setters: setAutoScaleMinRestriction()
and setAutoScaleMaxRestriction()
float max = mCustomAxisMax ? mAxisMaximum : dataMax; | ||
if( mCustomAxisMin ) { | ||
min = mAxisMinimum; | ||
} else if( mUseAutoScaleRestrictionMin ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent this, so that the code checks for mUseAutoScale???Restriction
ONLY if mCustomAxisMin
is true, that way it uses the same mAxisMinum
variable, but it two different possible ways.
|
||
if( mCustomAxisMax ) { | ||
max = mAxisMaximum; | ||
} else if( mUseAutoScaleRestrictionMax ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the same with this as above.
Done and tested. |
LGTM |
Update for @pagrzybe, looks like this already existed with the methods I think that the current implementation is good, but if you would like to I encourage you to see if the current version gives you what you wanted. If not, please open another pull request and test your changes by dragging the seekbars on the example app to make sure the ranges aren't drifting. Sorry, and thanks for your patience! |
Option to set restrictions for Y axis autoscaling.
I need to be able to set some restriction on autoscale so I keep autoscale working but also make sure that certain range is always visible.
Tried to do it in the way the rest of the API is done and with as limited changes as possible.