MoviePilot-Frontend icon indicating copy to clipboard operation
MoviePilot-Frontend copied to clipboard

[错误报告]:插件中使用 ApexChart 中的bar显示label会出现s.toFixed is not a function

Open ting1e opened this issue 5 months ago • 0 comments

确认

  • [X] 我的版本是最新版本,我的版本号与 version 相同。
  • [X] 我已经 issue 中搜索过,确认我的问题没有被提出过。
  • [X] 我已经 Telegram频道 中搜索过,确认我的问题没有被提出过。
  • [X] 我已经修改标题,将标题中的 描述 替换为我遇到的问题。

当前程序版本

v1.9.14-2

问题描述

在开发插件时,使用VApexChart bar显示label时前端报错,图表显示有问题 image

前端报错 Uncaught (in promise) TypeError: s.toFixed is not a function,

报错代码 return window.Apex && (window.Apex.dataLabels = { formatter: function(a, {seriesIndex: n, w: i}) { const s = i.config.series[n]; return s.toFixed(s % 1 === 0 ? 0 : 1) } 报错时 s 为 Proxy(Object) {name: 'upload', data: Array(21)}

禁用label后恢复正常 'dataLabels': { 'enabled': False, },

发生问题时系统日志和配置文件

插件get_page 返回图表格式 
'component': 'VApexChart',
  'props': {
      'height': 300,
      'options': {
          'chart': {
              'type': 'bar',
          },  
          'title': {
              'text': f'上传下载总和'
          },

          'labels':sites,   #['1','2','3','4']          
      },

      'series': [
          {
              'name':'upload', 
              'data': ups,  #[1,2,3,4]
          },
          {
              'name':'download', 
              'data': dls, #[1,2,3,4]
          }
      ],
  }

ting1e avatar Sep 03 '24 02:09 ting1e