From 43cbd4ea1450942383f567d27227e646f2400d12 Mon Sep 17 00:00:00 2001 From: zx <604444282@qq.com> Date: Fri, 3 Dec 2021 09:36:08 +0800 Subject: [PATCH] zx --- src/utils/gol/bubbleWord.js | 47 ++++++++++++------- .../tonalCommunicationPosture/index.vue | 6 +-- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/src/utils/gol/bubbleWord.js b/src/utils/gol/bubbleWord.js index 9fc3d57..3343dd2 100644 --- a/src/utils/gol/bubbleWord.js +++ b/src/utils/gol/bubbleWord.js @@ -17,6 +17,31 @@ function doWordCloud(data) { } return arr1; } +// 气泡大小算法 +function bubbleDivide(val, maxVal, size) { + let percent = val / maxVal * 1.00; + if (0.15= 5 && data.length < 10) { - basicSize = 20; - repulsion = 230; - } - if (data.length >= 10 && data.length < 20) { - basicSize = 30; - repulsion = 150; - } else if (data.length >= 20) { - basicSize = 40; - repulsion = 65; - } + let basicSize = 20; //基础大小 + let repulsion = 90; //斥力因子 // 填充气泡数据数组bubbleData for (let item of data) { // 确保气泡数据条数少于或等于气泡颜色数组大小时,气泡颜色不重复 @@ -102,8 +113,8 @@ function bubbleChart(data = [], format = []) { colorSet.delete(curColor); bakeColor = [...colorSet]; // 气泡大小设置 - let size = (item[format[1]] * basicSize * 2) / maxValue; - if (size < basicSize) size = basicSize; + //let size = (item[format[1]] * basicSize * 2) / maxValue; + let size = bubbleDivide(item[format[1]],maxValue,basicSize); bubbleData.push({ name: item[format[0]], diff --git a/src/views/EventDEC/tonalCommunicationPosture/index.vue b/src/views/EventDEC/tonalCommunicationPosture/index.vue index 48c5afb..222c58b 100644 --- a/src/views/EventDEC/tonalCommunicationPosture/index.vue +++ b/src/views/EventDEC/tonalCommunicationPosture/index.vue @@ -26,14 +26,14 @@ import createOpt from "./opt" import { getAffectionsTime } from "@/api/EventdEC"; export default { name: "tonalCommunicationPosture", - data() { - return { - props: { + props: { id: { type: String, default: "", }, }, + data() { + return { opt: {}, selDatas: [ {