Viewing a saved revision (read-only)
3272888b552d4ea8b7e42967a3d04364
Fork of Self-Modifying Code
This example demonstrates self-modifying code: clicking any of seven colored circles writes that circle’s ID to a CSV file, which the visualization then reads to highlight the selected circle with a black stroke and full opacity. The code uses D3’s `select`, `csvFormat`, and `join` to bind circle elements to static data, while VizHub’s `writeFile` API updates the `selectedIndex.csv` file, creating a feedback loop between the visualization and its own source data. Circles are rendered as SVG elements with fixed positions, radii, and fills, and clicking the currently selected circle clears the selection by writing a null ID.
AI-generated descriptionAn example of self-modifying code using VizHub's writeFile
API.