1.安装
npm install echarts

npm install echarts-wordcloud
注意版本:echarts版本5只能和wordcloud版本2的一起使用 ;echarts版本4只能和wordcloud版本1的一起使用

2.在main.js引入
import * as echarts from 'echarts'
Vue.prototype.$echarts = echarts
require('echarts-wordcloud')
3.使用
<template>
<div id="echartsWordcloud" style="width:200px;height:200px;background-color:#0d071f"></div>
</template>
<script>
var run = 999
var createRandomItemStyle2 = function () {
var colorArr = ['#fda67e', '#81cacc', '#cca8ba', "#88cc81", "#82a0c5", '#fddb7e', '#735ba1', '#bda29a', '#6e7074', '#546570', '#c4ccd3'];
var flag = parseInt(Math.random() * 10);
return {
normal: {
fontFamily: '微软雅黑',
color:colorArr[flag]
}
};
}
var createRandomItemStyle1 = function (params) {    //此方法与下方配置中的第一个textStle下的color等同
var colors = ['#fda67e', '#81cacc', '#cca8ba', "#88cc81", "#82a0c5", '#fddb7e', '#735ba1', '#bda29a', '#6e7074', '#546570', '#c4ccd3'];
return colors[parseInt(Math.random() * 10)];
}
export default{
data() {
return {
data : [{name: "小区",value: "283"},{name: "留言板",value: "101"},{name: "业主",value: "148"},
{name: "同学",value: "283"},{name: "老师",value: "101"},{name: "话痨",value: "148"}
]
}
},
mounted(){
this.initEcharts(this.data)
},
methods:{
initEcharts(data){
let echartsWordcloud = this.$echarts.init(document.getElementById("echartsWordcloud"));
let option = {
title: {
text: "标题",
x: "center"
},
// backgroundColor: "#fff",
series: [
{
type: "wordCloud",
//用来调整词之间的距离
gridSize: 10,
//用来调整字的大小范围
sizeRange: [14, 26],
rotationRange: [0, 0],
//随机生成字体颜色
// 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(',') + ')';
// }
// },
// 也可以自己定制颜色
textStyle: {
fontFamily: '微软雅黑',
color: function () {
var colors = ['#fda67e', '#81cacc', '#cca8ba', "#88cc81", "#82a0c5", '#fddb7e', '#735ba1', '#bda29a', '#6e7074', '#546570', '#c4ccd3'];
return colors[parseInt(Math.random() * 10)];
}
},
// textStyle: {
// color: function() {
// return (
// "rgb(" +
// Math.round(Math.random() * 255) +
// ", " +
// Math.round(Math.random() * 255) +
// ", " +
// Math.round(Math.random() * 255) +
// ")"
// );
// }
// },
//位置相关设置
left: "center",
top: "center",
right: null,
bottom: null,
width: "100%",
height: "100%",
//数据
data: data
}
]
};
echartsWordcloud.setOption(option);
//点击事件
echartsWordcloud.on("click",function(e){
alert(e)
})
}
}
}
</script>
原文链接:https://blog.csdn.net/qq_37550440/article/details/116779706

