Skip to content
Bug reportNov 22, 2026· 0:24· 17 views

Plotly.js: `fill:'tonexty'` renders across data gaps when `connectgaps:false`

0:24 total

Comments · 0

Be the first to comment.

Bug reportby SceneRecap AI

mediumScatter trace fill path generation for fill:'tonexty' (src/traces/scatter/plot.js, the tonext fill polygon construction). It does not split the fill into separate segments at gaps when connectgaps:false.
os: macOSdpr: 1locale: en-USbrowser: Chromium 151.0.7922.34library: plotly-2.35.2.min.js (cdn.plot.ly)timezone: Europe/Berlinviewport: 1280x720page_title: Plotly.js #2736 — fill:tonexty + connectgaps:false

Repro steps

  1. 1.Load a page that includes plotly-2.35.2.min.js from cdn.plot.ly.
  2. 2.Plot two scatter traces, 'upper bound' and 'lower bound', with points at x=1,2,3 and x=5,6,7 and a null value at x=4 in both traces.
  3. 3.Set fill:'tonexty' on the upper bound trace and connectgaps:false.
  4. 4.Observe the shaded fill in the region between x=3 and x=5.

Expected

With connectgaps:false, the fill should render as 2 separate bands. One band covers x=1..3 and one covers x=5..7. Nothing should be shaded in the null gap at x=4.

Actual

The fill renders as one polygon that bridges the null gap. A diagonal shaded band crosses the x=4 region from x=3 to x=5. Near x=1..3 the fill forms odd triangular slivers, for example between y=2 and y=2.5, instead of a clean band between the two traces.

Evidence

visualThe chart renders with the blue fill spanning the gap between x=3 and x=5 as one diagonal band. No data points exist at x=4.
visualNear x=1..3 the fill shows triangular slivers that do not follow the area between the upper and lower traces.
consoleWarning: 'Bug confirmed, fill drawn as single polygon across gap. Sub-paths in fill: [2] (expected ≥2 separate bands)'. The path d starts M52.22,126.67L194.32,158.33L336.41,95L620.59,158.33... It jumps from x=336.41 (x=3) to x=620.59 (x=5) with no move command, so the path is one continuous sub-path. Note: the reported sub-path count of [2] conflicts with the 'bug confirmed' text.
consoleUnrelated warning: plotly-2.35.2.min.js from cdn.plot.ly is loaded via a parser-blocking cross-site document.write.
visualA red dashed box labeled 'gap: null in both traces' highlights the x=4 region. The blue fill is visibly drawn inside the box.
visualThe caption reads 'EXPECTED: 2 separate fill bands, one for x=1..3, one for x=5..7 (connectgaps:false)' and 'ACTUAL: 1 polygon, fill bridges the null gap, drawing a spike into the empty region'.
visualThe state is unchanged through the end of the recording. The fill is still drawn across the gap.
Issue markdown (copy-paste ready)
## Summary
In Plotly.js 2.35.2, `fill:'tonexty'` with `connectgaps:false` draws a single fill polygon across a null data gap. It should draw separate bands on each side of the gap.

## Environment
- Browser: Chromium 151.0.7922.34
- OS: macOS
- Viewport: 1280x720, DPR 1
- Plotly.js: plotly-2.35.2.min.js (cdn.plot.ly)

## Steps to reproduce
1. Load plotly-2.35.2.min.js (0s).
2. Plot two traces, `upper bound` and `lower bound`, with points at x=1,2,3 and x=5,6,7 and `null` at x=4 in both traces (1s).
3. Set `fill:'tonexty'` and `connectgaps:false` (1s).
4. Look at the fill between x=3 and x=5 (5s).

## Expected
Two separate fill bands, one for x=1..3 and one for x=5..7. No shading inside the null gap at x=4.

## Actual
The fill is one polygon that bridges the gap with a diagonal band through x=4 (1s). Near x=1..3 the fill also forms triangular slivers instead of a clean band between the traces (1s). The fill is still drawn inside the highlighted gap region at 5s and stays that way through 23s.

## Evidence
- **Console (1s):** `Bug confirmed — fill drawn as single polygon across gap. Sub-paths in fill: [2] (expected ≥2 separate bands)`. The path `d="M52.22,126.67L194.32,158.33L336.41,95L620.59,158.33..."` goes straight from x=3 (336.41px) to x=5 (620.59px) with no `M` break. Note: the reported sub-path count `[2]` conflicts with the 'bug confirmed' message.
- **Visual (5s):** A red dashed box labeled 'gap: null in both traces' covers x=4. The blue fill is visible inside it.
- **Console (0s, unrelated):** Parser-blocking cross-site `document.write` warning for the Plotly CDN script.

## Suggested area
Scatter `tonext` fill path construction (`src/traces/scatter/plot.js`). It should split the fill into separate segments at gaps when `connectgaps:false`.

Related: plotly.js #2736

*Recorded with SceneRecap.*

This report was written by SceneRecap from a screen recording. Try SceneRecap free

Turn a screen recording into a bug report like this one.

Repro steps, expected vs actual and the console and network evidence, each with a timestamp. On every plan, Free included.

Try SceneRecap free →
Plotly.js: `fill:'tonexty'` renders across data gaps when `connectgaps:false` · SceneRecap