Skip to content

Resizing automargin BarChart results in "Cannot read property 'val' of undefined"  #3600

Closed
@ghost

Description

Codesandbox: https://codesandbox.io/s/r3k874mr4 , in own window to resize better: https://r3k874mr4.codesandbox.io/

plotly.js-basic-dist: 1.45.0

If I shrink-resize a responsive, automargin Plotly Horizontal Bar Chart to a greater extent quickly (e.g. drag browser window to minimum size or press minimize button, if it was previously shrinked like this), I receive following error:

Chrome:
image

Firefox:
image

The graph is made responsive by the following config:

const layout = {
  yaxis: {
    automargin: true
  },
  xaxis: {
    automargin: true
  }
};

const config = {
  responsive: true
};

Currently I am using Plotly Charts in a CSS grid layout, wrapped by React (plain plotly.js-basic-dist, no react-plotly.js).

After some research, I encountered this forum thread from Jun '17, in which the solution is basically to ignore the error, because it does not have functional impact.

However, using an React Error Boundary Handler, that error completely shut down my whole application every time it occured. It did cost me 2-3 hours of debugging time to roughly determine where the error did come from, as the message is not very intuitive.

I would really appreciate to have a fix, that does not include workarounds like manually implement a resize handler or similar, because I like the simplicity of responsive:true

Metadata

Metadata

Assignees

Labels

bugsomething broken

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions