有没有办法在绘图图形工具提示中显示文本而不重叠?

Sat*_*shV 5 javascript css plotly.js

如下面的代码笔所示,轨迹 1 的文本值正在被修剪,因为它靠近图表边框。需要显示这些数字高于一切。已尝试设置 z-index。没用。

https://codepen.io/satishvarada/pen/yLVoqqo

var trace1 = {
  x: [1, 2, 3, 4],
  y: [16, 16, 16, 16],
  type: 'scatter',
  text:[16, 16, 16, 16],
  textposition:'top',
  mode:'lines+markers+text'
};

var trace2 = {
  x: [1, 2, 3, 4],
  y: [16, 5, 11, 9],
  type: 'scatter',
  mode:'lines+markers+text'
};

var data = [trace1, trace2];

Plotly.newPlot('myDiv', data);
Run Code Online (Sandbox Code Playgroud)

修剪的文本

小智 1

尝试这个。

.plot { clip-path: none; }
Run Code Online (Sandbox Code Playgroud)