◐ Shell
clean mode source ↗

Property `zerolinelayer` for cartesian axes by my-tien · Pull Request #7269 · plotly/plotly.js

{
    "data": [
        {
            "type": "bar",
            "x": [-1, 0, 2, 3],
            "y": [-1, 2, -3, 4],
            "name": "xy",
            "zorder": 2
        },
        {
            "line": {
                "width": 10
            },
            "mode": "lines",
            "x": [-1, 0, 2, 3],
            "y": [-3, 1, -1, 2],
            "xaxis": "x2",
            "yaxis": "y2",
            "name": "x2y2"
        }
    ],
    "layout": {
        "title": {
            "text": "Zerolines should be above traces<br>but they are rendered below"
        },
        "width": 600,
        "height": 400,
        "xaxis": {
            "showline": true,
            "zeroline": true,
            "zerolinewidth": 5,
            "zerolinecolor": "pink",
            "zerolinelayer": "above traces"
        },
        "xaxis2": {
            "showline": true,
            "overlaying": "x",
            "zeroline": true,
            "zerolinewidth": 5,
            "zerolinecolor": "pink",
            "zerolinelayer": "above traces",
            "side": "top"
        },
        "yaxis": {
            "showline": true,
            "zeroline": true,
            "zerolinewidth": 5,
            "zerolinecolor": "black",
            "zerolinelayer": "above traces",
            "range": [-1, 4]
        },
        "yaxis2": {
            "showline": true,
            "zeroline": true,
            "zerolinewidth": 5,
            "zerolinecolor": "black",
            "zerolinelayer": "above traces",
            "range": [-3, 2],
            "overlaying": "y",
            "side": "right"
        }
    }
}