-
-
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
why drawValues has some condition which uses break, some uses continue? #611
Comments
As I guess from the code you post, it check the point from top left to right bottom , scan by col. 1 4 7 if the visible space is 1, 2, 4, 5 the break is used at 7 , the x is not visible , and all after it will not visible too, so break, quit the loop. and the continue is used at 3 and 6, the x is visible , but the y is not visible, so it skip it and jump to the other col. |
Not sure your meaning of |
Well, this allows us to not draw things that are out of the view, and stop drawing when reached an index that is out of the view. Or to explain in another way: We are drawing "from left to right", right? Same goes for every point on the X axis that is outside of the viewport, but on the left side. Because those are points that are not to be drawn, but we are still waiting to reach the x index that we start to draw. So at this stage we are actually searching. And now when we reach the point on the x axis that is out of reach - we |
I get it. It turned out that, I am customizing a new chart type based on horizontal bar chart, and I want to draw the bars from top to bottom, while the default implementation is from bottom to top. What I did is not to reverse the xIndex in data sets, but change the logic inside the rendering. So while zooming, that's why it did not draw anything becaues of break, changing to continue will solve the problem. |
This could be done with a flag that swaps transformers, and then a PR ;-) |
I totally forgot this way.. I will see if I could do it |
I am customizing func drawValues, and I found below code:
it will use break for right, continue for left. Why break here? I checked some other charts, it almost has the same pattern, break for right, top, continue for others. I am not sure if this is deliberated to do so?
The text was updated successfully, but these errors were encountered: