Here is related html part:
<div class="container-fluid cliente vh-95">
<div class="container-fluid cliente vh-50">
<div id="plot" class="responsive-plot"></div>
</div>
<div class="container-fluid cliente vh-42">
</div>
</div>
related javascript code is for plotting 3d scatter plot:
var layout = {margin: {
l: 0,
r: 0,
b: 0,
t: 0,
autosize: true
}};
function draw_graph(values){
var data = ;
for (var i = 0; i < values.length; i++) {
var cluster = values[i].cluster;
var trace = {
x:values[i].x, y: values[i].y, z: values[i].frame_num,
mode: 'markers',
marker: {
size: 5,
line: {
//color: 'rgba(217, 217, 217, 0.14)',
width: 0.5},
opacity: 0.8},
type: 'scatter3d'
};
data.push(trace);
}
Plotly.react(‘plot’, data, layout);
}
The graph is successfully drawn. However, no data event is working.
here is initializing event listeners:
$(document).ready(function() {
// myFunction(‘./data/biwi/biwi_hotel.txt’);
insert_data_slider();
var myPlot = document.getElementById(‘plot’);
myPlot.on(‘plotly_hover’, function(data){
console.log(“hovered”)
var infotext = data.points.map(function(d){
return (d.data.name+': x= '+d.x+', y= '+d.y.toPrecision(3));
});
console.log(infotext);
})
myPlot.on(‘plotly_click’, function(){
alert(‘You clicked this Plotly chart!’);
});
});
I really hope this code snippets will help because I did not deploy the app and it is still my localhost.Thanks in advance.