Thursday, 25 February 2021

Is there a way to show text in plotly graph tooltip without being overlapped?

As shown in codepen below, text value for trace 1 is being trimmed as it is close to chart border. Need to show these numbers above everything else. Have tried setting z-index. Didn't worked.

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);

Trimmed text



from Is there a way to show text in plotly graph tooltip without being overlapped?

No comments:

Post a Comment