sloped-stroke-width
✓ Published0🌍 Public
11wheel
Last edited Oct 2, 2017
Created on Sep 29, 2017
This example demonstrates why using a filled area to encode stroke width can mislead viewers when lines are sloped. Draggable circles let users adjust the data points, revealing that perceived line thickness changes with slope, while the actual distance between the top and bottom of the shape remains constant. The visualization contrasts this with a standard `stroke-width` line, which handles slope correctly. The code uses `d3.area`, `d3.line`, and `d3.drag` to build the interactive SVG chart, and a custom trigonometric function to calculate the perceived width.
AI-generated descriptiondon't use d3.area to encode stroke-width for non stacked charts
- we don't perceive the distance from the top of the line to the bottom of the line
- st
- strokes will do this automatically
- can't do variable stroke-width though, have to write a custom area function with trig
- doesn't work for stacked area charts, everything is a lie
todo
- make repo
- scrolly post
- not sure how to compare