Fork of Dispatching Events Example
This example demonstrates a custom D3 chart component that emits events to communicate changes. The Circle component renders an SVG circle that, when clicked, dispatches an `input` event with a new random radius value. The main script listens for this event and calls the circle’s update method, which uses a transition to animate the radius to the new size. The code uses D3’s `create` and `select` functions, along with the `dispatch` and `property` methods, to implement a reusable event-driven pattern. The circle’s cursor is set to a pointer to indicate interactivity.
AI-generated descriptionClick the circle to make it change size.
Trying to understand the pattern found in Observable: D3 Charts in terms of how one might adapt it so that chart instances can emit events.
Reference examples: