-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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 bars do not start at the x-axis. #1225
Comments
for newer release, you have to call axisMinValue = 0, startAtZero is deprecated override func viewDidLoad() {
super.viewDidLoad()
let data = barChartDataSets()
let xVals = Array(0..<numberOfBars).map { "\($0)" }
barChartView.data = BarChartData(xVals: xVals , dataSet: data) <-- revert the order with styleBarChart
styleBarChart(barChartView)
} You have to style the chart and then set chart data, or you have to call notiftyDataSetChanged() after styling |
@liuxuan30 Why did you close this issue? startAtZero is not being used. I have |
@jleach I have updated my first post. Does it solve your issue? |
BTW, I can't compile your project, saying
It's better to have a pure project without any pod/carthage dependency |
@liuxuan30 I tried both your suggestions and it has no effect. I committed the change(s) to the sample project. Do you mean check in the Pods directory or just add Charts directly to the project? |
I just need to know how to compile your project, it's complaining about pod, but I don't know what I have to do
|
alright, I went to your project folder and run pod install and waiting Setting up CocoaPods master repo. |
@jleach pod install stucks like forever |
@liuxuan30 I just checked in the Pods directory; it should not have any more dependencies. Try a |
@jleach man, you forgot // create a data set
let dataSet = BarChartDataSet(yVals: data, label: "")
dataSet.drawValuesEnabled = false
dataSet.colors = barColors
dataSet.axisDependency = .Right // <-- where is it?
return dataSet |
I spend 3x time trying to get your project running, at last I create a new project and copy your code instead and fix the storyboard missing connections. |
That was it. I appreciate your help; I would not have caught this. I assumed that because I did |
I can not get an iOS-charts bar chart to put the bars zero (the bottom of the bars) on the x-axis. They seem to float just above the x-axis. As you can see in the attached image the bars are not sitting flush with the x-axis. One difference in my sample project is, if you look at the screenshot (in the screenshots directory) the y-axis zero label is on the x-axis while in the attached image it floats above the x-axis.
This issue might relate to #947
I've created this StackOverflow issue for public support and to better illustrate the issue
http://stackoverflow.com/questions/38064460/ios-charts-wont-put-the-x-axis-at-zero-on-the-y-axis
And I've created this GitHub project to re-create the issue:
https://github.com/jleach/BarChartBug
The text was updated successfully, but these errors were encountered: