|
|
|
@ -1,11 +1,12 @@
|
|
|
|
|
/*
|
|
|
|
|
* @Author: your name
|
|
|
|
|
* @Date: 2021-10-21 11:36:36
|
|
|
|
|
* @LastEditTime: 2021-10-29 12:46:18
|
|
|
|
|
* @LastEditTime: 2021-10-29 21:30:46
|
|
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
|
|
* @Description: In User Settings Edit
|
|
|
|
|
* @FilePath: /data-show/src/utils/gol/bubbleWord.js
|
|
|
|
|
*/
|
|
|
|
|
import {compare} from "./dataTool"
|
|
|
|
|
// 将后台数据转成数组
|
|
|
|
|
function doWordCloud(data) {
|
|
|
|
|
let arr1 = [];
|
|
|
|
@ -93,6 +94,7 @@ function bubbleChart(data = [], format = []) {
|
|
|
|
|
// 创建词云图
|
|
|
|
|
export default function createWordCloud(obj) {
|
|
|
|
|
let words = doWordCloud(obj);
|
|
|
|
|
words.sort(compare('value'));
|
|
|
|
|
let bubble = bubbleChart(words, ['name', 'value']);
|
|
|
|
|
return {
|
|
|
|
|
animationEasingUpdate: 'bounceIn',
|
|
|
|
@ -119,6 +121,7 @@ export default function createWordCloud(obj) {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
force: {
|
|
|
|
|
gravity:0.2,
|
|
|
|
|
repulsion: bubble.repulsion,
|
|
|
|
|
edgeLength: 10
|
|
|
|
|
},
|
|
|
|
|