observablehq/plot

A scale for the strokeWidth channel?

jimjam-slam opened this issue · 2 comments

The finite state machine example shows the use of strokeWidth as a channel to vary widths. But getting this going on a map is proving tricky:

https://observablehq.com/@jimjamslam/vary-stroke-width-on-map

Without varying stroke widths I see the expected links. But once I add strokeWidth as a channel, the values appear to be interpreted literally, making them too large enough to overwhelm the plot. (I can see them vary if I manually scale the values with something like strokeWidth: d => d.count / 100.

I've tried adding a strokeWidth object with a range and type: "log", but that doesn't seem to get me the result I'm looking for, unfortunately!

The strokeWidth channel is not bound to a scale, so you can only it express it as literal values (currently). As you discerned, you’ll need to say something like strokeWidth: (d) => d.count / 100, replacing 100 with whatever value is appropriate to your data.

strokeWidth: {value: vstrokeWidth, optional: true},

Thanks v much for confirming!