option = {
grid: {
left: '10%',
right: '10%',
bottom: '10%'
},
tooltip: {
show: true,
trigger: 'axis',
axisPointer: {
type: 'line',
label: {
show: true,
precision: 2,
formatter: '{value} units',
backgroundColor: 'rgba(255, 255, 255, 0.8)', // 背景颜色,可以使用 rgba 设置透明度
borderColor: '#999', // 边框颜色
borderWidth: 1,
padding: [5, 10], // 设置上下左右的内边距
color: '#333',
fontSize: 12,
fontFamily: 'Arial',
fontWeight: 'bold',
fontStyle: 'italic',
lineHeight: 1.5
}
}
},
xAxis: {
type: 'category',
data: ['Category1', 'Category2', 'Category3', 'Category4', 'Category5']
},
yAxis: {
type: 'value'
},
series: [
{
name: 'Series1',
type: 'line',
data: [5, 20, 36, 10, 10]
}
]
};
在上述配置中,backgroundColor 属性用于设置文本标签的背景颜色,可以使用 rgba 设置透明度。borderColor 和 borderWidth 属性分别用于设置文本标签的边框颜色和边框宽度。
根据实际需求,你可以调整这些属性以满足你的要求。
转载请注明出处:http://www.zyzy.cn/article/detail/5148/ECharts