From 57073de8d0c7062f29773e9e67307d8655a2df37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Mon, 8 Apr 2024 08:33:20 +0200 Subject: [PATCH] fix #2045 --- src/plot.js | 1 + test/output/pointerViewofTitle.html | 406 ++++++++++++++++++++++++++++ test/plots/pointer.ts | 10 + 3 files changed, 417 insertions(+) create mode 100644 test/output/pointerViewofTitle.html diff --git a/src/plot.js b/src/plot.js index 541218f306..628108bd65 100644 --- a/src/plot.js +++ b/src/plot.js @@ -332,6 +332,7 @@ export function plot(options = {}) { if (subtitle != null) figure.append(createTitleElement(document, subtitle, "h3")); figure.append(...legends, svg); if (caption != null) figure.append(createFigcaption(document, caption)); + if ("value" in svg) (figure.value = svg.value), delete svg.value; } figure.scale = exposeScales(scales.scales); diff --git a/test/output/pointerViewofTitle.html b/test/output/pointerViewofTitle.html new file mode 100644 index 0000000000..066b5f8008 --- /dev/null +++ b/test/output/pointerViewofTitle.html @@ -0,0 +1,406 @@ +
+
+

Penguins

+ + + + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + + + ↑ culmen_depth_mm + + + + 35 + 40 + 45 + 50 + 55 + + + culmen_length_mm → + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
\ No newline at end of file diff --git a/test/plots/pointer.ts b/test/plots/pointer.ts index 1e9df45067..e291a4c8f4 100644 --- a/test/plots/pointer.ts +++ b/test/plots/pointer.ts @@ -35,6 +35,16 @@ export async function pointerViewof() { return html`
${plot}${textarea}
`; } +export async function pointerViewofTitle() { + const penguins = await d3.csv("data/penguins.csv", d3.autoType); + const plot = Plot.dot(penguins, {x: "culmen_length_mm", y: "culmen_depth_mm", tip: true}).plot({title: "Penguins"}); + const textarea = html`