Skip to main content
100%

d3 test

✓ Published0🌍 Public
Aadelaide01
Last edited Mar 28, 2020
Created on Mar 28, 2020

This example demonstrates how to create and place basic geometric shapes—a circle, a square, and a star—on an SVG canvas using D3 v5’s data-join and custom append function. The code defines an array of shape objects, binds it with `svg.selectAll().data().enter()`, and then appends each element via a `shapemaker` function that returns the appropriate SVG node. The function uses D3 selections and the `d3.symbol` API with `d3.symbolStar` to generate the star’s path, while styling defaults like `steelblue`, `orange`, and `crimson` are applied conditionally. Rendering is static SVG, with no interaction or transitions.

AI-generated description

Built with blockbuilder.org

mit Licensed

Similar vizzes