Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

63
Visualizações
Optimal way to have a temporary plot with plotly.js

I am trying to do something similar to http://stuffin.space/ , where I highlight an object and show its path, but only when the object is hovered. With what I have so far, I am able to see it work once, but it is slow, and it fails to work after the first time. Here is the code for this section

    var myPlot = document.getElementById('solarPlot')
    myPlot.on('plotly_hover', function(data){
        var index = data.points[0].pointIndex
        var elem = data.points[0].data.elems[index]
        //Note that elems is something I stored as a part of plots previously to have the data available. It contains the bare minimum info to plot the trajectory.
        var newPlot = determinePlotFromElem(elem) //This returns a plot. The last line of the function is as below
        //{x:xs, y:ys, z:zs, mode:'lines', type: 'scatter3d', line:{color:color, width:1}, showlegend: false, hoverinfo:'skip'}
        
        
        //TODO: Set a better color for this plot!
        plots.push(newPlot)
        Plotly.react('solarPlot', plots, layout)

    });
    
    myPlot.on('plotly_unhover', function(data){
        plots = plots.slice(0,numPlots) //This limits the number of plots to the base plots
        Plotly.react('solarPlot', plots, layout)
    })

It takes about 2 seconds to create the newPlots in the first place, and a similar amount of time to update this temporary plot. Is there a better way to do this, one that will be faster?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda