bar: avoid line between stacked bars
See original GitHub issueBecause 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 🤔
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That would be super tough to figure out
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.I’d assume the opposite,
crispEdges
disables antialiasing, and the extra blending it entails, so should be faster than leaving it off.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)…
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.