-
Notifications
You must be signed in to change notification settings - Fork 184
the title channel is not filtering the mark, unless it's a tip mark #1704
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
Conversation
(any mark that depends on this channel must declare it)
@@ -56,7 +57,8 @@ export class Tip extends Mark { | |||
x1: {value: x1, scale: "x", optional: x2 == null}, | |||
y1: {value: y1, scale: "y", optional: y2 == null}, | |||
x2: {value: x2, scale: "x", optional: x1 == null}, | |||
y2: {value: y2, scale: "y", optional: y1 == null} | |||
y2: {value: y2, scale: "y", optional: y1 == null}, | |||
title: {value: title, optional: true} // filter: defined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, just for posterity: this works because the channels that are defined here override the default channels that are declared by styles. And that’s specifically because styles is listed first in the spread here:
Line 44 in 5e313d9
if (defaults !== undefined) channels = {...styles(this, options, defaults), ...channels}; |
That’s fine. It’s a little subtle, but it makes sense that the mark-specific channel definitions would override the defaults.
test/plots/title.ts
Outdated
import * as Plot from "@observablehq/plot"; | ||
import * as d3 from "d3"; | ||
|
||
export async function titleDefinedTip() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m going to rename this to “sparseTitle” instead of “titleDefined” since the interesting thing about this test is that sometimes the title is not defined. 😂
…1704) * the title channel is not filtering the mark, unless it's a tip mark (any mark that depends on this channel must declare it) * rename to sparse title --------- Co-authored-by: Mike Bostock <[email protected]>
…1704) * the title channel is not filtering the mark, unless it's a tip mark (any mark that depends on this channel must declare it) * rename to sparse title --------- Co-authored-by: Mike Bostock <[email protected]>
* null filter on the href channel closes #1696 * the title channel is not filtering the mark, unless it's a tip mark (#1704) * the title channel is not filtering the mark, unless it's a tip mark (any mark that depends on this channel must declare it) * rename to sparse title --------- Co-authored-by: Mike Bostock <[email protected]> --------- Co-authored-by: Mike Bostock <[email protected]>
* null filter on the href channel closes #1696 * the title channel is not filtering the mark, unless it's a tip mark (#1704) * the title channel is not filtering the mark, unless it's a tip mark (any mark that depends on this channel must declare it) * rename to sparse title --------- Co-authored-by: Mike Bostock <[email protected]> --------- Co-authored-by: Mike Bostock <[email protected]>
* null filter on the href channel closes observablehq#1696 * the title channel is not filtering the mark, unless it's a tip mark (observablehq#1704) * the title channel is not filtering the mark, unless it's a tip mark (any mark that depends on this channel must declare it) * rename to sparse title --------- Co-authored-by: Mike Bostock <[email protected]> --------- Co-authored-by: Mike Bostock <[email protected]>
(any mark that depends on this channel must declare it)
ref. #1699 (comment)