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

Setting AxisBase.axisMaximum results in an axisRange of zero #1603

Closed
TomSidebottom opened this issue Oct 3, 2016 · 1 comment · Fixed by #1621
Closed

Setting AxisBase.axisMaximum results in an axisRange of zero #1603

TomSidebottom opened this issue Oct 3, 2016 · 1 comment · Fixed by #1621

Comments

@TomSidebottom
Copy link

When I set axisMaximum for the ordinate on a graph to a value, the range of the values plotted on the ordinate appeared was collapsed to zero. The code for AxisBase.axisMaximum is:

open var axisMaximum: Double
{
    get
    {
        return _axisMaximum
    }
    set
    {
        _customAxisMax = true
        _axisMaximum = newValue
        axisRange = abs(_axisMaximum - newValue) // Always results in a range of zero.
    }
}

This results in axisRange is always being set to zero, because newValue has the same value as _axisMaximum. Making the following change fixed the problem:

open var axisMaximum: Double
{
    get
    {
        return _axisMaximum
    }
    set
    {
        _customAxisMax = true
        _axisMaximum = newValue
   axisRange = abs(_axisMaximum - _axisMinimum)
    }
}
liuxuan30 added a commit to liuxuan30/Charts that referenced this issue Oct 8, 2016
@liuxuan30
Copy link
Member

wow, I see it. Will fix it

danielgindi added a commit that referenced this issue Oct 8, 2016
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

Successfully merging a pull request may close this issue.

2 participants