echarts2的官方API里是带有字符云的,但到了echarts3就被从官网上移除了,想要使用的话可以从github上下载:

下载地址:https://github.com/ecomfe/echarts-wordcloud

使用方法:

1.依次引入echarts.min.js和echarts-wordcloud.min.js(文件位置:下载的压缩包下dist/echarts-wordcloud.min.js);
<script src="echarts.min.js"></script>
<script src="echarts-wordcloud.min.js"></script>

2.自己翻译的简易说明(供参考)

width---字符云画布宽度

height---字符云画布宽度

maskImage---剪影图像,白色区域将被排除在绘图文本之外,形状选项将继续应用为云的形状。

如:

var maskImage = new Image();
//var world_option = world_cloud(eval('(' + '${cloud}' + ')'),maskImage);
var world_option = world_cloud(data,maskImage);
maskImage.onload = function () {
world_option.series[0].maskImage
worldChart.setOption(world_option);
}
maskImage.src = 'img/ren1.png';

gridSize---字符之间的间距(int)

sizeRange---字符的范围(array)
rotationRange---字符倾斜的角度(array)
 
3.实例:
var chart = echarts.init(document.getElementById('main'));

chart.setOption({
...
series: [{
type: 'wordCloud', // The shape of the "cloud" to draw. Can be any polar equation represented as a
// callback function, or a keyword present. Available presents are circle (default),
// cardioid (apple or heart shape curve, the most known polar equation), diamond (
// alias of square), triangle-forward, triangle, (alias of triangle-upright, pentagon, and star. shape: 'circle', // A silhouette image which the white area will be excluded from drawing texts.
// The shape option will continue to apply as the shape of the cloud to grow. maskImage: maskImage, // Folllowing left/top/width/height/right/bottom are used for positioning the word cloud
// Default to be put in the center and has 75% x 80% size. left: 'center',
top: 'center',
width: '70%',
height: '80%',
right: null,
bottom: null, // Text size range which the value in data will be mapped to.
// Default to have minimum 12px and maximum 60px size. sizeRange: [12, 60], // Text rotation range and step in degree. Text will be rotated randomly in range [-90, 90] by rotationStep 45 rotationRange: [-90, 90],
rotationStep: 45, // size of the grid in pixels for marking the availability of the canvas
// the larger the grid size, the bigger the gap between words. gridSize: 8, // set to true to allow word being draw partly outside of the canvas.
// Allow word bigger than the size of the canvas to be drawn
drawOutOfBound: false, // Global text style
textStyle: {
normal: {
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(',') + ')';
}
},
emphasis: {
shadowBlur: 10,
shadowColor: '#333'
}
}, // Data is an array. Each array item must have name and value property.
data: [{
name: 'Farrah Abraham',
value: 366,
// Style of single text
textStyle: {
normal: {},
emphasis: {}
}
}]
}]
});

在echarts3中使用字符云的更多相关文章

  1. vue怎么引入echats并使用 (柱状图 字符云)

    安装 npm install echarts --save 下面看一下如何简单的使用: 在main.js中引入(全局引入) // 引入echarts import echarts from 'echa ...

  2. Linux 的简单命令以及在idea中配置码云

    Linux 的简单命令: ls(list)功能:列出目录内容 cd(change directory)功能:切换目录 touch 1.txt 在当前目录创建一个文件1.txt clear:清除屏幕 p ...

  3. WEB开发中的字符集和编码

    html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,bi ...

  4. 解决MVC中JSON字符长度超出限制的异常

    解决MVC中JSON字符长度超出限制的异常 解决方法如下: <configuration> <system.web.extensions> <scripting> ...

  5. echarts之字符云tooltip显示混乱问题的解决办法

    echarts字符云中tooltip显示混乱主要表现为一下两点: 1.字体与其显示框内容不对应鼠标识别错误 解决思路: 就是option里的数据要对value降序排序(这一点很关键,是必须的一步) 把 ...

  6. MeshLab中进行点云配准

    MeshLab是一个开源.可移植和可扩展的三维几何处理系统,主要用于交互处理和非结构化编辑三维三角形网格.它支持多种文件格式: import:PLY, STL, OFF, OBJ, 3DS, COLL ...

  7. div中的字符换行

    div中的字符换行 转载自:http://blog.sina.com.cn/s/blog_6a79bc480100tizi.html   1.强制不换行,同时以省略号结尾. <div style ...

  8. 在OneThink(ThinkPHP3.2.3)中整合阿里云OSS的PHP-SDK2.0.4,实现Web端直传,服务端签名直传并设置上传回调的实现流程

    在OneThink(ThinkPHP3.2.3)中整合阿里云OSS的PHP-SDK2.0.4,实现本地文件上传流程 by shuijingwan · 2016/01/13 1.SDK安装 github ...

  9. .NET Framework 中的字符编码

    字符是可用多种不同方式表示的抽象实体. 字符编码是一种为受支持字符集中的每个字符进行配对的系统,配对时使用的是表示该字符的某些值. 例如,摩尔斯电码是一种为罗马字母表中的每个字符进行配对的字符编码,配 ...

随机推荐

  1. 我是如何确认线上CLOSE_WAIT产生的原因及如何解决的。

    1.阐述 内部架构:Tomcat应用程序---> nginx ---> 其他Tomcat应用程序,内部Tomcat应用通过nginx调用其他应用. HTTP插件:HttpClient 4. ...

  2. 关于a标签颜色的探索

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. C#生成缩略图 (通用模式)

    用数据库保存图片的路径和文件名称,把文件保存在文件夹中.//保存在数据库中的文件路径ArrayList arrFilePath=new ArrayList();arrFilePath=myCommon ...

  4. 微信小程序开发之scroll-view

    本文主要介绍通过scroll-view实现回至顶部,如下效果 一.页面代码 顶部的工具栏放一个查找按钮,滚动区域实现分页,目的就是为了点击上一页\下一页时,自动回到顶部. scroll-view必须指 ...

  5. Ant Design Pro 学习三 新建组件

    在 src/components 下新建一个以组件名命名的文件夹,注意首字母大写 在使用组件时,默认会在 index.js 中寻找 export 的对象,如果你的组件比较复杂,可以分为多个文件,最后在 ...

  6. Python之旅本地环境搭建

    刚开始学习Python, 之后将会把Python相关的一些学习在此记录下来 . 毋庸置疑 ,我们需要先搭建本地开发环境, 为之后的Python开发做准备 ,这篇文章 ,将环境的搭建记录下来 第一步: ...

  7. JVM垃圾收集器整理

    概述 垃圾收集器是jvm实现内存回收的具体实现.本次分享要介绍的7种垃圾收集器的作用区域及其之间的关系如下图: 注: 如果2个垃圾收集器之间有连线,表示可以搭配使用 垃圾收集器并没有最好的,只有针对不 ...

  8. Virtualbox虚拟机安装与设置

    Virtualbox与VMware类似,都是虚拟机软件,在win10下安装Virtualbox直接默认安装即可.版本:VirtualBox-5.2.0-118431-Win.exe 安装完成后,点击左 ...

  9. centos 虚拟机桥接

    /etc/sysconfig/network-scripts/ifcfg-eth0 配置文件 vi ifcfg-eth0 DEVICE=eth0HWADDR=00:0C:29:B8:B5:65TYPE ...

  10. ATM机运行代码

    实现代码: import java.util.Scanner; public class Atm { public static void main(String[] args) { // TODO ...