echarts 圖例元件如何分行
阿新 • • 發佈:2021-02-06
legend: [
{
left:'80',
data: ['郵件', 'QQ檔案', '微信', '檔案傳輸'],
textStyle: {
color: '#fff',
}
},
{
top:'20',
left:'80',
data:['木馬','漏洞','惡意檔案','其他'],
textStyle: {
color: '#fff',
}
}
],
把圖裡元件用陣列分成2組 其他正常
通過left、top、right、bottom 使其佈局
把圖裡元件全部對齊
通過textStyle
的formatter
rich
的width
實現對齊原理:通過富文字設定固定的寬度
legend: [
{
left:'30',
data: ['郵件', 'QQ檔案', '微信', '檔案傳輸'],
formatter: '{a|{name}}',
textStyle: {
color: '#fff',
rich:{
a:{
width: 60,
fontSize: 12
},
}
}
},
{
top:'25' ,
left:'30',
formatter: '{a|{name}}',
data:['木馬','漏洞','惡意檔案','其他'],
textStyle: {
color: '#fff',
rich:{
a:{
width: 60,
fontSize: 12
},
}
}
}
],