MZ Marks and Channels
This example demonstrates six fundamental marks and channels in D3, each rendered as a separate SVG panel using `d3.select`, `selection.join`, and `selection.each`. It sequentially applies positional encodings (x, y), size (radius), bar length, shape via `d3.symbol` with contrasting symbols, and hue using `d3.schemeCategory10` color scheme. Each panel uses static synthetic data—an array [0,1,2,3,4]—and explicit pixel mappings for scales, with circles, rectangles, and paths drawn as SVG elements. The main `index.js` orchestrates multiple modules, importing named functions and binding them to data-driven SVG containers.
AI-generated descriptionA demonstration of basic D3 usage to implement the concept of Marks and Channels. Includes usage of:
- Point Marks by X, Y, Size
- Line mark varying in length
- Scaling factors
- SVG Rectangles
selection.each()- SVG Path Elements
d3.symbol()- SVG attributes
transformandfill - D3 Color Schemes
- JavaScript Modules
Part of the Constructing Visualizations Playlist.
See also blocks.roadtolarissa.com: Marks and Channels (a vanilla JavaScript version of this).