Fork of slice
✓ Published0🌍 Public
This example renders a simple three-layered cake using React with D3.js (v6) and SVG. It draws stacked rectangles for the cake layers, adds randomly positioned red circles as sprinkles, and places fixed circles as strawberries on top. A white rectangle represents the candle with an orange circle for the flame. The visualization uses D3's selection and append methods to construct the SVG elements, with styling applied via an external CSS file.
AI-generated descriptionBoilerplate code for a React + D3 visualization with:
- CDN links for React, ReactDOM, and D3
- Basic React boilerplate
- Variables for dimensions and margins
- A
VizContainercomponent that:- Abstracts SVG/group container elements
- Follows the margin convention
- Show the margins, which can be easily removed by deleting the
showMargins={true} prop
MIT Licensed