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

missing tick in chart with rangebreaks

Open gvwilson opened this issue 1 year ago • 3 comments

In the following chart, the xaxis tick for 1st of January 2022 is missing. When panning on the xaxis, the tick appears. When I disable rangebreaks, the tick also appears, but it doesn't seem to be related to the fact, that the 1st of January 2022 is a weekend. Other ticks vanish as well when I pan the xaxis to the side.

The plotly json object is attached here: missing_tick.json.txt

image

gvwilson avatar Jul 17 '24 15:07 gvwilson

It looks like regardless of panning the axis, the first major tick is not drawn: if you drag to the right so that the gridline for Q3 21 is shown, then the Q1 22 tick appears but the Q3 21 tick does not. It in turn appears when the Q1 21 tick should appear.

Here's a pared down figure that still shows the issue:

{
  "data": [
    {
      "x": [
        "2021-07-01",
        "2023-03-01"
      ],
      "xperiod": 86400000,
      "xperiodalignment": "end",
      "y": [
        99.1553482179113,
        100.62974563167488
      ],
      "type": "scatter"
    }
  ],
  "layout": {
    "height": 459.17,
    "plot_bgcolor": "rgba(218,218,218,1.0)",
    "template": {
      "layout": {
        "autosize": true,
        "margin": {
          "b": 40,
          "l": 0,
          "r": 0,
          "t": 0
        },
        "xaxis": {
          "gridcolor": "#ffffff",
          "linecolor": "rgb(218, 218, 218)",
          "showgrid": true,
          "showline": true,
          "tickfont": {
            "size": 19
          },
          "ticklabelmode": "period",
          "ticklen": 10,
          "ticks": "inside",
          "tickson": "boundaries",
          "tickwidth": 2
        },
        "yaxis": {
          "gridcolor": "#ffffff",
          "separatethousands": true,
          "showgrid": true,
          "showline": false,
          "side": "right",
          "ticklabelmode": "period",
          "ticklabelposition": "inside top",
          "tickson": "boundaries",
        },
      }
    },
    "xaxis": {
      "dtick": "M6",
      "gridcolor": "rgba(255,255,255,1.0)",
      "hoverformat": "%d.%m.%y",
      "minor": {
        "dtick": "M3",
        "showgrid": false,
        "ticks": "inside"
      },
      "range": [
        "2021-07-02T00:00:00",
        "2023-07-11T23:59:59.999"
      ],
      "rangebreaks": [
        {
          "bounds": [
            "sat",
            "mon"
          ]
        }
      ],
      "tick0": "2021-07",
      "tickangle": 0.0,
      "tickformat": "Q%q %y",
      "ticklabelstep": 1,
      "ticks": "inside",
      "type": "date"
    }
  }
}

gvwilson avatar Jul 17 '24 15:07 gvwilson

can u assign me this issue i would like to solve it

sOnU1002 avatar Oct 02 '24 17:10 sOnU1002

Hi @sOnU1002 - please go ahead and create a PR, and thanks in advance - when you submit it, please include the line:

closes #4674

in the body of the commit comment, which will automatically link it to this issue - that will notify me, at which point I'll assign this to you and find someone at our end to do a review. Thanks again - @gvwilson

gvwilson avatar Oct 03 '24 12:10 gvwilson