plotly / plotly/plotly.js

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

Đang mở
#8,008 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

bug good for agent P3 size: 1
Ngôn ngữ chính
JavaScript
Star
18.3k
Fork
2k
Merge trung bình
2 ngày 12 giờ
Pull request đã merge (30 ngày)
28

Mô tả

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 https://github.com/plotly/plotly.py/issues/4882

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với bản tái hiện trên CodePen và cấu hình Plotly.newPlot sử dụng hovermode: 'x unified', marker.color và marker.pattern. Theo dõi cách tooltip hover hợp nhất chọn ô màu của từng thanh, sau đó xác minh rằng khi di chuột qua A và B, màu và mẫu tương ứng của từng thanh được hiển thị.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript
Lĩnh vực
data-visualization, frontend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
70/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.