Skip to content

[BUG]: shape.pattern for bar trace causes color and pattern to be applied to wrong traces in unified hover tooltip #8008

Description

@emilykl

Description

When shape.pattern is provided as an array to a bar trace, the first bar's pattern (and color!) are incorrectly applied to both bars in the hovermode: 'x unified' hover tooltip.

Expected: Swatch in hover tooltip should match color and pattern of bar which is being hovered over.

Actual: Swatch in hover tooltip matches color and pattern of first bar in trace, even when hovering over the second bar.

When shape.pattern is not provided, each hover tooltip correctly shows the color of the bar that's being hovered over.

Screenshots/Video

Image

Steps to reproduce

Codepen: https://codepen.io/emilykl-code/pen/azJvXPy

Code:

var fig = {
  "data": [
    {
      "marker": {
        "color": ["red", "purple"],
        "pattern": {"shape": ["/", ""]}
      },
      "textposition": "outside",
      "x": ["A", "B"],
      "y": [1, 2],
      "type": "bar"
    }
  ],
  "layout": {
    "hovermode": "x unified",
    "title": {
      "text": "Hover over 'B' to see wrong color and pattern"
    }}
};
Plotly.newPlot("div1", fig.data, fig.layout);

Notes

First reported in plotly.py by plotly/plotly.py#4882

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions