Open tuotuogenjudi opened 7 years ago
有解决这个问题吗?要如何才能在vue-echarts中引入echarts-cloud呢?
直接下载依赖,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,
// },
// }],
// },
};
},
需要引入echarts-wordcloud