Skip to content

arealine mark#2407

Open
mbostock wants to merge 8 commits intomainfrom
mbostock/area-line
Open

arealine mark#2407
mbostock wants to merge 8 commits intomainfrom
mbostock/area-line

Conversation

@mbostock
Copy link
Copy Markdown
Member

@mbostock mbostock commented Apr 5, 2026

Alternative to #2133 and #2405. Fixes #1866 #2111. Needs documentation…

@mbostock mbostock requested a review from Fil April 5, 2026 17:23
@Fil
Copy link
Copy Markdown
Contributor

Fil commented Apr 6, 2026

I like that the render code is much easier to read than in #2133; however I think I liked the {line: true} option better, because it still feels to me that (visually!) this is an area mark with a different style, rather than a different mark. (But that's easy to do in a future enhancement by checking the option in the areaY function and branching to AreaLine.)

src/mark.d.ts Outdated

export interface ColorOptions {
/** Shorthand for setting both the fill and the stroke. */
color?: ChannelValueSpec;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be supported on all marks…

Copy link
Copy Markdown
Contributor

@Fil Fil Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once we support color, we'll often want to use this over stroke or fill, because it's less cognitive work—so it should "just work" everywhere.

I feel it can be a bit tricky though, because it might not make sense for all marks to set both stroke and fill. For instance, I don't think we'd want to set a fill on a line (it's rarely a good idea), or a link (it doesn't apply, so better stick with fill: "none"), but maybe on an arrow (it can apply if there is a non-zero bend), although I would rarely do it.

In this sense "color" should mean "the base color for the mark" rather than "a shorthand for stroke and fill".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the simpler definition of shorthand is easier to understand (and worse is better) and we shouldn’t try to define a “base color” separately for each mark.

I can remove the color shorthand from this PR if you think it’s a bad idea and we can discuss it later.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please remove it, I think it might set the wrong expectation

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what it’s worth we already support a color option on the following marks: axis, grid, auto, crosshair, bollinger. The definition I am using here feels consistent with that existing usage.

Copy link
Copy Markdown
Contributor

@Fil Fil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I like this API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a line option to the area mark

2 participants