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

xAxis grid line in-between bar rather than center of bar #3713

Closed
chungfk opened this issue Oct 25, 2018 · 1 comment
Closed

xAxis grid line in-between bar rather than center of bar #3713

chungfk opened this issue Oct 25, 2018 · 1 comment

Comments

@chungfk
Copy link

chungfk commented Oct 25, 2018

Hi, trying out the demo for bar chart, I can see that the xAxis grid line are at the centre of the bar.

Is it possible for it to be situated in-between each bar, much like grouped bar chart. Since I'm only using 1 data set, so its not suitable to use grouped bar chart.

screen shot 2018-10-25 at 11 00 08 am

@liuxuan30
Copy link
Member

liuxuan30 commented Nov 1, 2018

but the x value is the center of the bar. But you could override the x axis renderer to shift the grid line.

for multiple bars, the trick is described as follows. You could refer to tweak the x values

    /// Groups all BarDataSet objects this data object holds together by modifying the x-value of their entries.
    /// Previously set x-values of entries will be overwritten. Leaves space between bars and groups as specified by the parameters.
    /// Do not forget to call notifyDataSetChanged() on your BarChart object after calling this method.
    ///
    /// - parameter the starting point on the x-axis where the grouping should begin
    /// - parameter groupSpace: The space between groups of bars in values (not pixels) e.g. 0.8f for bar width 1f
    /// - parameter barSpace: The space between individual bars in values (not pixels) e.g. 0.1f for bar width 1f
    @objc open func groupBars(fromX: Double, groupSpace: Double, barSpace: Double)

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