热词cloud-EChart安装的更多相关文章

  1. Python 爬取 热词并进行分类数据分析-[App制作]

    日期:2020.02.14 博客期:154 星期五 [本博客的代码如若要使用,请在下方评论区留言,之后再用(就是跟我说一声)] 所有相关跳转: a.[简单准备] b.[云图制作+数据导入] c.[拓扑 ...

  2. 新闻热词:从爬虫到react native应用

    背景 由于只想了解当天新增的top热词,减少过多信息干扰,打算做一款app实现这个功能. 架构: 热词抓取 -> mysql <=> nodejs <=> nginx & ...

  3. 阿里舆情︱舆情热词分析架构简述(Demo学习)

    本节来源于阿里云栖社区,同时正在开发一个舆情平台,其中他们发布了一篇他们所做的分析流程,感觉可以作为案例来学习.文章来源:觉民cloud/云栖社区 平台试用链接:https://prophet.dat ...

  4. 离线语音Snowboy热词唤醒+ 树莓派语音交互实现开关灯

    离线语音Snowboy热词唤醒 语音识别现在有非常广泛的应用场景,如手机的语音助手,智能音响(小爱,叮咚,天猫精灵...)等. 语音识别一般包含三个阶段:热词唤醒,语音录入,识别和逻辑控制阶段. 热词 ...

  5. Python 爬取 热词并进行分类数据分析-[云图制作+数据导入]

    日期:2020.01.28 博客期:136 星期二 [本博客的代码如若要使用,请在下方评论区留言,之后再用(就是跟我说一声)] 所有相关跳转: a.[简单准备] b.[云图制作+数据导入](本期博客) ...

  6. Python 爬取 热词并进行分类数据分析-[热词分类+目录生成]

    日期:2020.02.04 博客期:143 星期二   [本博客的代码如若要使用,请在下方评论区留言,之后再用(就是跟我说一声)] 所有相关跳转: a.[简单准备] b.[云图制作+数据导入] c.[ ...

  7. Lucene热词显示并选择

    利用Jquery easyui里的autocomplete(1.10.0版本) 的异步请求(remot.html) 添加引用 <script src="~/Scripts/jquery ...

  8. Lucene热词统计

    1.建立搜索表 ID KeyWords DT 搜索一次保存一次,id才用guid提高效率 /// <summary> /// 搜索数据 /// </summary> /// & ...

  9. 热词统计以及Quartz.net的简单使用

    一.热词统计 方案一: 设计一个表:ID       KeyWord     Count 当用户再输入框中查询的时候,我们就往表中插入数据,在插入之前首先判断是否已经存在keyword,存在的话,让C ...

  10. 返回模式有流式(streaming)和整体(total) 热词词表解决方案

    重要术语说明_语音识别(ASR)_智能语音交互-阿里云  https://help.aliyun.com/document_detail/72238.html 返回模式(response mode) ...

随机推荐

  1. Git的基本使用(只是基本使用)

    git上传 1.克隆到本地 git clone + git项目地址 2.添加文件 git add * 添加所有文件到本地仓库 3.查看状态 git status 4.标记 git commit -m ...

  2. python 快速启动http监听服务

    python3 [root@vm10-20-9-45 ~]# python3 -m http.server 2378 Serving HTTP on 0.0.0.0 port 2378 (http:/ ...

  3. 选课系统V1.0

    tree . . ├── bin │   ├── __init__.py │   └── start.py #启动文件 ├── conf │   ├── __init__.py │   └── set ...

  4. docker查看容器元数据、详细信息,查看容器挂载的目录

    通过 docker inspect 175f 查看容器元数据 我们启动docker的时候会挂载目录,但是挂载之后 后面就忘了 如何查看挂载的目录位置呢 可以通过 docker inspect a7a6 ...

  5. SpringBoot整合Light Security框架

    官方git地址:https://gitee.com/itmuch/light-security/tree/master 引入maven <dependency> <groupId&g ...

  6. xcode导出手机的崩溃日志

    1.第一步将手机连接xcode 点击window 2.选择 Device and Simulators 3.选择View Device Logs 4.导出文件 右键鼠标选择Export Logs 5. ...

  7. 【LeetCode】530. Minimum Absolute Difference in BST 解题报告(Java & Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 Java解法 Python解法 日期 题目地址:ht ...

  8. 使用.NET 6开发TodoList应用(11)——使用FluentValidation和MediatR实现接口请求验证

    系列导航及源代码 使用.NET 6开发TodoList应用文章索引 需求 在响应请求处理的过程中,我们经常需要对请求参数的合法性进行校验,如果参数不合法,将不继续进行业务逻辑的处理.我们当然可以将每个 ...

  9. McGan: Mean and Covariance Feature Matching GAN

    目录 概 主要内容 Mean Matching IPM prime dual Covariance Feature Matching IPM prime dual 算法 代码 Mroueh Y, Se ...

  10. <学习opencv>图像、视频和数据文件

    /*=========================================================================*/ // openCV中的函数 /*====== ...