Open Future-StarFire opened 3 years ago
在使用v-charts进行饼图展示时,谷歌控制台报了metrics.map is not a function的错误,但是饼图显示正常,数据渲染也正常。 不知道是何原因?
解决控制台报错。
<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 } ] },
Summary 简述
在使用v-charts进行饼图展示时,谷歌控制台报了metrics.map is not a function的错误,但是饼图显示正常,数据渲染也正常。 不知道是何原因?
Expect 期望结果
解决控制台报错。
Reproduce 重现示例
<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 } ] },