plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

zorder property changes trace color

Open stephprobst opened this issue 1 year ago • 3 comments

The zorder property changes the color of stacked line traces. The following code pens demonstrate the problem. The only change between the various charts is, that the zorder property has been added to the traces. This should not have any impact on the colouring, but it does.

Stacked line traces (working / without zorder)

image

Stacked line traces (broken / zorder=1 on first trace)

image

Stacked line traces (broken / zorder on all traces)

image

stephprobst avatar Oct 17 '24 15:10 stephprobst

@archmoj: Another problem with the zorder property, tested against the CI output artefacts you provided us with. (https://output.circle-artifacts.com/output/job/07ec9652-70cc-4287-bfb0-c639ea6b2d39/artifacts/0/dist/plotly.min.js)

stephprobst avatar Oct 17 '24 15:10 stephprobst

The traces in the codepens have transparency. @alexcjohnson do you this may be the expected behavior or a bug?

archmoj avatar Oct 17 '24 15:10 archmoj

Yes, this is clearly a bug. All of these traces have y=[1,1,1] so they should each get a height of 1 no matter what else is done.

It seems that setting zorder confuses them about which other traces they're stacked on - each trace gets the right total y values, so they definitely know at that point what's stacked below them, but then when it comes time to draw the fills they go to the wrong place.

alexcjohnson avatar Oct 18 '24 03:10 alexcjohnson

Not meaning to hijack here but maybe this helps fixing the bug for good:

When I set zorder: 2 (or any value for that matter) to a single trace then all of my showline on all of the axes are gone. They reappear only if I set mirror: all but then the opposite side also appears.

Braintelligence avatar Nov 11 '24 11:11 Braintelligence