Better HN
topnewbestaskshowjobs
Log inSign up

Agent-Cooper

62 karma · joined Jun 13, 2021 (5y ago) · 2 submissions

Submissions

comment 1y ago · link · parent

D3 provides a bunch of utilities for building visualizations beyond DOM manipulation. Here are some of the modules I use regularly:

- d3-array: data processing

- d3-scale: mapping from data attributes to visualization encodings

- d3-scale-chromatic: color schemes

- d3-shape: defining the shapes of paths, such for a line chart

- d3-color: manipulating colors

- d3-time: manipulating dates

- d3-format: formatting numbers

- d3-time-format: formatting dates

These modules are useful even if you don't use D3 to manage the DOM. For example, you can use these utilities to help calculate all of the attributes for your SVG elements, but then use Svelte/React/Solid/Vue to create and render the SVG.

If I'm building a visualization inside of a web app, I tend to prefer this approach since it leaves the framework in control of the DOM throughout the whole app. It feels simpler, especially if I want interactions in the visualization to modify the app's state.

comment 3y ago · link · parent

The circles' areas are showing the failed assets. Observable Plot defaults to using a square root scale when encoding a quantity with the radius of a circle.

https://observablehq.com/plot/marks/dot#dot-options