Toggle navigation
图例换行
By
衰***命
2020-09-14 09:31:51
脚本
16
21
作品使用的第三方脚本
数据管理
上传数据
支持小于 5M 任意格式(csv, xlsx, json, xml, ...)的数据文件
上传后可以通过生成的文件链接异步获取托管的数据。
历史数据
0 条
无历史数据
代码修改记录
信息提示
保存作品
对当前截图不满意?你还可以
上传本地截图
重新截图
作品名称
作品描述
标签
geo
grid
legend
markLine
markPoint
bar
effectScatter
line
lines
map
timeline
title
toolbox
tooltip
visualMap
作品默认版本
最新
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
20:11:45
图表已生成
整理代码
刷新
代码
var getname =['未出国进修/合作科研的学生','本科生','硕士',' 博士'] var getvalue = [55,20,15,10] var data = []; for (var i = 0; i < getname.length; i++) { data.push({ name: getname[i], value: getvalue[i] }) } var sumvalue = 0; for (var i = 0; i < getname.length; i++) { sumvalue += getvalue[i]; } var rich = { name: { color: "#666666", fontSize: 14, padding: [6, 10], align: 'center' }, percent: { color: "#666666", align: 'center', fontSize: 14, padding: [5, 10] }, hr: { borderColor: '#DFDFDF', width: '100%', borderWidth: 0.5, height: 0, } } var colorList = [{ x: 0, y: 0, x2: 0, y2: 1, colorStops: [{ offset: 0, color: '#81BEFF' // 0% 处的颜色 }, { offset: 1, color: '#3295FF' // 100% 处的颜色 }], }, { x: 0, y: 0, x2: 0, y2: 1, colorStops: [{ offset: 0, color: '#48D69E' // 0% 处的颜色 }, { offset: 1, color: '#70F3C2' // 100% 处的颜色 }], }, { x: 0, y: 0, x2: 0, y2: 1, colorStops: [{ offset: 0, color: '#FEAE5C' // 0% 处的颜色 }, { offset: 1, color: '#FECC84' // 100% 处的颜色 }], }, { x: 0, y: 0, x2: 0, y2: 1, colorStops: [{ offset: 0, color: '#A1AEFF' // 0% 处的颜色 }, { offset: 1, color: '#9686F3' // 100% 处的颜色 }], }, { x: 0, y: 0, x2: 0, y2: 1, colorStops: [{ offset: 0, color: '#FECAFF' // 0% 处的颜色 }, { offset: 1, color: '#D47FE6' // 100% 处的颜色 }], }, { x: 0, y: 0, x2: 0, y2: 1, colorStops: [{ offset: 0, color: '#7EEAE6' // 0% 处的颜色 }, { offset: 1, color: '#1ABBB5' // 100% 处的颜色 }], }]; option = { tooltip: { trigger: 'item', formatter: "{b}: {c}个
占比: {d}%" }, legend: { type: "scroll", pageIconColor: '#00DFFF', //翻页下一页的三角按钮颜色 pageIconInactiveColor: '#aaa', //翻页(即翻页到头时) pageIconSize: 11, //翻页按钮大小 pageFormatter: '',//隐藏翻页的数字 pageButtonItemGap: -6,//翻页按钮的两个之间的间距 orient: 'vertical', height:'80%', right: '20', top: 'center', itemWidth: 18, itemHeight: 18, data: getname, formatter: function(name) { for (var i = 0; i
1)//如果类目项的文字大于7, { var temp = "";//每次截取的字符串 var start = 0;//开始截取的位置 var end = maxLength;//结束截取的位置 temp = name.substring(start, end)+'\n'+name.substring(end, valLength) ret += temp; //凭借最终的字符串 return '{ret|' + ret+ '}{rate|' + (100*getvalue[i]/sumvalue).toFixed(2) + '%}' } else{ return '{name|' + name+ '}{rate|' + (100*getvalue[i]/sumvalue).toFixed(2) + '%}' } } } }, textStyle: { rich: { name: { fontSize: 15, fontWeight: 400, width: 150, height: 35, padding:[0,0,0,5], color:'#666' }, ret: { fontSize: 15, fontWeight: 400, width: 150, height: 6, padding:[-15,0,0,5], color:'#666' }, rate: { fontSize: 15, fontWeight: 500, height: 35, width: 40, align:'right', color:'#666' } } } }, series:[ { itemStyle: { normal: { color: function(params) { return colorList[params.dataIndex] } } }, type: 'pie', radius: ['40%', '60%'], center: ["25%", "50%"], labelLine: { normal: { show:false, } }, label: { normal: { show:false, } }, data: data }] }