Skip to content

[BUG]: A NaN in a typed array resets a positive bar stack #8225

Backlog

Description

@Boulea7

Description

In barmode: "relative", a missing value in a Float64Array resets the positive stack for that category. In category A below, the last bar should start at 8 and end at 12. It starts at 0 and ends at 4, covering part of the first bar. The negative stack in B ends at −12 as expected.

Impact

A Dash user reported overlapping segments in a relative bar chart built from a dataframe. I reproduced the problem with synthetic data while investigating that report. The chart understates the sum of positive values when a middle series has a missing value. Downstream report

Steps to reproduce

  1. Load Plotly.js 4.3.1 and add <div id="plot"></div> to the page.
  2. Run this JavaScript:
const values = [[8, -8], [NaN, NaN], [4, -4]];
const data = values.map((y, i) => ({
  type: "bar",
  name: `Series ${i + 1}`,
  x: ["A", "B"],
  y: new Float64Array(y)
}));
Plotly.newPlot("plot", data, { barmode: "relative" });
  1. Compare the last segment of A with the same graph using y in place of new Float64Array(y). With the plain array, the last segment runs from 8 to 12.

Screenshots/Video

No response

Notes

I observed the same result with Float32Array and Float64Array in Chromium. Plain arrays containing NaN or null preserved the stack. 🐦

Contribution

  • I want to open a pull request for this issue after it gets the ready-for-pr label
  • I can review or test a pull request from someone else

Activity

  1. added
    bug
    on Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions