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

179
Visualizações
I am Unable to display the graph on button click

There is this project where I have to display a dynamic graph which updates automatically without refreshing the page. I was able to do this and I am currently using the buttons so that the user can manually click whatever graph he wants to look.

The problem is once I click the second button a graph is displayed, if I again click the first button it's output is not displayed. I have attached the code for your reference.

As for the java script code I have used Canvas Js sample code.

Here is the code which I used to represent the graphs using buttons

    <button id="refresh" type="button" onclick="start_p1();">Click for Process_1</button>
<div id="chartContainer1" class="w3-display-middle" style="height: 300px; width: 100%;"></div>
<button type="button" onclick="start_p2()">Click for Process_2</button>
<div id="chartContainer2" class="w3-display-middle" style="height: 300px; width: 100%;"></div>
<script type="text/javascript">
    $("refresh").click(function(){
        $("chartContainer1").load(" #chartContainer1");
    });
</script>

I even looked about reloading the div tag but it doesn't help me as expected. I would appreciate the help. Thanks in advance..

Edit: I have included my output in the form of image so that you can understand clearly.
My output
My output

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