echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Bug] Tooltip textStyle lineHeight property assignment does not persist

Open camiles90 opened this issue 1 year ago • 1 comments

Version

5.2.2

Link to Minimal Reproduction

https://codesandbox.io/p/sandbox/ntt82g

Steps to Reproduce

  1. When changing the line height value in the index.js in the tooltip
  2. Open the popup in a new window to be able to use the developer tools.
  3. Go to the sources tab in the developer tools
  4. Use mouse to hover over bar chart to get a tooltip to show up
  5. After the tooltip is present press the F8 key to pause the page
  6. In the developer tools go to the Elements tab and find or select the tooltip HTML element
  7. In examining the style attribute of the tooltip HTML element, you will see the '... font: italic bold 40px / 60px Papyrus; ...'
  8. The 60px in this example is the line height. The lineHeight value only changes when updating the fontSize property.

Current Behavior

no matter what the tooltip -> textStyle -> lineHeight property is set to, the resulting HTML element's style attribute, will be one and one half times the value of the tooltip -> textStyle -> fontSize property value.

Expected Behavior

When specifying the tooltip -> textStyle -> lineHeight that the property is properly rendered in the resulting HTML element. tooltip: { textStyle: { // Does not work lineHeight: 40, // Does work fontFamily: "Papyrus", fontStyle: "Italic", fontSize: 40, textBorderColor: "yellow", backgroundColor: "orange", fontWeight: "bold", color: "red", }, },

The above tooltip configuration should have the following resulting style in the HTML element:

Environment

- OS: Windows 11
- Browser: Brave Version 1.70.123 Chromium: 129.0.6668.89 (Official Build)
- Framework: Typescript Version 5.3.3

Any additional comments?

No response

camiles90 avatar Oct 04 '24 23:10 camiles90

That would be great! Thank you!

On Tue, Oct 8, 2024 at 5:29 AM sz-p @.***> wrote:

Look like a bug. should i support line-height in getTooltipTextStyle https://github.com/apache/echarts/blob/master/src/component/tooltip/tooltipMarkup.ts#L46 ?

— Reply to this email directly, view it on GitHub https://github.com/apache/echarts/issues/20391#issuecomment-2399470077, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADTWJDUDEZIH4L557QAIQILZ2OXZNAVCNFSM6AAAAABPMXMVY6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJZGQ3TAMBXG4 . You are receiving this because you authored the thread.Message ID: @.***>

camiles90 avatar Oct 08 '24 17:10 camiles90