Skip to content

Commit

Permalink
no implicit title on derived tip (#1658)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock authored May 30, 2023
1 parent 0d479f2 commit 5744399
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,9 @@ function inferTips(marks) {
const t = mark.tip;
if (t) {
const p = t === "x" ? pointerX : t === "y" ? pointerY : pointer;
tips.push(tip(mark.data, p(derive(mark)))); // TODO tip options?
const options = p(derive(mark)); // TODO tip options?
options.title = null; // prevent implicit title for primitive data
tips.push(tip(mark.data, options));
}
}
return tips;
Expand Down
64 changes: 64 additions & 0 deletions test/output/tipGroupPrimitives.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions test/plots/tip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ export async function tipGeoCentroid() {
});
}

export async function tipGroupPrimitives() {
return Plot.plot({
height: 80,
x: {type: "band"},
marks: [Plot.barY("de156a2fc8", Plot.groupX({y: "count"}, {x: (d) => d, tip: true}))]
});
}

export async function tipHexbin() {
const olympians = await d3.csv<any>("data/athletes.csv", d3.autoType);
return Plot.hexagon(olympians, Plot.hexbin({r: "count"}, {x: "weight", y: "height", tip: true})).plot();
Expand Down

0 comments on commit 5744399

Please sign in to comment.