plotly / plotly/plotly.js

A trace without data is displayed when a "stacking" defined

Open
#5,952 3 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

The trace trace0 is displayed, although I did not define its data.

Example on codepen - https://codepen.io/x-base/pen/vYZvqZB

code:

var trace = {
  x: [0, 1, 2, 3, 4],
  y: [1, 5, 3, 7, 5],
  mode: "lines+markers", 
  stackgroup: "1",
  fill: "none",
  type: 'scatter'  
}

var trace0 = { ...trace,
  x: [null], // this is recommended workaround https://github.com/plotly/plotly.js/issues/2861#issuecomment-409587725
  y: [null]
};

var trace1 = { ...trace };

Plotly.newPlot('myDiv', [trace0, trace1]);

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 with the CodePen reproduction linked in the issue and compare it with the workaround discussed in issue #2861. Trace why trace0 is rendered despite having no data, then verify that an empty trace is omitted while trace1 still displays correctly.

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.