echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Bug] Tooltip with renderMode: 'richText' does not apply rich styling to formatter.

Open GidianB opened this issue 1 year ago • 9 comments

Version

5.5.0

Link to Minimal Reproduction

https://echarts.apache.org/examples/zh/editor.html?c=bar-simple&code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXMmurGAJ4gCmRA5AMYCGYVA5sAE7m0A0J6AE2aMiAbVoBZGL1i0AKgFcqM2gHUqAlXIAWClQDEOEFQGVmphdFoBdEgF8-6cjnxFUpMpRqyAbowA2SrT2jmTAwP6QIG78sBxU0AJUHFJJdEb02nJUGGC8sQBmnAC2zCwcRAAUIIwcjMV4AJTo8AB8xB7o8WAKHHCwAAawACRINXUNAHTQ9VR2bgBGgVQAPqPj9XiTfst2dgOxDrEA9McAQlT-wADusHgU_hDQrLD4sNDAYLCMICCPGrEMtoYp1YEslCDQbB6BFOHRwcpQqCitAwOoIKxtGB4RFNEjSHZDviWLkTA9vO5OkDIaCETSoTCrhVZAj8lDSCi0VQMVicf48bEPITQcKCSESHhkhAqIRYKJYpSPEIwCI5QBGABMAAYeLBtTrYGqAKwGgAcBoA7Aa1WrrQBmLXWfHoCjUeG1YJCki2OwAbiAA

Steps to Reproduce

Specify renderMode: 'richText' in the tooltip and use richText formatting in the formatter. Then specify the richText styling in tooltip.rich or in tooltip.textStyle.rich

Current Behavior

Currently, rich is not supported by tooltip, and renderMode:'richText' seems to be a useless option. In wechat applets without DOM, there is no way to customize different styles.

Expected Behavior

rich styling should be applied to the formatter.

Environment

- OS: Windows 10
- Browser: Chrome

Any additional comments?

What does the proposed API look like?

tooltip.rich or tooltip.textStyle.rich

GidianB avatar May 22 '24 08:05 GidianB

Agree, renderMode 'richText' is misleading since there is no rich in tooltip API. Technically we cannot call it a bug since rich is missing, but I think rich was meant to be used, just some source code was not hooked up...? Proof: tooltip recognizes 'rred' as rich format and does not display it as string, but does not apply it as format either.

  formatter: '{b}: {rred|{c} }',
  renderMode: 'richText',
  rich: {
    primary: { color: 'magenta' },
    rred: { color: 'red', fontWeight: 'bold' }
  },

So this issue could be updated to a valid and very useful New Feature Request. EDIT: found a duplicate #12232 and a pending PR https://github.com/apache/echarts/pull/14994. EDIT2: as of Aug 2024 the above proof code does not work anymore

EDIT final: renderMode:'richText' has nothing to do with rich formatting, but with DOM and apps like WeChat. So I virtually retract all my "findings" (nonsense) above 😓

helgasoft avatar May 22 '24 18:05 helgasoft

@helgasoft Thanks for the information! I will review the PR tomorrow.

Ovilia avatar Jun 19 '24 10:06 Ovilia

@Ovilia any update on this?

GidianB avatar Jul 31 '24 14:07 GidianB

any update on this?

gufengpiaoyi avatar Aug 21 '24 03:08 gufengpiaoyi

any update on this?

zhanzz avatar Oct 11 '24 02:10 zhanzz

any update on this?

Travelguest avatar Nov 07 '24 07:11 Travelguest

any update on this?

tubloko avatar Dec 10 '24 17:12 tubloko

+1

XHL-study avatar Dec 12 '24 02:12 XHL-study

暂时性的解决方案? https://docs.qq.com/doc/p/4b05780aefa6438832994bba7a6a3c21a4456515

@tubloko @Travelguest @zhanzz @gufengpiaoyi @GidianB

XHL-study avatar Dec 12 '24 08:12 XHL-study