一、添加图片
- 找到 legend》data
- 处理数据
添加 icon:‘image://./img/报警.png’
将 ‘题1’ 换成 {name:‘题1’,icon:‘image://./img/报警.png’} - 代码:
legend: {type:"plain",orient: 'vertical',x: 'left',top:50,left:20,data:[{name:'题1',icon:'image://./img/报警.png'},'题2',题3','题4','题5'],textStyle:{color:'#2DA7F6',fontSize:'16'}},
- 效果:

二、 更换位置
- 找到 legend
- 添加属性 align:‘right’,
- 代码:
legend: {type:"plain",orient: 'vertical',x: 'left',top:50,left:20,data:['题2',题3','题4','题5'],align:'right',textStyle:{color:'#2DA7F6',fontSize:'16'}},
- 效果

变成

三、文字后面加富文本
- 找到 legend
- 添加属性
formatter: function (value) {return value+'{a|}';},textStyle: {color:'#2DA7F6',fontSize:'16',//rich放在textStyle里面rich: {a: {color: 'red',fontSize:'24',height: 20,width: 20,backgroundColor: {image: './img/报警.png'},},}},
- 代码:
legend: {type:"plain",orient: 'vertical',x: 'left',top:50,left:20,data:['题2',题3','题4','题5'],formatter: function (value) {return value+'{a|}';},textStyle: {color:'#2DA7F6',fontSize:'16',//rich放在textStyle里面rich: {a: {color: 'red',fontSize:'24',height: 20,width: 20,backgroundColor: {image: './img/报警.png'},},}},},
- 效果

本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!