plotly / plotly/plotly.js

Relayout not provided with event data after mousewheel zoom

Đang mở
#6,798 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 P3
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ả

This may well be related to #5698, but that is a few years old and I'm not entirely sure this is the same behaviour, partly because that issue reports two things.

The mousewheel based zoom fires the plotly_relayout event, but after some interactions the event data is empty. When not empty it seems to lag behind what is being displayed.

Tested using the script below. After rotation with a click drag, the zoom with the mouse wheel scroll hits the "No scene data found" found the first time through, suggesting that the scene has not changed despite it changing visually on screen. The subsequent mouse wheel scrolls report the scene data. A single click, being careful not to drag, then reports a different value, suggesting the data provided by relayout on the mouse wheel scroll zoom is lagging behind the new scene position.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Zoom test</title>
    <script src="https://cdn.plot.ly/plotly-latest.js" charset="utf-8"></script>
</head>
<body>

<div id="3D_figure"></div>

<script>
        var data = [{
            type: "mesh3d",
            x: [0, 1, 2, 0],
            y: [0, 0, 1, 2],
            z: [0, 2, 0, 1],
            i: [0, 0, 0, 1],
            j: [1, 2, 3, 2],
            k: [2, 3, 1, 3],
            intensity: [0, 0.33, 0.66, 1],
            colorscale: [
              [0, 'rgb(255, 0, 0)'],
              [0.5, 'rgb(0, 255, 0)'],
              [1, 'rgb(0, 0, 255)']
            ]
        }];

        Plotly.newPlot('3D_figure', data, {});

        var top_level_div= document.getElementById('3D_figure');

        top_level_div.on('plotly_relayout', (data) => {
             if(( typeof data === 'undefined') || !('scene.camera' in data)){
                console.log("No scene data found");
             }else{
                console.log(data['scene.camera'].eye.x);
             }
        });
</script>
</body>
</html>

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 bằng cách tái hiện ví dụ HTML được cung cấp và theo dõi sự kiện plotly_relayout trong quá trình thu phóng 3D bằng con lăn chuột, đặc biệt là sau các tương tác xoay và nhấp. So sánh dữ liệu scene.camera được phát ra với vị trí camera hiển thị trên màn hình. Được xem là hoàn tất khi sự kiện luôn báo cáo dữ liệu camera đã được cập nhật sau mỗi lần tương tác thu phóng, thay vì các giá trị rỗng hoặc bị trễ.

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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
38/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.