option = {
……
series: [
// 开启tooltip功能
emphasis: {
label: {
show: true,
formatter: params => '{b|' + params.value + ' 起' + '}', // label不支持html片段
rich: { // 因为label不支持html片段,所以css样式需要使用rich富文本添加
b: {
fontSize: 13,
color: '#FFF',
backgroundColor: {
image: 'xx.png' // hover时提示文本这里会显示背景图片
},
height: 50,
width: 100,
align: 'center', // 文本居中显示
},
},
position: ['-10%', '-10%'], // left top 调整文本显示的位置
},
},
],
……
}
Echarts折线图鼠标hover悬停时,数据显示在某一条折线上方,用背景图片填充样式,不是tooltip
于 2024-01-17 15:39:35 首次发布