-
-
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
CombinedChart with BarChartData cuts the first and last bars in half #323
Comments
By default it should not be half.. I am not sure how much you changed? The code will leave some space for the first and last bar. I never see it on my side. You might need to provide more info. Have you changed any view port/offset properties or transformer matrix, etc. Is it zoomed or something. You can also try your data with the ChartsDemo code to see if it is reproducible. |
I haven't changed any viewport things I think, nor should it be zoomed. However, we've decided to go with a linebar, which works fine, so I'm closing this issue. Sorry about the trouble. |
Well it never should be half a bar if you just setup the dataSets. If it is a bug (which I doubt), you could help provide some information. |
Are you using combined chart in your project? How about normal bar chart? |
Yes, I was using combined chart. The normal bar chart works fine. |
Ah hah, it's actually a bug. if you don't have bubble data, it will use another value to determine the chartXMin and chartXMax. In CombinedChartView -> override func calcMinMax(): if (self.bubbleData !== nil)
{
for set in self.bubbleData.dataSets as! [BubbleChartDataSet]
{
let xmin = set.xMin
let xmax = set.xMax
if (xmin < chartXMin)
{
_chartXMin = xmin
}
if (xmax > chartXMax)
{
_chartXMax = xmax
}
}
}
else
{
// _chartXMin = 0.0 <--- current in your code
// _chartXMax = Double(_data.xValCount - 1) <--- current in your code
_chartXMin = -0.5 <--- try this
_chartXMax = Double(_data.xVals.count) - 0.5 <--- try this
} You could try to use above change, if you want to use combined chart without bubbles. BTW, current combined chart just supports single bar, not grouped (I have a PR #269 for grouped support, but it's still in alpha testing :-) ) @danielgindi do you know why use 0.0 if no bubble data? |
Yes, that works. Thanks. |
I had the same issue when I upgrade this month. Thanks for the update. Now the issue is gone. |
Fixed thanks to @liuxuan30 :-) |
The fix for it is adjusting the xAxis paddings. This is my code:
|
Still happening on almost 2018. @arorajatin you're a HERO, Sir 😍 |
@arorajatin worked for me :) Thanks <3 |
I have an issue seems related to this: #3186. There are some workaround and root cause I found there. feel free to check it out. I didn't come up with a good solution yet |
This works in case when you don't have labels on x axis. If you have to print labels on x axis they won't be aligned to rounded values, but will start from -0.5 or -0.45 depending on your implementation. |
As this issue is very old, please open a new issue to report any related problems. |
Everything works fine apart from the fact that the first and last bars are cut in half, this might be something that is expected, if so, how can I disable it?
Here's how it looks:
The text was updated successfully, but these errors were encountered: