plotly / plotly/plotly.js

Plot does not appear in some cases if rangebreaks overlap

Open
#7,270 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I've created a Codepen for the issue: https://codepen.io/mofojed/pen/ZEgPJPN
In this case, the data spans a week, and range breaks are specified for a full holiday on Thursday, Nov 23, 2023 (Thanksgiving), and a half day on Friday, Nov 24, 2023. These specifications overlaps with other patterns for business days.
The chart does not appear. It looks like the rangebreaks that Plotly.js locates for the plot is:
Image
Where some of those overlap. It looks like that isn't taken into account when calculating the breaks length, so when there's overlap it will not generate a valid break length: https://github.com/plotly/plotly.js/blob/29ca37b4ba3ee28a3ffe3d48eab97a080d602af3/src/plots/cartesian/autorange.js#L199
I think it would make sense to check for overlapping here. I'll see if it's possible to adjust holidays to not overlap with any existing business periods as well...

#5783 is similar

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 linked CodePen reproduction and inspect the rangebreak handling around line 199 of src/plots/cartesian/autorange.js. Compare the behavior with similar issue #5783, then verify that charts render when holiday and business-day rangebreaks overlap without producing an invalid break length.

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
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.