As a beginner in D3.js, I am exploring the creation of a bubble chart with a toggle button to switch between different presidential campaign candidates. While I succeeded in making the chart for one candidate, I am encountering difficulties implementing the toggle functionality with D3.js. My goal is to achieve something similar to a visualization I found here, albeit with simpler animation. How can I accomplish this?
Below is a snippet of my HTML code:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="//rawgithub.com/Caged/d3-tip/master/examples/example-styles.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="d3-tip.js"></script>
Here is a snippet of my JavaScript code:
// Your JavaScript goes here
Finally, here is a sample from my CSV file. You can access the full file here:
Candidate,State,Name,Past,Amount
Marco Rubio,AK,Alaska,R,10.5
Hillary Clinton,AL,Alabama,R,10.47
Jeb Bush,AR,Arkansas,R,4.55
Donald Trump,AZ,Arizona,R,46.13
Ted Cruz,CA,California,D,82.55
Any assistance on how to implement the toggle feature using D3.js would be greatly appreciated. Thank you!