Conversation
Fixed areaY to work with dense intervals (interval + reduce) without requiring an explicit y option, matching lineY behavior. 🤖 Generated with [Claude Code](https://claude.ai/code) Total cost: $5.51 Total duration (API): 23m 31.3s Total duration (wall): 14h 30m 4.3s Total code changes: 208 lines added, 53 lines removed Token usage by model: claude-3-5-haiku: 204.7k input, 4.8k output, 0 cache read, 0 cache write claude-sonnet: 18.9k input, 28.4k output, 8.3m cache read, 629.5k cache write
mbostock
reviewed
Jun 6, 2025
Member
mbostock
left a comment
There was a problem hiding this comment.
More description about how this fixes the problem would be helpful in the PR. (And it would be more relevant than your experience with AI, though I appreciate you sharing!) I guess this changes the behavior exactly when y is undefined, but preserves the current behavior when y is null. Will anything else be affected by this fix?
Contributor
Author
|
Good call. I added details in the description. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Defaults y to the reducer when creating a dense interval.
There is a discrepancy between line and area, where the default y = identity is set:
in line, it is set immediately, whereas in area it is set in maybeIdentityY, which comes after the determination of the dense interval in maybeDenseIntervalX. By way of consequence, the dense interval does not apply the reducer to any channel.
With this change, the default reducer is applied to y when it's undefined.
An unwelcome consequence is that this defines y even when y1/y2 are defined? But I don't think it has an impact in practice, because when y2 is used y is ignored.
closes #2328
For fun I tried to solve this with Claude Code.
I've left the agent's solution as the first commit (including unit tests); I did not touch the files at all for that first commit, so I signed it with Claude's email. (The commit message is also Claude's, although I added the costs below, because the agent told me it didn't have access to this information.)
In the second commit I reversed Claude's approach, and applied a human solution instead. Is it better or worse? I'll ask copilot for an opinion.