Skip to content

Fixing BarSeries overlapped - #944

Merged
mcnuttandrew merged 5 commits into
uber:masterfrom
gsas2:fix/barSeriesOverlapped
Oct 26, 2018
Merged

mcnuttandrew merged 5 commits into
uber:masterfrom
gsas2:fix/barSeriesOverlapped

Conversation

@gsas2

@gsas2 gsas2 commented Aug 29, 2018

Copy link
Copy Markdown
Contributor

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

@mcnuttandrew mcnuttandrew left a comment

Copy link
Copy Markdown
Contributor

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?

Comment thread src/plot/series/bar-series-canvas.js Outdated
const y = valuePosAttr === 'y' ? valuePos : linePos;

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

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍

@gsas2

gsas2 commented Aug 29, 2018

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown
Contributor

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

@mcnuttandrew mcnuttandrew left a comment

Copy link
Copy Markdown
Contributor

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

gsas2 commented Aug 31, 2018

Copy link
Copy Markdown
Contributor Author

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

CLAassistant commented Sep 9, 2018 •

Copy link
Copy Markdown

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

gsas2 commented Sep 9, 2018 •

Copy link
Copy Markdown
Contributor Author

@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

gsas2 commented Oct 20, 2018

Copy link
Copy Markdown
Contributor Author

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

@mcnuttandrew

Copy link
Copy Markdown
Contributor

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

@gsas2

gsas2 commented Oct 25, 2018

Copy link
Copy Markdown
Contributor Author

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

@mcnuttandrew

Copy link
Copy Markdown
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants