Change the stack chart drawing strategy for small gaps #1424
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1424 +/- ##
=========================================
Coverage ? 80.42%
=========================================
Files ? 156
Lines ? 10586
Branches ? 2582
=========================================
Hits ? 8514
Misses ? 1876
Partials ? 196
Continue to review full report at Codecov.
|
brisad
left a comment
There was a problem hiding this comment.
Looks nice, but there was a bit of superfluous code that seems to have sneaked in and should most likely be removed.
The flame graph code should probably have the same changes, as its box-drawing is based on this code. If not addressed here perhaps we should write an issue for that one too?
f3ea735 to
75e64ec
Compare
|
@brisad Could you re-review? After going through this, I ended up changing the behavior to what we discussed on slack with drawing by leaving a slightly transparent pixel gap between concurrent boxes. I broke out the new work into separate commits, but I found reading them all together to still be easier. Unchanged: Addresses your earlier review: This is a bit of an intermediate step, but it was helpful to get to the final solution: This contains the new strategy, and addresses the clean up of the fill style issues. The final updated snapshot: |
brisad
left a comment
There was a problem hiding this comment.
@gregtatum Of course! This looks great! I only have a devicePixelRatio of 1, so I cannot test with anything other than that, but it's real nice that all those small boxes become visible :)
Approved, with just a couple of very minor comments which you perhaps could address.
This PR changes the strategy for drawing the stack chart to draw small boxes freely, but to leave 1 pixel gaps between boxes. If there are many small boxes, it skips them until it finds either the next small box 1 pixel over, or the next box that is larger than 1 pixel. In addition, it provides a small protection against calls to set fillStyle which are slow due to the re-parsing of the CSS color.
5266582 to
58678ac
Compare
This PR changes the strategy for drawing the stack chart to draw small
boxes freely, but to leave 1 pixel gaps between boxes. If there are many
small boxes, it skips them until it finds either the next small box 1
pixel over, or the next box that is larger than 1 pixel.
In addition, it provides a small protection against calls to set
fillStyle which are slow due to the re-parsing of the CSS color.