-
-
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
Bar width #2410
Comments
Hi @zykis: First of All Set your barWidth for the BarChartDataSet:
Then what you can do is make an Outlet for the Width of the Chart Constraint like this: Then you can Set the Width of the Chart According to the Amount of Data you have
Hope this Helps :-) |
Thanks, @hernanarber !
|
The .barWidth Property is not part of the ChartDataSet, but of the BarChartData :-) |
For the constraint Go to the EXPLORER in the Storyboard so you can Ctrl+Drag the Constraint |
@hernanarber oh, man! |
setting the visible range is what you want
|
@aelam Oh, thanks! I'll try that. |
@aelam Can you explain me more about this? I think this is what we need.... Thanks :-) |
That's what source tells us |
can be closed now |
Well, BarChartData.barWidth not helps here. |
You have a full-width entity just because your X-axis width is equal to 1.0. Just a coincidence. |
@zykis
I don't think it's a good solution,
The bar width is a percentage,
What you need to do is handle the visible range of xAxis.
For example,
If xAxis visible range is 0,100, and bar width is 0.8
Then AN entry full pixel width is chartWidth / 100 , and the bar pixel width is chartWidth /100 * barWidth.
I don't think it's good that you change the barWidth dynamically. The dataSet part once is set, then done. Then take care of the view. The view handles how wide a full bar width is. To approach that, set an appropriate visibleRange.
发自我的 iPhone
… 在 2017年5月6日,上午6:36,zykis ***@***.***> 写道:
You have a full-width entity just because your X-axis width is equal to 1.0. Just a coincidence.
The thing is ChartBarData.barWidth is POINT-BASED value, where X-axis width = [dataSet xMax] - [dataSet xMin]. You can test it out by setting entities values with e1(x=0, y=1) and e2(x=1000,y=0.7) and barWidth = 1;
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I think you have got two issues,
One is get the bar wider,
One is get bar narrow .
If you you want the bar narrow. You can try set the barWidth = 0 , and borderwidth = 3
发自我的 iPhone
… 在 2017年5月4日,上午4:34,zykis ***@***.***> 写道:
Any way i can prevent bar width to be wider?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I Tried Setting the Visible Range: But as a Result the BarWidth is Changing depending on the amount of bars, What I Wanted was a CONSTANT Bar Width regardless of how much data was on the Chart :-( |
@aelam
CGRect is sizing elements in points, not in percentages. So it's just a misleading. But since renderer calculating left and right as mentioned above, now i have first and last bars cutted half: |
I ran into the exact same issue with first/last bar cutted in half and barWidth problems (I also have timeIntervalSince1970 as xValues.) Eventually got what my desired effect by storing # of days since the first bar as xValues; and use my custom formatter to translate xValue back to a String. Hope this helps. |
@zykis set the xAxisMin to -0.5 if you current minXValue is 0, then it wouldn't be cut, same as maxValue |
@zykis maybe you can try to keep every POINT in same pixels each time, then you can have a constant result that's what I meant |
@billylo1 That's a nice point. I need to cut off some decades from my start value for sure :D
|
Any way i can force bar width to be wider?
Yet, dataset with 1 entity works pretty well:
The text was updated successfully, but these errors were encountered: