Echarts3之字符云WorldCloud

来源:互联网 发布:库克 乔布斯 知乎 编辑:程序博客网 时间:2024/06/01 09:09

字符云功能现在已经不在Echarts的官方示例中了。通过官网里面也找不到对应的API和具体介绍。

如果需要进行开发的话需要单独引用专门的js文件。

下面是下载的百度云链接:worldcloud.js

https://pan.baidu.com/s/1o8JJzcA

正常的Echarts的js文件也是需要引入的。

然后是代码部分:

function world_cloud(cloud) {var option = {tooltip : {},series : [ {type : 'wordCloud',shape:'smooth',gridSize : 2,sizeRange : [ 50, 100 ],rotationRange : [ 46, 80 ],textStyle : {normal : {color : function() {return 'rgb('+ [ Math.round(Math.random() * 160),Math.round(Math.random() * 160),Math.round(Math.random() * 160) ].join(',') + ')';}},emphasis : {shadowBlur : 10,shadowColor : '#333'}},data : cloud} ]};return option;}

传入的cloud参数为字符云的数据,类型为json数组。

然后下面就是正常的Echarts代码。



1 0
原创粉丝点击