Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/marks/tip.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ export class Tip extends Mark {
const [k] = cut(value, w - widthof(label), widthof, ee);
if (k >= 0) {
// value is truncated
value = value.slice(0, k).trimEnd() + ellipsis;
title = value.trim();
value = value.slice(0, k).trimEnd() + ellipsis;
}
}
const line = selection.append("tspan").attr("x", 0).attr("dy", `${lineHeight}em`).text("\u200b"); // zwsp for double-click
Expand Down
31 changes: 31 additions & 0 deletions test/output/tipLongText.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions test/plots/tip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ export async function tipLineY() {
return Plot.lineY(aapl, {x: "Date", y: "Close", tip: true}).plot();
}

export async function tipLongText() {
return Plot.tip([{x: "Long sentence that gets cropped after a certain length"}], {x: "x"}).plot();
}

export async function tipNewLines() {
return Plot.plot({
height: 40,
Expand Down