深圳全飞鸿
标题:
echart 之bar的一种案例
[打印本页]
作者:
zhgc
时间:
2021-12-18 17:41
标题:
echart 之bar的一种案例
微信图片_20211218173908.png
(134.35 KB, 下载次数: 461)
下载附件
2021-12-18 17:39 上传
function char2() {
var myChart = echarts.init($("#echart5")[0]);
option = {
//backgroundColor: '#00265f',
tooltip : {
trigger: 'axis',
axisPointer : { // 坐标轴指示器,坐标轴触发有效
type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {show:'true',borderWidth:'0'},
legend: {
data:['缺勤','在岗','上班未上岗'],
textStyle : {
fontSize: 12,
color : '#ffffff'
},
icon:"rect",
itemWidth:10,
itemHeight:10,
bottom:"0%"
},
calculable :false,
xAxis : [
{
type : 'value',
show:false,
axisLabel: {
show: true,
textStyle: {
color: '#fff'
}
},
splitLine:{
"show": false,
lineStyle:{
color:['#f2f2f2'],
width:0,
type:'solid'
}
}
}
],
yAxis : [
{
type : 'category',
data : ['组装一课','组装二课','组装三课','组装四课','组装五课'],
axisLabel: {
show: true,
textStyle: {
color: 'rgba(255,255,255,.5)',
fontSize:'12',
}
},
splitLine:{
lineStyle:{
width:0,
type:'solid'
}
}
}
],
series : [
{
name:'缺勤',
type:'bar',
stack: '总量',
itemStyle : {
normal: {
label : {show: true, position: 'insideRight'},
color:'#623AD1',
opacity: 1,
barBorderRadius: 6,
}},
data:[21, 17, 13,8,13]
},
{
name:'在岗',
type:'bar',
stack: '总量',
itemStyle : {
normal: {
label : {show: true, position: 'insideRight'},
color:'#2f89cf',
opacity: 1,
barBorderRadius: 6,
}},
data:[122, 93, 117,100,98]
},
{
name:'上班未上岗',
type:'bar',
stack: '总量',
itemStyle : {
normal: {
label : {show: true, position: 'insideRight'},
color:'#c23531',
opacity: 1,
barBorderRadius: 6,
}},
data:[21,8,13,25,17]
},
]
};
myChart.setOption(option);
window.addEventListener('resize', function () {myChart.resize();})
}
复制代码
欢迎光临 深圳全飞鸿 (http://www.nagomes.com/disc/)
Powered by Discuz! X3.2