plotly / plotly/plotly.js

Relayout not provided with event data after mousewheel zoom

未关闭
#6,798 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug P3
主要语言
JavaScript
星标
18.3k
派生
2k
平均合并
2 天 12 小时
30 天内合并 PR
28

描述

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>

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先复现所提供的 HTML 示例,并跟踪 3D 鼠标滚轮缩放期间的 plotly_relayout 事件,尤其是在旋转和点击交互之后。将发出的 scene.camera 数据与屏幕上显示的相机位置进行比较。完成的标准是:每次缩放交互后,事件都能持续报告更新后的相机数据,而不是空值或滞后的值。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
data-visualization, frontend
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。