plotly / plotly/plotly.py

View jumps when zooming line graph

Open
#5,107 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P2
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

I am experiencing the same problem described in this issue for Plotly.js.

In my python implementation, the line graph is so configured:

{
    "xaxis": dict(
        gridcolor="rgba(128, 128, 128, 0.2)",
        zerolinecolor="rgba(128, 128, 128, 0.2)",
        showgrid=True,
        type="date",
        tickformatstops=(
            [dict(dtickrange=[None, None], value="%a %d %b %y - %H:%M")]
        ),
    ),
    "yaxis": dict(
        gridcolor="rgba(128, 128, 128, 0.2)",
        zerolinecolor="rgba(128, 128, 128, 0.2)",
        showgrid=True,
    ),
    "spikedistance": -1,
    "xaxis_showspikes": True,
    "yaxis_showspikes": True,
    "xaxis_spikemode": "across",
    "yaxis_spikemode": "across",
    "xaxis_spikecolor": "rgba(255,255,255,0.5)",
    "yaxis_spikecolor": "rgba(255,255,255,0.5)",
    "xaxis_spikethickness": 1,
    "yaxis_spikethickness": 1,
}

The problem seems to surface when the tick text is long enough and when zooming will cause the tick text to end up at a particular distance from the edge of the line graph. I notice it happens more often when the tick text overflows following a zoom and will be subsequently hidden.

The issue won't occur if I do:

tickformatstops=(
   [dict(dtickrange=[None, None], value="%H:%M")]`
),

Because the resulting tick text won't be long enough.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the zoom behavior with the Python configuration and long date tick labels shown in the issue, then compare it with Plotly.js issue 7438. Check whether the jump occurs when overflowing tick text is hidden after zooming. Done means the graph no longer jumps with long tick labels while the shorter %H:%M format remains unaffected.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.