Skip to main content
100%

D3 Course 6: Interaction with Unidirectional Data Flow

✓ Published1🌍 Public
GGabrz
Last edited Apr 2, 2020
Created on Mar 31, 2020

This example demonstrates interactive selection and highlighting of fruit marks in an SVG bowl using unidirectional data flow. Clicking or hovering a circle triggers callbacks that update the selected or hovered fruit ID, which then re-renders the bowl with the appropriate stroke color—black for clicked, orange for hovered. The code uses d3.scaleOrdinal for color and radius mapping, d3.select for data joins with enter/merge/exit, and d3 transitions to animate circle radius changes over one second. The fruit data is generated with d3.range and random IDs, with timed updates removing or replacing fruits.

AI-generated description

Data Visualization with D3 Course; <b>Interaction with Unidirectional Data Flow</b><br>

<h3>Interaction with Unidirectional Data Flow</h3> <table> <th align="left">Topics</th> <tr> <td> <ul> <li><b>Listening Click Events</b></li> <li><b>Unidirectional Data Flow</b></li> <li><b>Selecting a Mark by Clicking</b></li> <li><b>Highlighting Selected Mark</b></li> <li><b>Select a Mark by Hovering</b></li> </ul> </td> </tr> </table>
MIT Licensed

Similar vizzes