plotly / plotly/react-plotly.js

Issue with axis autorange: state self-mutates 'reversed' -> true

Open
#155 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
138
Avg merge
3d 2h
Merged PRs (30d)
4

Description

As far as I understand, Plotly's axis reversal works by setting autorange to a string value of 'reversed' (with the other options being true for non-reversed autorange, and false for no autorange). After setting this, Plotly will autoscale the axis with range[0] and range[1] of the axis swapped.

The problem is, it seems like after setting autorange -> 'reversed', react-plotly mutates autorange back to true after doing the range reversal. So, there is no way to un-reverse the autorange without setting it first to false, then true.

What I think should happen:
Step 1: autorange true -> 'reversed'
Step 2: autorange 'reversed' -> true //can toggle axis reversal

What actually happens:
Step 1: autorange true -> 'reversed' -> true //last step being done automatically by react-plotly
Step 2: autorange true -> true //doesn't toggle axis reversal b/c no state change

Contributor guide

No contributing guide indexed for this repository

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

Reproduce the two autorange transitions described in the issue, focusing on the React component's handling of Plotly axis state. Done means changing true to 'reversed' preserves that value so a subsequent change back to true toggles reversal without an intermediate false.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.