如何突出显示 Plotly Graph 标记
How to Highlight Plottly Graph marker
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(' ','_');
});
};
如何在plotly散点图中高亮marker
我自己找到的
答案如下:
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);
});
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(' ','_');
});
};
如何在plotly散点图中高亮marker
我自己找到的
答案如下:
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);
});