plotly / plotly/plotly.js

zoom broken with multiple traces with different zorder

Open
#7,320 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
JavaScript
Stars
18.3k
Forks
2k
Avg merge
2d 12h
Merged PRs (30d)
28

Description

When I set different zorder to two traces in the same axes. After zooming and reseting axes, zoom no longer works as expected.
Steps to reproduce:

  • Open this example
  • Zoom between x=3 and x=4 => works as expected
  • Reset axes
  • Zoom between x=1 and x=2 => zoomed region is not between 1 and 2 as expected

Am I using zorder incorrectly or is this a bug?

Example:

JS:

var trace1 = {x0: 1, dx: 1, y: [10, 15, 13, 17], zorder: 0};
var trace2 = {x0: 1, dx: 1, y: [16, 5, 11, 9], zorder: 1};
var data = [trace1, trace2];
Plotly.newPlot('myDiv', data);

HTML:

<head>
	<script src='https://cdn.plot.ly/plotly-2.35.2.min.js'></script>
</head>
<body>
	<div id='myDiv'></div>
</body>

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

Reproduce the issue in the linked CodePen using the two traces passed to Plotly.newPlot, then inspect the zoom and axis-reset behavior. Done means that after resetting the axes, zooming between x=1 and x=2 selects that range even when the traces have different zorder values.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.