您的位置:首页 > 其它

百度echarts实现标识线或者基准线实现方法

2017-09-19 09:39 204 查看
先看看效果图,玩了两天还有太多没玩出来

刚开始学的时候看官网文档总是迷迷糊糊的,一直在到处搜索,最终得到此效果

但是还有个小问题,这三条线,当鼠标移动上去的时候文字会隐藏,不知道为什么

看看实现这三条线的js

data: [

{
name: '蓝色预警',
yAxis: 187,
itemStyle : {

normal : {
lineStyle:{
color:'yellow',

type:'dotted'  //'dotted'虚线 'solid'实线
},

label:{
show: true,
formatter: '{b} : {c}' ,
color:"black",
position: 'middle',/*****文字显示的位置**********/

},
labelLine :{show:true}
}
}

},

[
{
name: '黄色预警',
coord: [10, 20]
},
{
coord: [20, 30]
}
],
{
name: '黄色预警',
yAxis: 310,
itemStyle : {

normal : {
lineStyle:{
color:'blue',

type:'dotted'  //'dotted'虚线 'solid'实线
},

label:{
show: true,
formatter: '{b} : {c}' ,
color:"black",
position: 'middle',
align:"left",
align:"top"

},
labelLine :{show:true}
}
}

},

[
{
name: '红色预警',
coord: [10, 20]
},
{
coord: [20, 30]
}
],
{
name: '红色预警',
yAxis: 450,

itemStyle : {

normal : {
lineStyle:{
color:'red',

type:'dotted'  //'dotted'虚线 'solid'实线
},

label:{
show: true, //是否正常显示标签
formatter: '{b} : {c}' ,
lineHeight:12,
color:"black",
position: 'middle',//标签显示的位置 'start' 线的起始点。'middle' 线的中点。'end' 线的结束点。
align:"left",
padding: [3, 4, 5, 6],
verticalAlign:"bottom",
offset:[30,40],
animation:{
show: false

}

},

4000
labelLine :{show:true}
}
}

},

[
{
name: '红色预警',
coord: [10, 20]
},
{
coord: [20, 30]
}
]

],

},


这样就画出的需要的标示线,想画多少条就在data中添加相应的数据就可以。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