Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document select #1353

Merged
merged 2 commits into from
Mar 23, 2023
Merged

document select #1353

merged 2 commits into from
Mar 23, 2023

Conversation

Fil
Copy link
Contributor

@Fil Fil commented Mar 17, 2023

for #1343

note that we don't cover the case where symbol is constant, but we try to select it with select({symbol: "min"}); this should be red:

Capture d’écran 2023-03-17 à 18 28 18

@Fil Fil requested a review from mbostock March 17, 2023 17:34
@mbostock
Copy link
Member

we don't cover the case where symbol is constant, but we try to select it

This is true in general; the types don’t validate that the channels referenced in the outputs actually exist. For example, you could declare title: "mean" as an output, but you wouldn’t get an error if you don’t declare the title channel as an input.

@@ -13,16 +13,50 @@ export interface SelectOptions {
z?: ChannelValue;
}

/**
* Selects points from each series (usually defined by *stroke*, *fill* or *z*)
Copy link
Member

Choose a reason for hiding this comment

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

The “usually defined by stroke, fill or z” feels unnecessarily imprecise. How would the user know when or not the “usual” definition applies? We should list these channels in order of precedence: z, fill, stroke. The README is more definite:

The data are grouped into series using the z, fill, or stroke channel in the same fashion as the area and line marks.

And similarly for the area mark:

By default, the data is assumed to represent a single series (i.e., a single value that varies over time). If the z channel is specified, data is grouped by z to form separate series. Typically z is a categorical value such as a series name. If z is not specified, it defaults to fill if a channel, or stroke if a channel.

@mbostock mbostock merged commit a436fbd into main Mar 23, 2023
@mbostock mbostock deleted the fil/ts-select branch March 23, 2023 01:22
chaichontat pushed a commit to chaichontat/plot that referenced this pull request Jan 14, 2024
* document select

* edits

---------

Co-authored-by: Mike Bostock <[email protected]>
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.

2 participants