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

Overlapping bar chart #857

Closed
jemcelroy opened this issue Mar 17, 2016 · 10 comments
Closed

Overlapping bar chart #857

jemcelroy opened this issue Mar 17, 2016 · 10 comments

Comments

@jemcelroy
Copy link

Is it possible to create an overlapping bar chart? I took a look at the demo, but didn't see that as an option. Can the grouped bar chart be altered currently to overlap?

@liuxuan30
Copy link
Member

take a look at how barSpace and groupSpace impact the bar rect. You may find a way to modify the barRect.Not sure if you use a negative value for barSpace and groupSpace, how much work you need.

@danielgindi
Copy link
Collaborator

If by "overlapping" you mean something like this:
image 49

Or this:
overlapbar

Then I guess it would be pretty easy to implement. Something in the area of barSpace etc- to allow playing with offsets too - on a dataset basis.
The more complicated thing could be to deal with grouped bars, but I'm not convinced that they will actually be offended by this change...

@liuxuan30
Copy link
Member

it seems a nice feature though :)

@jemcelroy
Copy link
Author

@danielgindi The first example is what I was looking for. After experimenting with negative values in the bar spacing (and managing to get something like the second example) I ended up throwing together a subclass of BarChartRenderer to change bar widths and positions to get something like the first example. I'd still love to see this as a built-in option, though.

@danielgindi
Copy link
Collaborator

Implemented in Charts 3.0 (v3 branch), you can now set the barWidth as a percentage. :-)

@jemcelroy
Copy link
Author

@danielgindi can you help me out with how setting barWidth can provide the effect in the first example you posted in March? It looks like barWidth is only a property of BarChartData, when I want to set the relative width of a BarChartDataSet.

@liuxuan30
Copy link
Member

@jemcelroy can you look at open func groupBars(fromX: Double, groupSpace: Double, barSpace: Double) to see if it can achieve by changing barSpace, groupSpace etc?
I'm curious as well, but barWidth is on BarChartData like you said.

@jemcelroy
Copy link
Author

@liuxuan30 I have only been able to achieve something like the second example using the groupBars function. It seems impossible to achieve something like in the first example without being able to set the width of a BarChartDataSet.

@liuxuan30
Copy link
Member

OK, it seems like it's not supported? need @danielgindi confirm

@jemcelroy
Copy link
Author

jemcelroy commented Oct 19, 2022

Still would love to see this as a feature so I don't need to hack around to maintain our overlapping bar chart! Unsure as to why this was closed.

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

3 participants