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
Bars not rendering or disappearing while and after dragging #2240
Comments
I need you to debug on your side first. It would be easier if you can reproduce it with ChartsDemo |
I was able to create a test case for the issue. Unfortunately I can't figure out, what actually causes it. To run the test case use the target Worth noting: the code of the test case is based upon this pull request for attributed chart labels. The pull request provides the functionality do render the days on the xAxis as you'll see on the screenshots. However, I can't see why this pull request should cause the trouble. |
I did a quick check, the bars that missing all meet the break condition: if (!viewPortHandler.isInBoundsLeft(barRect.origin.x + barRect.size.width))
{
continue
}
if (!viewPortHandler.isInBoundsRight(barRect.origin.x))
{
break
} However, I can't explain what's the cause. The barRect 'seem' calculates right |
Thank you very much for your support; I really appreciate it! Thought again if the pull request may cause the issue. What definitely has changed is the way the axis labels are drawn, maybe that affects the axis item width, which also influences the barRect in the end? How can we narrow down if the issue is because of a) a bug in the pull request b) a bug in the chart library or c) simply wrong usage? |
Last time when I check, I tried replace the library with master, seems still buggy. You can replace and help double check.
For now, I can't say you used it wrongly, it's just like the contentRect and bar rect edge issues. I am sorry I don't have much time to look into the rect edges to figure out what's wrong. But you can try ChartsDemo to do similar things to see if you can reproduce. @danielgindi any idea? |
Any news regarding the pull request or this issue? |
Anything? How may I help to get this fixed? |
@marbetschar I remember last time I use master branch for this bug, and it still happens, so should not relates to your PR. However I don't have time to take a look at the matrix though. I think the key issue here is why it's beyond the condition. I don't see obvious issue while calculating the bar rect. If you have time, you can start looking at the barRect calculation. |
To be more specific: When the bar is missing, the label above it still stays on the right position I suppose, so it's just about the barRect edge issues. You can try remove
And see if the bar is at the right position and right size, so we can decide if it's only about the edge issues. |
@marbetschar I'm having the exact same problem, did u find a way to solve it? |
@jeffalee unfortunately I did not have time to digg into this issue yet |
@marbetschar @jeffalee is this issue related to the viewPortHandler? I am having the same issue with 3.0.2, or prob it seems to be the same issue. Would appreciate help on this.
Only the last 10 data bars is rendered/displayed when I scroll left and right.
If I remove the last 2 lines, the chart is rendered properly. |
@perwyl I have the exact same two lines in my code; so I'd claim you ran into the same issue. @liuxuan30 investigated a bit and found, that this is indeed related to the Unfortunately I do not have any time to digg into this currently. Would be thankful if you give it a try. |
@marbetschar alright. thanks for the confirmation. |
I have the same issue with 3.0.2 in a Another strange behavior is that I cannot select all bars via solved: The issue was that the data entries where in reverse order. Ordering the data entries by increasing x values solved the issue. |
@kscheff what issue did you say resolved? Yours only or @marbetschar as well? |
@liuxuan30 I could not verify @marbetschar his issue. I only saw that I have a similar issue with missing bars, which I could resolve by sorting the values. So I suggest to @marbetschar trying to sort his entries in the data set. |
Thanks, got it |
@kscheff how do you resolve
|
@perwyl this issue disappeared with the sorting as well. |
@kscheff thanks! i actually need to do |
That's great that ordering data makes charts plotting right while zooming. Could sort action be included in the pod by default in "notifyDataSetChanged" method or maybe in the other place? Should I make PR? |
Please make a PR with details like what's the issue and root cause, etc. This has been quite a time and conversations, not sure if they are the same issue with this post. |
I think if we’re going to do this (and I think we should), the only way to add data should be in an ordered fashion. |
sorting or this issue? Sorting used to be taken care of by user I remember. |
as I see it causes the wrong representation of data in the chart - so seems it's not obvious to prepare data sorted (it has x value - so it's defined the necessary and sufficient condition to draw right). So maybe pod should be self-sufficient and not require non-obvious requirements? IMHO |
Though I work only with a bar chart. Maybe some type of charts could be affected. But really I don't understand how it could draw right firstly and have problems with drawing zoomed part of the chart from the logical perspective. |
@liuxuan30 My understanding is that this issue is a result of having the data unsorted. Am I missing something? I'm guessing here, but if data is always sorted, we can likely also make assumptions in the rendering to improve performance. |
Honestly I don't remember. The last time I looked into is I found
one of the two conditions is not met so the bars are not rendering. @marbetschar did not updated since then, so I'm not sure if the root cause of the original issue is related to sorting, like what @kscheff offered. |
Hey, guys! Any news about this issue? Using version 3.3.0 and still the same issue with BarChartView. Any ideas how to fix it in case if it important not to sort yAxis values? |
hey guys, the candlestick chart version of this similar problem was closed to collaborators only despite a clear solution not being decided. thought i'd give it a mention here. people all around the forum have been saying to sort the x values, when they say that do they mean a line of code like ---- self.candleChartValues.sorted(by: { $0.x < $1.x }) ----, or is it an entirely different method or syntax? |
@liuxuan30 unfortunately I do no longer have access to the corresponding code, so I'm not able to debug or provide any further insight on this. |
I've created a bar chart using
BarChartView
. The view displays work hours per day.Unfortunately, some bars are not rendered at all - and others are disappearing while the whole chart is dragged.
Before the chart is shown the first time, it's zoomed to show only 7 bars at a time:
Then the view is animated, so the latest day is shown first:
This leads to the following result - so far, so good:
As soon as I drag the chart to the right, bars begin to disappear - only the value remains visible (notice the bar of Mo. 6th - it's gone):
Also all bars which are further left and therefore not visible immediately (because of the zoom) are not rendered at all. What I' doing wrong?
The text was updated successfully, but these errors were encountered: