From 1ad598db568c92699fe177391a63db7418c64947 Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Tue, 30 May 2023 12:18:32 -0700 Subject: [PATCH] no implicit title on derived tip --- src/plot.js | 4 +- test/output/tipGroupPrimitives.svg | 64 ++++++++++++++++++++++++++++++ test/plots/tip.ts | 8 ++++ 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 test/output/tipGroupPrimitives.svg diff --git a/src/plot.js b/src/plot.js index f99c4afd62..53cee69a52 100644 --- a/src/plot.js +++ b/src/plot.js @@ -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; diff --git a/test/output/tipGroupPrimitives.svg b/test/output/tipGroupPrimitives.svg new file mode 100644 index 0000000000..5c08a8e086 --- /dev/null +++ b/test/output/tipGroupPrimitives.svg @@ -0,0 +1,64 @@ + + + + + + + + 0 + 1 + + + ↑ Frequency + + + + + + + + + + + + + + + 1 + 2 + 5 + 6 + 8 + a + c + d + e + f + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/plots/tip.ts b/test/plots/tip.ts index e929ec1d95..55e005dc20 100644 --- a/test/plots/tip.ts +++ b/test/plots/tip.ts @@ -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("data/athletes.csv", d3.autoType); return Plot.hexagon(olympians, Plot.hexbin({r: "count"}, {x: "weight", y: "height", tip: true})).plot();