echart多个柱状图 设置y轴显示_echarts柱状图轻松实现分别采用两个不同单位的y轴...

echarts柱状图轻松实现分别采用两个不同单位的y轴:

796714743cc70640632433259404fb2e.png

秘籍:

787339cc23f0fd26edacdba86bd295e5.png

代码

// 基于准备好的dom,初始化echarts实例

var colors = ['#0089FF','#B865DF',/*'#5ADF63','#FFDD00',*/'#224666', '#675bba'];

// 指定图表的配置项和数据

option = {

/*grid:{

y:'25%'},*/

color: colors,

/* title: {

text: '各医院指标对比情况',

left: 16,

textStyle: {

fontSize: 18,

color:'#0089FF'

}

},*/

tooltip: {

trigger: 'axis',

axisPointer: {

type: 'cross',

crossStyle: {

color: '#999'

}

}

},

legend: {

data:['组数','CMI'],

x:'80%'

},

xAxis: [

{

type: 'category',

data: arr,

axisPointer: {

type: 'shadow'

},

axisLine: {

show: true,

/* lineStyle: {

color: '#05edfc'

}*/

},

axisLabel: {

show: true,

/* color: '#fff',*/

fontSize: 12,

interval: 0,

formatter:function(value)

{

return value;

}

//fontWeight: 'bold'

}

},

],

yAxis: [

{

type: 'value',

name: '组数整体指标',

position: 'left',

splitLine:{show: true},

axisLine: {

show: false,

/* lineStyle: {

color: '#E7E7E7'

}*/

},

axisLabel: {

show:true,

showMinLabel:true,

showMaxLabel:true,

formatter: '{value}'

},

},

{

type: 'value',

name: 'CMI',

position: 'right',

splitLine:{show: true},

axisLine: {

show: false,

/* lineStyle: {

color: '#E7E7E7'

}*/

},

axisLabel: {

show:true,

showMinLabel:true,

showMaxLabel:true,

formatter: '{value}'

},

},

],

series: [

{

name:'组数',

type:'bar',

barWidth : 20,

data:arr2,

yAxisIndex: 0,

/* markPoint : {

data : [

{type : 'max', name: '最大值'},

{type : 'min', name: '最小值'}

]

}*/

},

{

name:'CMI',

type:'bar',

barWidth : 20,

data:arr3,

yAxisIndex: 1,

/* markPoint : {

data : [

{type : 'max', name: '最大值'},

{type : 'min', name: '最小值'}

]

}*/

}

]

};

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值