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

bar width #448

Closed
vigyanhoon opened this issue Oct 6, 2015 · 11 comments
Closed

bar width #448

vigyanhoon opened this issue Oct 6, 2015 · 11 comments

Comments

@vigyanhoon
Copy link

Is there any way we can control space between two dataset bars for graph having large width and only one or two x values? I can change bar width via barspace but not space between bars.

Basically I want to modify bar width only to have smaller width bars than bars with giant width taking entire chart view width.

Following is the graph with two datasets array having only one index each.
screen shot 2015-10-06 at 12 25 02 pm

@vigyanhoon
Copy link
Author

I dont want my graph to look like following hence changing bar width using barSpace property on datasets.

screen shot 2015-10-06 at 12 31 54 pm

Thanks.

@danielgindi
Copy link
Collaborator

From the docs:

space indicator between the bars in percentage of the whole width of one value (0.15 == 15% of bar width)

If the whole space for a bar is 100%, then a barSpace of 0.15 means that 15% of it will be space, and 75% is for the bar.

The sizes are in percentages as there is no absolute size of the bar on the view. It depends of how many bars you try to fit in the viewport.

@niksdgr8
Copy link

niksdgr8 commented Mar 3, 2016

I understand that by setting barspace I get width of bar but how to set space of bar from which it gets barspace?

@liuxuan30
Copy link
Member

@niksdgr8 be more clear, space of bar ? barspace?

@tejas-ardeshna
Copy link

@danielgindi @liuxuan30 Is it possible to fix bar width and bar space will adjust accordingly to number of bars?

@liuxuan30
Copy link
Member

not sure what you mean. But they work fine right now..?

@tejas-ardeshna
Copy link

@liuxuan30 Nop man I just set data.barWidth = 20.0 and now each bar is covering whole graph view. All I want to fix size bar for a different number of bars.

@liuxuan30
Copy link
Member

liuxuan30 commented Dec 20, 2016

You set a big bar width and it is wider for sure..
I am still not clear for "fix size bar for a different number of bars". The more bars you have, the thinner for each bar. You should check the code to see how bar width is used.
If still needed, open a new issue and post screenshot, details etc.

@mushtaque87
Copy link

mushtaque87 commented May 2, 2018

@liuxuan30 I want a fixed bar width ... i dont want dynamic bar width.. Like if i have one bar or 10 bar .. The size should be same not dynamically change .. It looks odd when you have 1 or 2 bars ... the bar looks fat ... where as when you have more then 5 - 6 bar they looks fine .. So for less bar say 1 or 2 bar how to make bar width fixed and also they should not be very far away .. it should be close to each other and also looks fixed sizes ..

Just to explain .. Look at the very first image in the thread .. the bars are thin but very far away .. I want something close to each other ...Can i decrease barchartview area anyhow so they are closer to each other and not huge gaps for 1 or 2 bars

@preetirani
Copy link

@vigyanhoon How did you managed to get fixed bar width via bar space ??

@wooodypan
Copy link

wooodypan commented Sep 21, 2018

@preetirani Do you mean set the bar in fixed width, no matter how many data ? I just found the solution:
the bar width still need calculating according device width

       // the code is in BarChartViewController.m (BarChartViewController.swift)
        _chartView.data = data;
        [_chartView setVisibleXRangeMaximum:10];

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

8 participants