I'm attempting to enhance the Clustered Bubble Chart with a legend that corresponds to the color of each cluster. However, my current approach isn't yielding any results.
Within my CSV file, I've established 5 clusters distinguished by various colors. My goal is to label and color-code each cluster individually.
While there are no syntax errors in the code, the visualization remains blank. Could someone review the code to identify what's causing this issue? Additionally, do you have any recommendations for incorporating a legend into the bubble chart?
<!DOCTYPE html>
<meta charset="utf-8">
<style type="text/css">
text {
font: 10px sans-serif;
}
circle {
stroke: #565352;
stroke-width: 1;
}
</style>
<body>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script>
var width = 1000,
height = 1000,
padding = 1.5, // separation between nodes of the same color
clusterPadding = 6, // separation between nodes of different colors
maxRadius = 65;
var color = d3.scale.ordinal()
.range(["#5499C7", "#8E44AD", "#138D75", "#F1C40F", "#D35400"]);
// Remaining JavaScript code...