Skip to content

fix(tooltip): apply textStyle in richText formatter#21675

Open
jesco-absolut wants to merge 1 commit into
apache:masterfrom
jesco-absolut:fix-18339-tooltip-rich-textstyle
Open

fix(tooltip): apply textStyle in richText formatter#21675
jesco-absolut wants to merge 1 commit into
apache:masterfrom
jesco-absolut:fix-18339-tooltip-rich-textstyle

Conversation

@jesco-absolut

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Apply tooltip textStyle font and text-border options to richText tooltip content when a formatter returns plain text.

Fixed issues

Details

Before: What was the problem?

When a tooltip used renderMode: 'richText' with a formatter such as formatter: 'Data: {c}', the formatter output was rendered as the root ZRender text element. TooltipRichContent only copied a small subset of tooltip.textStyle to that root richText element, so options such as fontStyle, fontWeight, fontFamily, and text border settings were ignored even though the same style intent works in HTML tooltip mode.

After: How does it behave after the fixing?

The richText tooltip root text style now applies the relevant tooltip.textStyle fields directly, including font style, weight, size, family, line height, text shadow offsets/blur, and text border color/width. The existing test/tooltip-textStyle.html richText formatter case was extended to cover bold italic monospace text with a text border.

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

Security Checking

  • This PR uses security-sensitive Web APIs.

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

  • test/tooltip-textStyle.html

Merging options

  • Please squash the commits into a single one when merging.

Other information

Validation run locally:

  • npx eslint src/component/tooltip/TooltipRichContent.ts
  • npm run checktype
  • git diff --check
  • npm run build

npm run build generated dist/ files locally for validation only; they were reverted and are not included in this PR.

@echarts-bot

echarts-bot Bot commented Jul 4, 2026

Copy link
Copy Markdown

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant