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

242
Views
How to display multiple D3 visualizations on one page?

I'm having trouble displaying multiple D3 graphs on one page. I have tried many things, but I can only seem to get one of the visualizations on the page, not both.

For the first visualization in HTML, I have:

<section id="first" class="main special">
<header class="major">
     <h2>Presidential Elections</h2>
</header>
<body>
     <div id="lineChart"></div>
     <script src="lineChart.js"></script>
</body>
</section>

My second visualization is similar in index.html:

<section id="second" class="main special">
<header class="major">
     <h2>House Seats Lost Based on Current President</h2>
</header>
<body>
     <div id="barChart"></div>
     <script src="barChart.js"></script>
</body>
</section>

In lineChart.js and barChart.js, I do not have either visualization labeled as 'svg', but instead 'lineChart' and 'barChart' respectively. The current code displays only the first (line chart) visualization, but I found that when I remove <script src="lineChart.js"></script>, the first (line chart) visualization disappears and the second (bar chart) visualization becomes visible. Does anyone have any idea or guidance on what I am doing wrong?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It's tough to say without seeing the code. But you might selecting all svgs or divs and calling remove(). Look for code that does that, and try dropping the remove() call.

about 4 years ago · Juan Pablo Isaza Report
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!