Skip to content

Data argument is always undefined for plotly_unhover event on scatter3rd charts #5953

Closed
@dwoznicki

Description

@dwoznicki

Current behavior

The plotly_unhover callback function only ever appears to receive undefined as an argument. Here's a codepen. Check the console for unhover data value.

Expected behavior

According to the event reference docs, it looks like the unhover callback should receive data on the point being unhovered.

Possible cause

Looking at the proto.render function in https://github.com/plotly/plotly.js/blob/master/src/plots/gl3d/scene.js, it looks like the unhover event gets passed a reference to oldEventData, but oldEventData does not get initialized in this path. Instead, it's set in the path that handles plotly_hover and plotly_click.

Perhaps oldEventData is meant to be stored as a member of the proto.render function so it can be accessed later for the unhover event?

proto.render = function() {

    // ...

    if(lastPicked !== null) {

        // ...

        this.oldEventData = eventData;
    } else {
        Fx.loneUnhover(svgContainer);
        gd.emit('plotly_unhover', this.oldEventData);
        this.oldEventData = undefined;
    }
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions