Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fixing BarSeries overlapped #944

Merged
merged 5 commits into from
Oct 26, 2018
Merged

Conversation

gsas2
Copy link
Contributor

@gsas2 gsas2 commented Aug 29, 2018

This PR adjusts the calculation of bar width and starting position, to avoid bars "of same type" getting overlapped.

Reference: #936

Before

image

After

image

Copy link
Contributor

@mcnuttandrew mcnuttandrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like what you have going here, but the algebra of these statements is really hard to read. Can you include some notes explaining why these changes are necessary in the code?

const valuePos = Math.min(value0(row), value(row));
const x = valuePosAttr === 'x' ? valuePos : linePos;
const y = valuePosAttr === 'y' ? valuePos : linePos;

const lineSize = itemSize * 2 / sameTypeTotal;
const lineSize = ((itemSize * 2 / sameTypeTotal) - (1 - (1 / sameTypeTotal)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe clearer as (itemSize * 2 - (sameTypeTotal - 1)) / sameTypeTotal ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@gsas2
Copy link
Contributor Author

gsas2 commented Aug 29, 2018

@mcnuttandrew Sure, I'll add some comments. I think it would also help to add some variables for intermediate values (with appropriate descriptive names). Do you think that would be ok?

@mcnuttandrew
Copy link
Contributor

@gsas2 that sounds like a great idea, value ease of reading here!

Copy link
Contributor

@mcnuttandrew mcnuttandrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow that's a lot of text! Sorry to give you the run around here, but would you mind reducing each of those comments to around 2-4 lines? Readability and brevity are closely related. I think your variable names do more work than you are expected of them at the moment

@gsas2
Copy link
Contributor Author

gsas2 commented Aug 31, 2018

Sure. Sorry I didn't know where to stop 😳
I'll move the long explanation here (just for reference), and leave just the necessary comments on the code.

@CLAassistant
Copy link

CLAassistant commented Sep 9, 2018

CLA assistant check
All committers have signed the CLA.

@gsas2 gsas2 force-pushed the fix/barSeriesOverlapped branch from 996a5da to 0498293 Compare September 9, 2018 20:51
@gsas2
Copy link
Contributor Author

gsas2 commented Sep 9, 2018

@mcnuttandrew
Not sure why this is happening but I noticed that with this change, on clustered examples, a little line is visible between the bars:
image

I'd been trying to fix it by reducing the space (instead of adding 1 pixel, using some smaller values like 0.90), but while that might fix this new issue, it makes the original overlapping to appear back (but with less overlapping).

@gsas2
Copy link
Contributor Author

gsas2 commented Oct 20, 2018

Hi @mcnuttandrew, do you have any comments/thoughts around this?

@mcnuttandrew
Copy link
Contributor

This seems fine? If you'll clean up the merge conflict i'll merge

@gsas2
Copy link
Contributor Author

gsas2 commented Oct 25, 2018

@mcnuttandrew Merge conflicts solved. Please, let me know if anything else is missing. Thanks!

@mcnuttandrew
Copy link
Contributor

@gsas2 sorry about the delay i've been traveling. Thanks again for addressing this!

@mcnuttandrew mcnuttandrew merged commit 86784af into uber:master Oct 26, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants