Skip to content
Snippets Groups Projects
Commit 01731716 authored by Cee Nell's avatar Cee Nell
Browse files

tooltip works

parent 28e070fc
No related branches found
No related tags found
1 merge request!26Clean up hero
...@@ -47,7 +47,9 @@ ...@@ -47,7 +47,9 @@
</span> (like drought or pollution). </span> (like drought or pollution).
</p> </p>
</div> </div>
<div id="beeswarm-chart-container"></div> <div id="beeswarm-chart-container">
<div id="tooltip" style="position: absolute; opacity: 0; background: #f9f9f9; padding: 5px; border: 1px solid #ccc; border-radius: 5px;"></div>
</div>
</section> </section>
</template> </template>
...@@ -182,7 +184,18 @@ ...@@ -182,7 +184,18 @@
.append('circle') .append('circle')
.attr('class', 'bubble') .attr('class', 'bubble')
.attr('r', d => radiusScale(d.evidence_val)) .attr('r', d => radiusScale(d.evidence_val))
.style('fill', d => dimensionColors[d.dimension.replace(' ', '')]); .style('fill', d => dimensionColors[d.dimension.replace(' ', '')])
.on('mouseover', function (event, d) {
const [x, y] = d3.pointer(event);
d3.select('#tooltip')
.style('opacity', 1)
.html(`${d.determinant}<br>Evidence: ${d.evidence_val}`)
.style('left', (x + 10) + 'px')
.style('top', (y - 28) + 'px');
})
.on('mouseout', function () {
d3.select('#tooltip').style('opacity', 0);
});
// Run simulation // Run simulation
simulation = d3.forceSimulation() simulation = d3.forceSimulation()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment