plotly / plotly/plotly.js

Resizing pie chart with tooltips misaligns it and throws error

Open
#6,696 0 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

When using a certain combination of settings, pie charts can become misaligned, throwing the error trace.insidetextfont is undefined:
image

To reproduce the bug, first hover over the pie chart to bring up a tooltip, then resize the sandbox window to make the pie chart resize itself. The bug will not appear if you resize the chart without bringing up a tooltip at some point first.

I've created a minimum reproduction here:

<Plot
  data={[
    {
      values: [1, 2],
      type: "pie",
      textinfo: "none",
      hovertext: ["Tooltip 1", "Tooltip 2"]
    }
  ]}
  style={{
    width: "100%"
  }}
  useResizeHandler
/>

Note that you don't need multiple pie sections to get the error (that's for demonstrating the misalignment), but you do appear to need everything else in some form, including, interestingly, textinfo: "none".

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 CodeSandbox reproduction and reproduce the sequence: hover the pie chart, then resize the sandbox window. Trace the resize and tooltip interaction until the trace.insidetextfont is undefined error and misalignment are explained; done means the chart resizes without the error or visual displacement, including with textinfo: "none" and hovertext.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.