Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

187
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!