Echarts报错 Uncaught Error: series.type should be specified.

使用Echarts报错


Uncaught Error: series.type should be specified.
   at Function.entity.getClass (clazz.js?625e:158)
   at ExtendedClass.eval (Global.js?7e63:203)
   at Array.forEach (<anonymous>)
   at each (util.js?6d8b:298)
   at ExtendedClass.visitComponent (Global.js?7e63:192)
   at Function.entity.topologicalTravel (component.js?8918:105)
   at ExtendedClass.mergeOption (Global.js?7e63:174)
   at ExtendedClass.initBase (Global.js?7e63:643)
   at ExtendedClass.resetOption (Global.js?7e63:121)
   at ExtendedClass.setOption (Global.js?7e63:103)

原因

series对象的type属性需要设置成对应的图表类型

解决办法

series: {
        type: 'line',//增加type字段
        label: {
          normal: {
            show: true,
            formatter: (v) => {
              console.log(v.value[1] + 'MB')
              return v.value[1] + 'MB'
            }
          }
        }
      }

你可能感兴趣的:(前端)