3
plotlyDiv.on('plotly_click', function (data) {
    var x, y, x_axis, y_axis;
    data.points.map(function (d) {
        x = d.x;
        y = d.y;
        x_axis = d.xaxis.title.text.toLowerCase().replace(' ','_');
        y_axis = d.yaxis.title.text.toLowerCase().replace(' ','_');
    });
};

How to highlight the marker in the plotly scatter map

Jainil
  • 1,488
  • 1
  • 21
  • 26
Anoop
  • 505
  • 8
  • 23

1 Answers1

1

I just found it myself

Here is the answer :

plotlyDiv.on('plotly_click', function (data) {
                var x, y, x_axis, y_axis,colors=[];
                data.points.map(function (d) {
                    x = d.x;
                    y = d.y;
                    var pn;
                    var colors=[];
                    x_axis = d.xaxis.title.text.toLowerCase().replace(' ','_');
                    y_axis = d.yaxis.title.text.toLowerCase().replace(' ','_');
                    for(var i=0; i < data.points.length; i++){
                    pn = data.points[i].pointNumber;
                    colors = data.points[i].data.marker.color;
                    };
                    colors[pn] = '#ffffff';
                    var update = {'marker':{ size: scatterSize, sizeref: Math.min(scatterData), sizemode: "area", color: colors}};
                    console.log(update)
                    Plotly.restyle('heat-map', update);
                });
Anoop
  • 505
  • 8
  • 23