Toggle navigation
将bar的lable中postion固定住,让我的价格在背景bar右边显示
By
浩***爹
2019-11-01 07:58:03
脚本
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
图表已生成
整理代码
刷新
代码
option = { backgroundColor:'black', title: { text: '各医院住院收入', textStyle: { color: '#73d3f3', fontFamily: 'MicrosoftYaHei', }, left: '35%', top: 30, }, tooltip: { /*trigger: 'axis',*/ axisPointer: { type: 'shadow' }, /* formatter:'{b}
{c}元',*/ }, grid: { containLabel: true, top: 70, right: 80, bottom: 5, }, xAxis: { show: false, type: 'value', axisLine: { show: false }, axisTick: { show: false } }, yAxis: { type: 'category', data: ['良乡医院', '幼父保洁院', '中医院', '区医院'], splitLine: { show: false }, axisLabel: { textStyle: { color: '#fff' }, }, axisLine: { show: false }, axisTick: { show: false }, offset: 30, max: 3, }, series: [{ name: '最大值', z: 1, type: 'bar', barWidth: 20, data: [23000, 23000, 23000, 23000], barGap: '-100%', itemStyle: { normal: { color: '#0d2253' } }, }, { name: '钱总数', type: 'bar', data: [8000, 9000, 20000, 10000], barWidth: 20, smooth: true, label: { normal: { show: true, position: 'righ', offset: [5, 4], formatter: '{c}元', textStyle: { color: 'white', fontSize: 13 }, } }, itemStyle: { normal: { //实现不同颜色的渐变 color: function(params) { //我这边就5个柱子,就5个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值. var colorList = [ ['rgba(42,107,205,0)', 'rgba(51,246,248,0.96)'], ['rgba(42,107,205,0)', 'rgba(51,246,248,0.96)'], ['rgba(42,107,205,0)', 'rgba(51,246,248,0.96)'], ['rgba(42,107,205,0)', 'rgba(51,246,248,0.96)'], ]; var index = params.dataIndex; if (params.dataIndex >= colorList.length) { index = params.dataIndex - colorList.length; } return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ offset: 0, color: colorList[index][0] }, { offset: 1, color: colorList[index][1] }, ]); }, } } }, ] };