码迷,mamicode.com
首页 > 其他好文 > 详细

echarts 文字标签云图实现方法

时间:2014-12-10 12:48:11      阅读:565      评论:0      收藏:0      [点我收藏+]

标签:des   style   http   io   ar   color   os   sp   for   

加载ECHART相关JS

var myChart = echarts.init(document.getElementById(‘ChartOwnFansTag‘)); 

var option = {

series : [

{

                                                type:‘force‘,

name : "Force tree",

ribbonType: false,

itemStyle: {

normal: {

label: {

show: true,

rotate:false,

textStyle:{ color:‘#ffffff‘,fontSize:12}

},

nodeStyle : {

color:‘rgba(0,0,0,0)‘,//这里是隐藏圆圈

brushType : ‘both‘,

borderWidth : 0

},

linkStyle: {

type: ‘line‘,

strokeColor: ‘rgba(0,0,0,0)‘//这里是隐藏连接线

}

}

},

minRadius : 5,

maxRadius : 20,

coolDown: 0.995,

nodes : [

{id: 0, name:‘adidas‘, value:3, itemStyle: {normal: {label: {textStyle:{ color:Rgba.white[9],fontSize:24}}}}},//这里根据数据量设置【value/圆大小】【color/字颜色】【fontSize/字大小】

{id: 1, name:‘品牌‘, value:2.5, itemStyle: {normal: {label: {textStyle:{ color:Rgba.white[8],fontSize:22}}}}},

{id: 2, name:‘代言人‘, value:2, itemStyle: {normal: {label: {textStyle:{ color:Rgba.white[7],fontSize:20}}}}},

{id: 3, name:‘热话题‘, value:1.5, itemStyle: {normal: {label: {textStyle:{ color:Rgba.white[5],fontSize:14}}}}},

{id: 4, name:‘印象‘, value:1, itemStyle: {normal: {label: {textStyle:{ color:Rgba.white[3],fontSize:12}}}}},

{id: 5, name:‘公益‘, value:.5, itemStyle: {normal: {label: {textStyle:{ color:Rgba.white[2],fontSize:6}}}}}

],

links: [

                                                        //这里注意,source必须全部为0(及上面最大值的ID),这样就实现一圈小圆围着中间一个圆的效果

{source: 0, target: 1},

{source: 0, target: 2},

{source: 0, target: 3},

{source: 0, target: 4},

{source: 0, target: 5}

]

}

]

};

// 为echarts对象加载数据 

myChart.setOption(option); 



最终效果bubuko.com,布布扣


echarts 文字标签云图实现方法

标签:des   style   http   io   ar   color   os   sp   for   

原文地址:http://my.oschina.net/u/2287567/blog/354335

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!