Toggle navigation
栅格条形图
By
哆***嗦
2021-01-28 01:36:21
脚本
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
图表已生成
整理代码
刷新
代码
//当前视口宽度 const nowClientWidth = document.documentElement.clientWidth; // 单位换算方法 function nowSize(val,width=nowClientWidth,initWidth=1920){ return val * (width/initWidth); } let list = [{ name: '猪仓4', value: 26.2 }, { name: '猪仓3', value: 18.0 }, { name: '猪仓2', value: 24.1 }, { name: '猪仓1', value: 24.2 }]; let data = ['猪仓4', '猪仓3', '猪仓2', '猪仓1']; let values = [26.2, 18.0, 24.1, 24.2] option = { backgroundColor:'#002a66', xAxis: { max: 30, splitLine: { show: false }, axisLabel: { show: true, // textStyle: { // fontSize: nowSize(8) // } }, axisTick: { show: true, lineStyle: { "color": "#ccc" } }, axisLine: { show: true, lineStyle: { "color": "#ccc" } }, splitArea: { show: false, } }, grid: { containLabel: true, left: '5%', top: '10%', right: '15%', bottom: '10%' }, yAxis: [{ data: data, inverse: true, axisLine: { show: false }, axisTick: { show: false }, axisLabel: { margin: 10, textStyle: { fontSize: nowSize(15), color: '#ccc' } }, splitArea: { show: false, } }], series: [{ //内 type: 'bar', barWidth: nowSize(20), legendHoverLink: false, symbolRepeat: true, markLine: { data: [ {xAxis: 13, name: '最低警戒值'}, {xAxis: 27, name: '最高警戒值'} ], lineStyle:{ color: '#006dd4' } }, silent: true, itemStyle: { color: { type: 'linear', x: 0, y: 0, x2: 1, y2: 0, colorStops: [{ offset: 0, color: '#00ccff' // 0% 处的颜色 }, { offset: 1, color: '#0061ba' // 100% 处的颜色 }] } }, data: list, z: 1, animationEasing: 'elasticOut' }, { type: 'pictorialBar', animationDuration: 0, symbolRepeat: 'fixed', symbolMargin: nowSize(1), symbol: 'rect', symbolSize: [nowSize(20), nowSize(20)], symbolBoundingData: 30, itemStyle: { normal: { color: 'rgba(0,65,186,0.61)', } }, label: { normal: { show: true, position: 'right', offset: [0, 2], distance: 30, textStyle: { color: '#00ccff', fontSize: 14, } }, }, data: values, z: 0, animationEasing: 'elasticOut' }, { //分隔 type: 'pictorialBar', itemStyle: { color: '#002a66' }, symbolRepeat: 'fixed', symbolMargin: nowSize(10), symbol: 'rect', symbolClip: true, symbolSize: [nowSize(1), nowSize(20)], symbolPosition: 'start', symbolOffset: [0, 0], symbolBoundingData: 30, data: list, z: 2, animationEasing: 'elasticOut' } ] };