echarts-wordcloud中配置项
series: [{
type: 'wordCloud',
shape: 'circle',
//圆形circle(默认),心形(heart,apple),菱形(diamond),
//向前的三角形(triangle-forward) ,三角形(triangle),直立三角形(triangle-upright), 五边形(pentagon), 星型(star)
//maskImage的横纵比为1:1
keepAspect: false,
//掩码图像。设置形状为图片的形状。
maskImage: maskImage,
left: 'center',
top: 'center',
width: '70%',
height: '80%',
right: null,
bottom: null,
//sizeRange :词云的文字字号范围,默认是[12, 60] ,
//词云会根据提供原始数据的 value 对文字的字号进行渲染。以默认值为例, value 最小的渲染为 12px ,最大的渲染为 60px ,中间的值按比例计算相应的数值。
sizeRange: [12, 60],
//词云中文字的角度,词云中的文字会随机的在 rotationRange 范围内旋转角度,
//渲染的梯度就是 rotationStep ,这个值越小,词云里出现的角度种类就越多
rotationRange: [-90, 90],
rotationStep: 45,
//词云中每个词的间距
gridSize: 8,
//是否允许词云在边界外渲染,直接使用默认参数 false 就可以,否则容易造成词重叠。
drawOutOfBound: false,
//词云中文字的样式, textStyle是初始的样式, emphasis 是鼠标移到文字上的样式。
textStyle: {
fontFamily: 'sans-serif',
fontWeight: 'bold',
// Color can be a callback function or a color string
color: function () {
// Random color
return 'rgb(' + [
Math.round(Math.random() * 160),
Math.round(Math.random() * 160),
Math.round(Math.random() * 160)
].join(',') + ')';
}
},
emphasis: {
focus: 'self',
textStyle: {
textShadowBlur: 10,
textShadowColor: '#333'
}
},
//所有的数据,根据value值的大小进行配置
data: [{
name: 'Farrah Abraham',
value: 366,
// Style of single text
textStyle: {
}
}]
}]