Skip to content

docs: fix tooltip titleSpacing, bodySpacing and footerSpacing descriptions - #12393

Open
adityajai119 wants to merge 1 commit into
chartjs:masterfrom
adityajai119:docs/11459-tooltip-spacing
Open

adityajai119 wants to merge 1 commit into
chartjs:masterfrom
adityajai119:docs/11459-tooltip-spacing

Conversation

@adityajai119

Copy link
Copy Markdown

Fixes #11459

The tooltip docs and the TooltipOptions JSDoc describe titleSpacing, bodySpacing and footerSpacing as spacing added to the top and bottom of each line or item. The tooltip plugin only adds this spacing between consecutive lines: getTooltipSize() adds (lineCount - 1) * spacing, and drawTitle()/drawBody() remove the spacing after the last line. A single-line title, body or footer gets no extra space, which is why the option appears to have no effect.

This changes the three descriptions in docs/configuration/tooltip.md and the matching JSDoc in src/types/index.d.ts to say the spacing is added between lines. No code changes.

Checked by measuring chart.tooltip.height with each option set to 0 and 30:

Option 1 line 2 lines
titleSpacing +0 +30
bodySpacing +0 +30
footerSpacing +0 +30

bodySpacing also applies between the lines of a single multi-line label.

AI-assisted: drafted with an AI coding agent; the measurements above were run locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tooltip titleSpacing option has no effect

1 participant