ecomfe / echarts-wordcloud

Word Cloud extension based on Apache ECharts and wordcloud2.js
1.68k stars 708 forks source link

echarts-cloud结合vue-echarts-v3使用,报[Vue warn]: Error in mounted hook: "Error: Component series.wordCloud not exists. Load it first." #47

Open tuotuogenjudi opened 7 years ago

zhangya5847 commented 6 years ago

需要引入echarts-wordcloud

DQinYuan commented 6 years ago

有解决这个问题吗?要如何才能在vue-echarts中引入echarts-cloud呢?

tuotuogenjudi commented 6 years ago

直接下载依赖,npm install echarts-wordcloud --save,然后在你的页面引入:import 'echarts-wordcloud'; 在调用onready方法:代码如下: 页面:

methods: onReady(instance, echarts) { const that = this; that.ins = instance; that.echarts = echarts; // const maskImage = new Image(); // maskImage.src = img; that.wordcloud = { tooltip: {}, series: [ { type: 'wordCloud', gridSize: 10, sizeRange: [12, 50], rotationRange: [-90, 90], // shape: 'circle', // maskImage, left: 'center', top: 'center', width: '90%', height: '90%', drawOutOfBound: true, textStyle: { normal: { color() { const result = rgb(${[ Math.round(Math.random() * 160), Math.round(Math.random() * 160), Math.round(Math.random() * 160), ].join(',')}); return result; }, }, emphasis: { shadowBlur: 10, shadowColor: '#333', }, }, data: [], }, ], // graphic: { // elements: [{ // type: 'image', // left: 'center', // style: { // image: img4, // width: 600, // x: 0, // y: 0, // height: 600, // }, // }], // }, }; },