Toggle navigation
教师离职趋势预警
By
衰***命
2020-11-10 06:12:24
脚本
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 = ['2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019']; var getvalue =[63,67,72,79,82,83,97,82,71,98]; var getbl = ['4','4','4','4','4','4','5','4','3','5']; //计算最大值 function calMax(arr) { let max = 0; arr.forEach((el) => { el.forEach((el1) => { if (!(el1 === undefined || el1 === '')) { if (max < el1) { max = el1; } } }) }) let maxint = Math.ceil(max / 9.5); //不让最高的值超过最上面的刻度 let maxval = maxint * 10; //让显示的刻度是整数 return maxval; } var max = Math.ceil(calMax([getvalue]) / 100) * 50; var max1 = Math.ceil(calMax([getbl]) / 1) * 1; var option = { grid: { top: 80, bottom: 40, left: 50, right: 50 }, tooltip: { trigger: 'axis', axisPointer: { type: 'none' }, formatter: '{b0}年
{a0}: {c0}人
{a1}: {c1}%', }, legend: { data: [{ name: '离职人数', }, { name: '离职率', icon: 'image://data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACA0lEQVQ4T5WTT2uTQRDGnzFvoO8hiFgwhRbMIVfpQQWb9J9Uj/YTiKJS8Z7Wz1BTP4B3vXhSD6UkmFhovFiNInrx4KVI4kWrljTN7IzMvr7507QH97Kwu/PbmXmeIRy3qtUAIz/HgX1gP72D+Xk+6ikNHb5ZzxHJMglfBVxI4gB1LagrEXORZ27W+mN6AFXCu9IqQQpQR6RsgfAA8L9dFMJrnLt1H0RqoB7gbbkIkgKpAHFwF2CgCAhYRrrG+TvLPcDHl1Ng3Yp+NoADhJFOBoAIvh/seSh5gIBUVE9InqeWXkcZfKg8g7hFqF06jAVJPM5MYi416q83fzVx/UsNjYPfUVkqUOgLzi8tErYfJZHI7gISQhwIgkr2AuZSpwf6a5CFTxuI36hKi0OcJNSrZwH5aqlZBulEgG/nLvc1J+JYxya2n6LZ3gP5Pgg6LJkBAKniTCLxn4BuCS6Me1DNXsTs4RJ2m1j4vOF/9n2AtDojVoKteuU5INfi+saCAE8yk5hNjfpSXvkmbqHR/uMBVkKviQYYkjGSzNSw3xrtWMZIJUBUpTPNM/dqPSPVy0WoGclbN3rY3ftdKRb/kKdvFwadaFZ+X1ol6bdy5EoPE7a61QfnbqwMWzlWvb6eI3ErJO4KxIWRZH6YygR+wJeOG6bDY2nquFPj/jjxYwfn73aOGue/WuJU4CbFxoAAAAAASUVORK5CYII=' }], type: "scroll", right: '15', top: '10', itemGap: 25, itemWidth: 14, itemHeight: 14, textStyle: { fontSize: '13', color: '#656565', }, }, xAxis: [{ data: getname, axisLabel: { margin: 10, color: '#656565', textStyle: { fontSize: 13 }, }, axisLine: { lineStyle: { color: '#333333', } }, axisTick: { show: false }, }], yAxis: [{ type: 'value', min: 0, max: max, // 计算最大值 interval: max / 5, // 平均分为5份 splitNumber: 5, name: '单位:人', nameTextStyle: { color: '#666666', fontSize: 13, padding: [0, 0, 0, 70] }, axisLabel: { formatter: function(value) { num = value if (num && num != 'undefined' && num != 'null') { let numS = num; numS = numS.toString(); numS = numS.replace(/,/gi, ''); return numS; } else { return num; } }, color: '#656565', textStyle: { fontSize: 13 }, }, axisLine: { lineStyle: { color: '#333333', } }, axisTick: { show: false }, splitLine: { lineStyle: { color: 'rgba(209,209,209,.25)', } }, }, { type: 'value', min: 0, max: max1, // 计算最大值 interval: max1 / 5, // 平均分为5份 splitNumber: 5, name: '离职率:%', nameTextStyle: { color: '#666666', fontSize: 13, padding: [0, 0, 0, -70] }, axisLabel: { color: '#656565', textStyle: { fontSize: 13 }, }, axisLine: { lineStyle: { color: '#333333', } }, axisTick: { show: false }, splitLine: { lineStyle: { color: 'rgba(209,209,209,.25)', } } }], series: [{ name: "离职人数", type: 'bar', data: getvalue, barWidth: '25px', itemStyle: { normal: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: '#5CBFFF' }, { offset: 1, color: '#5997FF' }], false), barBorderRadius: [4, 4, 0, 0], } }, markLine: { symbol:"none", data: [{ silent: false, lineStyle: { type: "solid", color: "#FF4D4F", width:2 }, label: { position: 'end', formatter: "预警线", padding:[-30,0,0,-50], color: "#FF4D4F", fontSize:13 }, yAxis: 90 }] }, },{ name: "离职率", type: 'line', data: getbl, yAxisIndex:1, symbol: 'circle', symbolSize: 10, lineStyle: { normal: { width: 4, color: { x: 0, y: 0, x2: 1, y2: 0, colorStops: [{ offset: 0, color: '#00D0BF' // 0% 处的颜色 }, { offset: 1, color: '#05C399' // 100% 处的颜色 }], }, shadowColor: 'rgba(69, 218, 201, 0.38)', shadowBlur: 6, shadowOffsetY: 8, } }, itemStyle: { normal: { color: '#FFF', borderColor: { x: 0, y: 0, x2: 1, y2: 0, colorStops: [{ offset: 0, color: '#00D0BF' // 0% 处的颜色 }, { offset: 1, color: '#05C399' // 100% 处的颜色 }], }, borderWidth: 4 }, }, }] };