ElemeFE / v-charts

基于 Vue2.0 和 ECharts 封装的图表组件📈📊
https://v-charts.js.org
MIT License
6.8k stars 1.99k forks source link

在使用饼图时报错metrics.map is not a function,不知是何原因? #884

Open Future-StarFire opened 3 years ago

Future-StarFire commented 3 years ago

Summary 简述

在使用v-charts进行饼图展示时,谷歌控制台报了metrics.map is not a function的错误,但是饼图显示正常,数据渲染也正常。 不知道是何原因?

Expect 期望结果

解决控制台报错。

Reproduce 重现示例

image

<ve-pie :data="chartData" :extend="chartExtend" :toolbox="toolbox" :loading="loading" :not-set-unchange="['dataZoom']" :settings="chartSettings"></ve-pie>

export default { name: 'Analyse', data() { this.toolbox = { feature: { saveAsImage: {} } } this.chartExtend = { series(v) { v.forEach(i => { i.barWidth = 10 }) return v }, } this.chartSettings = { dimension: 'dtLabel', metrics: 'sumPrice', limitShowNum: 5, dataType: function(v) { return v + '¥' } } return { extends: { animationDuration: 3000, animationEasing: "cubicInOut", }, loading: false, chartData: { columns: ['dtLabel', 'sumPrice'], rows: [{ 'dtLabel': '水果', 'sumPrice': 1393 }, { 'dtLabel': '饮品', 'sumPrice': 3530 }, { 'dtLabel': '果汁', 'sumPrice': 2923 }, { 'dtLabel': '儿童食品', 'sumPrice': 1723 }, { 'dtLabel': '调味品', 'sumPrice': 3792 }, { 'dtLabel': '粗粮', 'sumPrice': 4593 } ] },