prod
校文 3 years ago
parent 0c36c1689f
commit 2316391177

@ -1,8 +1,30 @@
/*
* @Author: your name
* @Date: 2021-12-16 14:41:25
* @LastEditTime: 2021-12-17 10:21:38
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /data-show/src/utils/gol/bubbleWord.js
*/
require("./echarts-wordcloud");
let maskImage = new Image();
maskImage.src = require('@/assets/images/carRound.png');
let colors = ['rgba(84,111,197,1)', 'rgba(145,203,116,1)', 'rgba(90,203,156,1)', 'rgba(248,200,87,1)', 'rgba(237,101,101,1)', "rgba(114,191,222,1)", 'rgba(58,162,114,1)', 'rgba(251,131,81,1)']
//报纸的样式
function newspaper() {
let colorArr = ['#423312', '#605030', '#9A855B', '#DFC8A4'];
let colorIndex = Math.ceil(Math.random() * 3);
return colorArr[colorIndex];
}
// 多彩的样式
function colorfulStyle() {
return 'rgb(' + [
Math.round(Math.random() * 255),
Math.round(Math.random() * 255),
Math.round(Math.random() * 255)
].join(',') + ')';
}
// 将后台数据转成数组
function doWordCloud(data) {
let arr1 = [];
@ -46,7 +68,7 @@ export default function createWordCloud(data) {
rotationStep: 90, //旋转角度的步长
//shape: 'circle',
sizeRange: [6, 48], //字体大小范围
gridSize: 5, //字间距
gridSize: 8, //字间距
maskImage: maskImage,
left: 'center',
top: 'center',
@ -59,13 +81,8 @@ export default function createWordCloud(data) {
fontFamily: 'sans-serif',
fontWeight: 'bold',
//颜色的回调函数, []
color: function () {
// return colors[Math.floor((Math.random() * 8) + 0)];
return 'rgb(' + [
Math.round(Math.random() * 255),
Math.round(Math.random() * 255),
Math.round(Math.random() * 255)
].join(',') + ')';
color: function() {
return newspaper()
}
},
emphasis: {

Loading…
Cancel
Save