question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bar: avoid line between stacked bars

See original GitHub issue

Because of antialiasing, we produce subpixel artifacts between stacked bars which appear as white lines. This is shown in this Codepen

This has been discussed in this Stack Overflow thread and in https://github.com/plotly/plotly.js/issues/4149. Because bars are rectangles, I wonder if we shouldn’t set shape-rendering="crispEdges" on them 🤔

cc @alexcjohnson

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
alexcjohnsoncommented, Sep 25, 2019

Should we try to turn crispEdges every time two bars touch?

That would be super tough to figure out

Or should we be more selective, and turn on cripsEdges when things look really bad otherwise?

I might even go the other way: what are the situations when crispEdges looks bad and we need to NOT enable it? Frankly the only one that occurs to me is narrow bars/gaps. If bars - OR the gaps between them - are, for example, somewhere between 2 and 3 px wide, crisp will make some of them 2px and others 3px, which looks junky, particularly if there are gaps. Even worse, if the bars or gaps are between 0 and 1 px, they can alternate between visible and completely gone.

How much of a (perf) penalty do we pay by setting crispEdges?

I’d assume the opposite, crispEdges disables antialiasing, and the extra blending it entails, so should be faster than leaving it off.

Should we try to find alternatives to crispEdges similar to we what currently do here:

Note that that solution fails with CSS transforms that scale the bars. Of course all hell breaks loose if you have a CSS rotation (that’s not a multiple of 90 degrees)…

1reaction
alexcjohnsoncommented, Sep 16, 2019

Ah right, single, non-stacked bars with gaps are better with crisp off. But in this case, even though it’s just one trace, there’s still self-stacking. Ideal would be if we can figure out when there is self-stacking like this and have that effectively count as barcount > 1 (line 35 ^^) - I think it’d be worth trying this before closing, esp. since we’ve recently changed our algorithms to create more self-stacking - and we have px encouraging that use case.

Too bad browsers don’t have separate x/y crisp modes, that would really be the ideal. One can sort of do this by precisely rounding the bar edges and disabling crispEdges, but that falls apart if the user zooms their browser.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Complete Guide to Stacked Bar Charts
Stacked bar charts extend the standard bar chart by dividing each bar into multiple subcategories. Learn how to best use this chart type...
Read more >
Is it possible to remove stacked bar border line?
I've created the stacked bar chart below. I would like to remove the white border line between the two colors of the bar....
Read more >
Add or remove series lines, drop lines, high-low lines, or up ...
Remove predefined lines or bars from a chart ... Click the 2-D stacked bar, column, line, pie of pie, bar of pie, area,...
Read more >
Understanding Stacked Bar Charts: The Worst Or The Best?
I'd also say that overlaying a line as in the dual-axis graph implies there is a continuum between the Strategies, which is not...
Read more >
White lines in between different levels of stacked bar chart
White lines in between different levels of stacked bar chart. 1306 views ... saved it to a pdf file and found no white...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found