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

145
Visualizações
how to get click events on plotly.js table?

I trying to get the click event on the table cell of plotly.js table. I just want to console.log('clicked cell name'), but it seems nothing is getting fired no matter what I do.

please help I'm stuck for a few days now.

let make_table = (id)=>{
        var values = [
                ['Salaries', 'Office', 'Merchandise', 'Legal', '<b>TOTAL</b>'],
                [1200000, 20000, 80000, 2000, 12120000],
                [1300000, 20000, 70000, 2000, 130902000],
                [1300000, 20000, 120000, 2000, 131222000],
                [1400000, 20000, 90000, 2000, 14102000]]
          
          var data = [{
            type: 'table',
            header: {
              values: [["<b>EXPENSES</b>"], ["<b>Q1</b>"],
                                           ["<b>Q2</b>"], ["<b>Q3</b>"], ["<b>Q4</b>"]],
              align: "center",
              line: {width: 1, color: 'black'},
              fill: {color: "grey"},
              font: {family: "Arial", size: 12, color: "white"}
            },
            cells: {
              values: values,
              align: "center",
              line: {color: "black", width: 1},
              font: {family: "Arial", size: 11, color: ["black"]}
            }
          }]

        Plotly.newPlot(id, data)
              .then(g => {
                g.on('plotly_click', d => {
                  console.log(d)
                })
              })
}

for eg. If I click on cell with value == 1200000, then I want to perform console.log(1200000).

about 4 years ago · Santiago Trujillo
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