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

dfuffjeb  于 4个月前  发布在  Echarts
关注(0)|答案(3)|浏览(52)

Version

5.5.0

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

pgky5nke

pgky5nke1#

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 #14994 .

kokeuurv

kokeuurv2#

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

nr9pn0ug

nr9pn0ug3#

@Ovilia any update on this?

相关问题