Skip to main content
100%

World Happiness Pseudo-Visualization

✓ Published0🌍 Public
Ssamozarif@gmail.com
Last edited Sep 28, 2024
Created on Sep 28, 2024
Forked from Marks and Channels

This example demonstrates the fundamental D3 concepts of marks and channels by mapping a synthetic world happiness dataset to visual encodings. It uses `d3.scaleOrdinal` with a custom color range to distinguish continents, and encodes happiness values through point positions and circle sizes, echoing the `d3.symbol()` and bar-height variations shown in separate module files. The visualization combines SVG circles, text labels, and a title using `selection.data()` and `selection.join()`, while the included `hue.js`, `length.js`, `shape.js`, `size.js`, and `xPosition.js` modules illustrate alternative encodings such as color, length, and shape. The code builds upon the JavaScript ES6 module system and D3 7.8.5.

AI-generated description

A 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 transform and fill
  • 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).

MIT Licensed

Similar vizzes