动态改变eachers图表高_记录eachers自定义基准线的用法

var manufacturerChart = echarts.init(document.getElementById('manufacturer'));

function initManufacturerData(data){

manufacturerChart.clear();

option = {

title: {

bottom: '0',

left:'center',

text: '故障率',

textStyle:{//标题内容的样式

fontSize:14//主题文字字体大小,默认为18px

},

},

tooltip: {

formatter: '{b}: {c} %',

},

grid: {

left: '3%',

right: '8%',

bottom: '10%',

containLabel: true

},

xAxis: {

type: 'value',

boundaryGap: ['20%', '20%'],

min: 0,

axisLabel: {

formatter: '{value} %'

}

},

yAxis: {

type: 'category',

data: data.yaxisData,

// y轴的字体样式

axisLabel: {

show: true,

textStyle: {

color: '#fff',

fontSize:10

}

},

},

series: [

{

name:'故障率',

type: 'bar',

cursor:"default",

barMaxWidth:'25',

data: data.flautData,

itemStyle:{

normal:{

color:'#93bc58',

label: {

show: true, //开启显示

position: 'right', //在上方显示

textStyle: { //数值样式

color: 'black',

fontSize: 12

},

formatter: '{c}%',

}

}

},

markLine : {//基准线

lineStyle:{

width :2

},

data : [ { name: '平均故障率', xAxis: data.aveFloatRate } ],

itemStyle:{

normal:{

color:'#c23531'

}

},

}

}

]

};

//自定义最大坐标值

if(data.aveFloatRate-0 > data.flautData[0]-0){

option.xAxis.max = data.aveFloatRate;

}

manufacturerChart.setOption(option);

}


版权声明:本文为weixin_34768798原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。