Conversation
| reduce: sum, | ||
| curve: "step" | ||
| }), | ||
| Plot.areaY(data, {x: "date", y: "value", interval: "day", curve: "step", fill: "#f2f2fe", line: true}), |
There was a problem hiding this comment.
this is even further simplification from #2389
There was a problem hiding this comment.
I like the feature, but it needs a little more work.
I’d like it to work “out of the box” if you add line: true to an area. Right now you also need to set fillOpacity: 0.3 or set fill to a different color than stroke (since both default to currentColor). Probably defaulting fillOpacity to 0.3 if line is true is simplest.
It makes sense that stroke is disabled on the area path when using the line option, but probably other stroke-related attributes should also not be set on the area path. (See “Some marks don’t support stroke (e.g., image)” in style.js.) Ideally we’d avoid setting these attributes, rather than setting them and then immediately setting them back to none.
It also makes sense that we don’t support projections here (auto curve; see the line mark). But what about applyGroupedMarkers? Should we accept marker options if you set the line option? Or maybe in all cases (but just shift the markers to the line if you set the line option)? Are there any other inconsistencies with the line mark implementation here?
|
I've started work on your review comments here #2405. More later. |
mbostock
left a comment
There was a problem hiding this comment.
Another thought was what if we have an “AreaLine” mark, so you would switch from e.g. Plot.areaY to Plot.areaLineY if you want the area + line behavior. This is more concise that the current Plot.areaY + Plot.lineY, and even more concise than Plot.areaY + line: true. It also might make the code a little simpler, since we wouldn’t need as much branching, though there would be some duplication.
I can try that and see how it looks…
|
Superseded by #2407. |
Adding a line option to the area mark makes it quite a bit more convenient to use than the areaY + lineY combo.
closes #1866 (line option on the area mark)
closes #2111 (The ridgeline plot example doesn’t handle overlapping correctly)
will need to update https://observablehq.com/@observablehq/plot-ridgeline
needs (and rebased on) #2390 (stack invalid values as NaN)