Skip to content

Commit 5da40d8

Browse files
committed
fixes #2011
1 parent 33a3ea1 commit 5da40d8

4 files changed

Lines changed: 69 additions & 1 deletion

File tree

src/marks/tip.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,15 @@ export class Tip extends Mark {
225225
: fitTop && fitBottom
226226
? fitLeft
227227
? "left"
228-
: "right"
228+
: fitRight
229+
? "right"
230+
: "bottom"
229231
: (fitLeft || fitRight) && (fitTop || fitBottom)
230232
? `${fitBottom ? "bottom" : "top"}-${fitLeft ? "left" : "right"}`
233+
: fitLeft
234+
? "left"
235+
: fitRight
236+
? "right"
231237
: mark.preferredAnchor;
232238
}
233239
const path = this.firstChild; // note: assumes exactly two children!

test/output/tipAnchorOverflow.svg

Lines changed: 50 additions & 0 deletions
Loading

test/plots/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ export * from "./text-overflow.js";
312312
export * from "./this-is-just-to-say.js";
313313
export * from "./tick-format.js";
314314
export * from "./time-axis.js";
315+
export * from "./tip-anchor-overflow.js";
315316
export * from "./tip-format.js";
316317
export * from "./tip.js";
317318
export * from "./title.js";

test/plots/tip-anchor-overflow.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import * as Plot from "@observablehq/plot";
2+
3+
export async function tipAnchorOverflow() {
4+
return Plot.rectX([1, 1, 1, 1, 1], {
5+
x: Plot.identity,
6+
fill: Plot.indexOf,
7+
title: () =>
8+
"Lorem ipsum lorem ipsum lorem ipsum Lorem ipsum lorem ipsum lorem ipsum Lorem ipsum lorem ipsum lorem ipsum",
9+
tip: true
10+
}).plot({height: 100, marginTop: 20});
11+
}

0 commit comments

Comments
 (0)