plotly / plotly/plotly.js

Relayout not provided with event data after mousewheel zoom

Abierto
#6,798 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug P3
Lenguaje dominante
JavaScript
Estrellas
18.3k
Forks
2k
Merge medio
2 d 12 h
PR fusionados (30 d)
28

Descripción

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>

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza reproduciendo el ejemplo HTML proporcionado y rastreando el evento plotly_relayout durante el zoom 3D con la rueda del ratón, especialmente después de las interacciones de rotación y clic. Compara los datos scene.camera emitidos con la posición de la cámara mostrada en pantalla. Se considera terminado cuando el evento informa de forma consistente de los datos actualizados de la cámara después de cada interacción de zoom, en lugar de valores vacíos o desfasados.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript
Área
data-visualization, frontend
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.