diff --git a/src/utils/gol/bubbleWord.js b/src/utils/gol/bubbleWord.js index 2abd678..130e2a9 100644 --- a/src/utils/gol/bubbleWord.js +++ b/src/utils/gol/bubbleWord.js @@ -1,9 +1,8 @@ -require("./bubbleWord/echarts-wordcloud"); +require("./echarts-wordcloud"); let maskImage = new Image(); -maskImage.src = require('@/assets/images/carRound.png') +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 doWordCloud(data) { let arr1 = []; @@ -31,7 +30,15 @@ export default function createWordCloud(data) { showData = words; } return { - tooltip: {}, + tooltip: { + backgroundColor: "#08182F", + color: "#fff", + borderColor: "#3373CC", + textStyle: { + color: "#fff", //设置文字颜色 + }, + extraCssText: "box-shadow: 0px 0px 10px 0px #3373CC;" + }, series: [{ type: 'wordCloud', gridSize: 5, @@ -39,12 +46,12 @@ export default function createWordCloud(data) { rotationRange: [0, 0], //shape: 'circle', maskImage: maskImage, - width: 600, - height: 390, left: 'center', top: 'center', right: null, bottom: null, + width: '100%', + height: '100%', drawOutOfBound: true, textStyle: { fontFamily: 'sans-serif', diff --git a/src/utils/gol/bubbleWord/index.js b/src/utils/gol/bubbleWord/index.js deleted file mode 100644 index fbc4db0..0000000 --- a/src/utils/gol/bubbleWord/index.js +++ /dev/null @@ -1,61 +0,0 @@ - -require("./echarts-wordcloud"); - -// 将后台数据转成数组 -function doWordCloud(data) { - let arr1 = []; - for (let key in data) { - let obj = { name: key, value: data[key] }; - arr1.push(obj); - } - return arr1; -} -//创建词云 -export default function createWordCloud(data) { - let showData = null; - if (Array.isArray(data)) { - showData = data; - } else { - let words = doWordCloud(data); - showData = words; - } - return { - tooltip: {}, - series: [{ - type: 'wordCloud', - gridSize: 12, - sizeRange: [10, 52], - rotationRange: [0, 0], - shape: 'circle', - width: 400, - height: 400, - left: 'center', - top: 'center', - right: null, - bottom: null, - drawOutOfBound: true, - textStyle: { - fontFamily: 'sans-serif', - fontWeight: 'bold', - color: function () { - return 'rgb(' + [ - Math.round(Math.random() * 255), - Math.round(Math.random() * 255), - Math.round(Math.random() * 255) - ].join(',') + ')'; - } - }, - emphasis: { - textStyle: { - shadowBlur: 100, - shadowColor: '#333' - } - }, - data: showData - // { - // name: 'Sam S Club', - // value: 10000, - // } - }] - } -} \ No newline at end of file diff --git a/src/utils/gol/bubbleWord/echarts-wordcloud.js b/src/utils/gol/echarts-wordcloud.js similarity index 100% rename from src/utils/gol/bubbleWord/echarts-wordcloud.js rename to src/utils/gol/echarts-wordcloud.js diff --git a/vue.config.js b/vue.config.js index b57d384..201187a 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,7 +1,7 @@ /* * @Author: your name * @Date: 2021-10-20 13:15:16 - * @LastEditTime: 2021-10-26 13:04:29 + * @LastEditTime: 2021-12-10 09:25:37 * @LastEditors: Please set LastEditors * @Description: In User Settings Edit * @FilePath: /data-show/vue.config.js @@ -19,19 +19,7 @@ const postcss = px2rem({ module.exports = { productionSourceMap: false, publicPath: "./", - // devServer: { - // port: "8081", - // proxy: { - // '/sws': {//代理api - // target: "http://cloud.sws010.com",// 代理接口 - // changeOrigin: true,//是否跨域 - // ws: true, // proxy websockets - // pathRewrite: {//重写路径 - // "^/sws": ''//代理路径 - // } - // } - // } - // }, + lintOnSave: false, configureWebpack: config => { if (process.env.NODE_ENV === 'production') { // 配置productionGzip-高级的方式