Chart.js字段未正确显示字符

rur96b6h  于 2022-11-06  发布在  Chart.js
关注(0)|答案(1)|浏览(209)

当使用下面显示的config代码时,标题在图像中显示错误。这也会发生在其他字段,如工具提示和标签。
但是当我在https://codepen.io/上尝试时,我得到了一个正确的结果(如预期的标题)。
有人知道如何解决这个问题吗?

  1. const config = {
  2. type: 'bar',
  3. data: dataSource,
  4. options: {
  5. plugins: {
  6. title: {
  7. display: true,
  8. text: 'Código',
  9. }
  10. }
  11. }
  12. };

oxosxuxt

oxosxuxt1#

尝试将ó替换为其HexCode如下所示。

  1. title: {
  2. display: true,
  3. text: 'C' + '\xF3' + 'digo'
  4. }

或者...

  1. title: {
  2. display: true,
  3. text: 'Código'.replace('ó', '\xF3')
  4. }

相关问题