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

autoScaleMinMaxEnabled, axisMaximum and axisMinimum #2651

Closed
Harmonium opened this issue Jul 28, 2017 · 2 comments
Closed

autoScaleMinMaxEnabled, axisMaximum and axisMinimum #2651

Harmonium opened this issue Jul 28, 2017 · 2 comments

Comments

@Harmonium
Copy link

I would like to know if it is a normal behaviour...

I set autoScaleMinMaxEnabled to true. If I set an axisMinimum and axisMaximum value, the autoScale is not working anymore.

I set an axisMinimum and axisMaximum in order to have a buffer. I don't want my graphic to touch the top of my chart. So I add a 5% to the maximum value just to have a little space between the top of my chart and the chart.

I tried to set the spaceTop but I don't have the expected behaviour.

Thanks for your help!

@liuxuan30
Copy link
Member

I think yes, autoScaleMinMaxEnabled will recalculate:

    /// Performs auto scaling of the axis by recalculating the minimum and maximum y-values based on the entries currently in view.
    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
        
        if _leftAxis.isEnabled
        {
            _leftAxis.calculate(min: data.getYMin(axis: .left), max: data.getYMax(axis: .left))
        }
        
        if _rightAxis.isEnabled
        {
            _rightAxis.calculate(min: data.getYMin(axis: .right), max: data.getYMax(axis: .right))
        }
        
        calculateOffsets()
    }

@liuxuan30
Copy link
Member

since you have the code, I suggest modify or override so to get you desired behaviours

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