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

Bar on BarChart and CombinedChart doesn't start one Zero line #1729

Closed
jndefosse opened this issue Oct 27, 2016 · 6 comments
Closed

Bar on BarChart and CombinedChart doesn't start one Zero line #1729

jndefosse opened this issue Oct 27, 2016 · 6 comments
Labels

Comments

@jndefosse
Copy link

jndefosse commented Oct 27, 2016

Hello,

I use MPAndroidChart and Charts on my project. With Charts, when a use BarChart or CombinedChart with BarData, i show the ZeroLine with default parameter. When the chart is drawed, bars don't start at zero but before it. See the screenshot.

In MPAndroidChart, bars drawed correctly

Can you tell me how to fix it?

capture d ecran 2016-10-27 a 09 16 34

@gangarharsh
Copy link

Use
barChartView.leftAxis.axisMinimum = 0.0(Your minimum value)

@jndefosse
Copy link
Author

The axisMinimum is setted to 0.0.

The Zero line is drawed at the top of AxisX and not on the AxisX.

Here an example where we see the AxisX and the Zero line. I will expect that there lines were the same line.

graph2

Here a second example where we see the graduation line for 0 with the Zero Line

graph1

Sorry for my English. It's hard to explain the problem

@liuxuan30
Copy link
Member

liuxuan30 commented Oct 31, 2016

@jndefosse I am a bit confused.. what's graduation line? Did you mean turn on leftAxis.drawZeroLineEnabled = YES;?
I looked at ChartsDemo line chart with leftAxis.drawZeroLineEnabled = YES;, it seems what are you saying?
But for you second screenshot, I totally don't understand

@liuxuan30 liuxuan30 added the bug label Oct 31, 2016
@liuxuan30
Copy link
Member

liuxuan30 commented Oct 31, 2016

OK just found the reason:
in drawZeroLine(), it draws one point lower, so the 0 axis line and zero line not overlap

        context.move(to: CGPoint(x: viewPortHandler.contentLeft, y: pos.y - 1.0))
        context.addLine(to: CGPoint(x: viewPortHandler.contentRight, y: pos.y - 1.0))
        context.drawPath(using: CGPathDrawingMode.stroke)

@jndefosse you can delete - 1.0 for you right now. I think it's on purpose to draw in such way.

@danielgindi do you remember why?

@danielgindi
Copy link
Collaborator

Yes, it was for correcting an Android rendering anomaly. On iOS it's not supposed to happen...

@jndefosse
Copy link
Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants