-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bar: avoid line between stacked bars #4191
Comments
huh, why doesn't that example get I seem to recall some cases where we thought it should be avoided, but I don't remember what those were. Anyway even if there are such cases, your example is not one of them, it should be crisp. |
Very nice! I see that it does the right thing: there: plotly.js/src/traces/bar/style.js Lines 31 to 39 in 832590b
Turns out that in my example the I think this is satisfactory and I'm not sure this qualifies as a bug anymore. I would be OK with closing this issue if you agree of course. |
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 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. |
Correct, this became the default behaviour after #3680 |
Here are a few cases where we don't set Case 1Plotly.newPlot(gd, [{
type: 'bar',
y: [1, 2],
marker: {color: 'blue'}
}, {
type: 'bar',
y: [2, 1],
marker: {color: 'blue'}
}], {
showlegend: false
}) looks like Note that setting both trace to same Case 2Plotly.newPlot(gd, [{
type: 'bar',
x: [0, 0],
y: [1, 2],
}]) just a more minimal example to the one from the codepen in the issue header. Case 3Plotly.newPlot(gd, [{
type: 'bar',
x: [0, 0],
y: [1, 1],
base: [0, 1]
}], {
barmode: 'overlay'
}) Now a few questions:
plotly.js/src/traces/bar/plot.js Lines 196 to 210 in 1dee68b
|
If we end up deciding to only fix the "self-stacking" case, stashing a hidden flag here: plotly.js/src/traces/bar/cross_trace_calc.js Line 632 in 1dee68b
and handling it here plotly.js/src/traces/bar/style.js Lines 35 to 40 in 1dee68b
should suffice. |
That would be super tough to figure out
I might even go the other way: what are the situations when
I'd assume the opposite,
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)... |
Hi - we are currently trying to tidy up Plotly's public repositories to help us focus our efforts on things that will help users most. Since this issue has been sitting for several years, I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our backlog. Thanks for your help - @gvwilson |
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 #4149. Because bars are rectangles, I wonder if we shouldn't set
shape-rendering="crispEdges"
on them 🤔cc @alexcjohnson
The text was updated successfully, but these errors were encountered: