let option ={
legend:{
show:true|false //默认true,控制是否展示图例
type:'plain|scroll' //默认plain,当图例较多时可使用scroll
left:10|center|百分比 //距离容器左侧的距离
right:10|center|百分比 //距离容器右侧的距离
top:10|center|百分比 //距离容器上侧的距离
bottom:10|center|百分比 //距离容器下侧的距离
width:100 //图例组件的宽度,默认自适应。
height:100 //图例组件的宽度,默认自适应。
itemWidth:100 //每项图例的宽度,文字前面的色块
itemHeight:100 //每项图例的高度,文字前面的色块
itemGap:10 //图例之间的间隔
orient:'horizontal'|'vertical' //水平或垂直,默认水平
formatter:function(name){return 'formatter' + name} //格式化图例文本,name为每一项图例的名称
formatter:function(name){ return "{a|"+name +"} {b|"+other +"}" } //{styleName|text content text content}使用这种形式配合富文本
textStyle{ //控制文本的样式
color:'#fff' //文本颜色
fontSize: 12 //文本字体大小
rich:{ //富文本,利用富文本样式配合formatter,可以在标签文本中做出非常丰富的效果
a:{ //富文本变量名称a
color:'',
fontSize:'',
backgroudColor:{
url:'' 可设置图片
}
},
b:{
}
}
}
}
}
echart 图例
最新推荐文章于 2023-11-04 08:29:17 发布