Black Lives Matter. Please consider donating to Black Girls Code today.
https://www.blackgirlscode.com

'Plotly_Selected' returns "data": undefined

Hello,

I am working on a project where a user selects a set of variables which will return a scatter plot then can use either the ‘box select’ or ‘lasso select’ to select a cluster of data point.

I am implemented the ‘Plotly_Selected’ function but when I call the function it just returns undefined variables (see screenshot).

I will attach my code for the ‘Plotly_Selected’ function call as well.

JS Code:

$('#div-chart').on('plotly_selected', function(eventData){
        //eventData.points.forEach(function(pt) {
            console.log(eventData);
        //});
    });

use document.getElementByID, I had problems using JQuery, try it and see if it works

1 Like