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

BarChartView can't show max y value's top label, only show half #1357

Closed
hh-in-zhuzhou opened this issue Aug 25, 2016 · 1 comment
Closed

Comments

@hh-in-zhuzhou
Copy link

I found that function calcMinMax() in BarChartView.swift,the max y axis value is equal to the data's max y value ,so it has not enough space to show whole label, I fixed it:

file: BarChartView.swift

internal override func calcMinMax()
{
guard let data = self.data as? BarChartData
else { return }

    if fitBars
    {
        _xAxis.calculate(
            min: data.xMin - data.barWidth / 2.0,
            max: data.xMax - data.barWidth / 2.0)
    }
    else
    {
        _xAxis.calculate(min: data.xMin, max: data.xMax)
    }

    // calculate axis range (min / max) according to provided data
    _leftAxis.calculate(
        min: data.getYMin(.Left),
        max: data.getYMax(.Left)*1.1)      //  here: multiply 1.1
    _rightAxis.calculate(
        min: data.getYMin(.Right),
        max: data.getYMax(.Right)*1.1)   // here: multiply 1.1 too
}
@danielgindi
Copy link
Collaborator

Please if you have something fix - add screenshots, and issue a PR.

Anyway, I don't see any issue (at least with Charts 3.0 which I've tested). The max-y label draws just fine :-)

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