observablehq / observablehq/plot

A scale for the strokeWidth channel?

Open
#2,017 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
HTML
Stars
5.4k
Forks
244
PR merge metrics
No merged PRs in 30d

Description

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!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked finite state machine example and the linked map reproduction, then trace how Plot interprets the strokeWidth channel and its range/type settings. Done means the map can vary stroke widths through the channel without requiring manual value division, with the intended scaling behavior verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
d3
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.