Skip to main content
100%

on click

✓ Published0🌍 Public
RRobinL
Last edited Apr 24, 2013
Created on Apr 24, 2013

This example demonstrates how to attach interactive click events to data-bound circles in a D3.js visualization. Two data points, each containing a row ID and x/y coordinates, are rendered as black circles on an SVG canvas. When a user clicks a circle, the browser displays an alert with the corresponding row ID from the underlying CSV-style dataset. The code uses D3 selections like `svg.selectAll("circle").data(csv).enter()` to bind data and `d3.selectAll("circle").on("click", ...)` to handle user interaction.

AI-generated description

Similar vizzes