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

Multiple bar Chart Xvalues Doesn't come centre to the grouped bars... #1707

Closed
jk9958 opened this issue Oct 24, 2016 · 3 comments
Closed

Multiple bar Chart Xvalues Doesn't come centre to the grouped bars... #1707

jk9958 opened this issue Oct 24, 2016 · 3 comments

Comments

@jk9958
Copy link

jk9958 commented Oct 24, 2016

I tried the multiple barchart. There the X values doesn't get under the exact centre of the bars for that x value. Please help.

@liuxuan30
Copy link
Member

try xAxis.centerAxisLabelsEnabled = YES

@jk9958
Copy link
Author

jk9958 commented Oct 27, 2016

Forgive me as I did not explain the issue clearly.
simulator screen shot 27-oct-2016 10 37 11 am

In the above screenshot I have 6 bars (6 companies perfomance) in a group. You can see that the year label on the bottom axis is not at the centre of the group. below is the calculation made.

    let grpSpace = 0.2
    let barSpace = 0.12
    let barWidth = 0.05

    let groupWidth = data.groupWidth(groupSpace: Double(grpSpace), barSpace: Double(barSpace))
    chartView.xAxis.axisMaximum =  Double(startYear) + (groupWidth * Double(12))

//* I have total of 12 groups*

    data.groupBars(fromX: Double(startYear), groupSpace: Double(grpSpace), barSpace: Double(barSpace))

@liuxuan30
Copy link
Member

check out ChartsDemo - multiple bar chart for usage

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