Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

186
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda