Toggle navigation
明了显示百分比
By
旺***湾
2019-08-21 03:08:31
脚本
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 data = [70, 34, 60, 70, 34, 60, 78, 69, 78, 69]; var sum = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100]; var titlename = ['总部', '绵阳知商谷', '重庆分公司', '广州子公司', '佛山分公司', '江门分公司', '金华分公司', '青岛分公司', '海口分公司', '重庆分公司']; var myColor = ['#1089E7', '#F57474', '#56D0E3', '#E176B5', '#9FBB5A', '#BDAAE1', '#64B8F0', '#8B78F6', '#F8B448', '#13AAAC']; option = { //图标位置 grid: { top: '0', right: '100', bottom: '0', left: '110', containLabel: true }, // x 轴不显示 xAxis: { show: false }, // y 轴 yAxis: [{ axisTick: 'none', axisLine: 'none', offset: '0', axisLabel: { color: '#333', formatter: (value, index) => { return [ '{title|' + value + '} ' ] }, rich: { title: { color: '#333', } } }, data: titlename, inverse: true, }, { axisTick: 'none', axisLine: 'none', data: [], inverse: true, } ], series: [{ name: '总次数', type: 'bar', yAxisIndex: 0, data: sum, barWidth: 10, label: { normal: { show: true, formatter: (value, index) => { return [ '{title|' + value.value + '%' + '} ' ] }, rich: { title: { color: '#333', align: 'right', } }, position: 'right', textStyle: { color: '#333', fontSize: '16', } } }, itemStyle: { normal: { barBorderRadius: 20, color: function(params) { var num = myColor.length; return myColor[params.dataIndex % num] }, opacity: 0.3 } } }, { name: '次数占比', type: 'bar', yAxisIndex: 1, data: data, barWidth: 10, label: { normal: { show: true, position: 'right', textStyle: { color: '#333', fontSize: '16', } } }, itemStyle: { normal: { barBorderRadius: 20, color: function(params) { var num = myColor.length; return myColor[params.dataIndex % num] }, } } }, ] };