-
-
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: xAxis values are not aligned with bars #2106
Comments
Another trial. Looks close to my expected result, but the first an last bars are shown only half (see also isst #2105). barChart.xAxis.axisMinimum = 0.0
barChart.xAxis.axisMaximum = 10.0
barChart.xAxis.granularity = 1.0
barChart.xAxis.granularityEnabled = true
barChart.xAxis.labelCount = 11
barChart.fitBars = true |
The closest diagram layout compared to Charts 2.x gives me the following code. But how can I move the gridlines between the bars as it is done in Charts 2.x? I tried barChart.xAxis.granularity = 1.0
barChart.xAxis.granularityEnabled = true
barChart.xAxis.labelCount = 11 |
@SvenMuc I'm also facing the same issue with Combined Chart (Bar and Line chart)... First and Last bar width is just half.. if you found the solution please help me out |
For anyone else struggling with this, I found that I couldn't use this combination of granularity and setLabelCount() or labels would be misaligned and/or left & right bars cut off. However, this seems to work for me:
|
Hey Thanks this helped me to get x axis labels centre to the bar but how about last bar getting cut? |
barChart.xAxis.axisMaximum = Double(values.count) |
barChart.xAxis.centerAxisLabelsEnabled = false |
refer charts demo. this has been long.. so should be invalid now. |
chartView.xAxis.axisMinimum = -0.5 //to avoid issue of last bar getting half cut this worked for me |
Can Any One Give me the Whole Code of the Graph Actually I Applied These But Didn't Work |
I migrated my diagrams to Charts 3.0.1. It worked quite smoothly, but I cannot manage to align the bar charts to my xAxis values. The following diagram should show a histogram of values between 0 and 10 (11 bars).
Variant 1
All index values are shown, but not aligned with the bars.
Variant 2 (centerAxisLabelsEnabled)
The index 10 is missing on the xAxis.
Variant 3 (fitBars)
The xAxis starts with -1
**Variant 4 (axisMinimum and axisMaximum)
The bars are not centered any more and the last xAxis value 10 is not shown.
I tried a couple of other combinations but was not able to align the bars with my numbers 0...10 on the xAxis. Someone has any idea?
The text was updated successfully, but these errors were encountered: