tooltip: {
trigger: 'axis',
position(pos, params, el, elRect, size) {
const obj = { top: 10 };
// 鼠标在canvas左侧
if (pos[0] < size.viewSize[0] / 2) {
obj.left = pos[0];
} else {
obj.right = size.viewSize[0] - pos[0];
}
return obj;
},
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985',
},
},
backgroundColor: 'rgba(0,0,0,0.7)',
textStyle: {
fontSize: 12,
},
formatter: `{b0}:<br/>{a0}{c0}%<br/>{a1}{c1}%<br/>{a2}{c2}%<br/>{a3}{c3}%<br/>{a4}{c4}%<br/>{a5}{c5}%<br/>
{a6}{c6}%<br/>{a7}{c7}%<br/>{a8}{c8}%<br/>{a9}{c9}%<br/>{a10}{c10}%<br/>`,
},
legend: {
bottom: 0,
icon: 'rect',
textStyle: {
color: '#818A9A',
fontSize: 12,
},
itemWidth: 12,
itemHeight: 4,
},
grid: {
top: 35,
left: 15,
bottom: 50,
right: 28,
containLabel: true, // 文案展示全
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: DDTimeData,
splitLine: {
show: false,
},
axisLine: {
lineStyle: {
color: '#515968',
},
},
axisLabel: {
// interval: inter,
color: '#F0F0F0',
fontSize: 10,
},
axisTick: {
show: false,
},
},
],
yAxis: [
{
name: '%',
axisLine: {
lineStyle: {
color: '#818A9A',
},
},
splitLine: {
show: true,
lineStyle: {
color: ['#515968'],
width: 1,
type: 'dotted',
},
},
type: 'value',
},
],
echart tooltip 跟随鼠标,鼠标在左半部分时靠右,反之
最新推荐文章于 2024-04-23 10:33:25 发布