plotly/plotly.js

[BUG]: Setting `textposition: 'outside'` for bar traces causes bar text to be clipped

Closed this issue · 1 comments

When setting textposition: 'outside' for a bar trace, the text on the tallest bar is partially outside the default margins and is partially clipped:

Image
Plotly.newPlot(
  'div1', 
  [
    {
	    x: xvals,
	    y: yvals,
      type: 'bar',
      text: yvals.map((v) => `Value: ${v}`),
      textposition: 'outside',
    }
  ], 
  {
	  title: { text: 'Clipped bar text' } 
  }
);

Codepen

The only way to prevent the clipping is to manually increase the y-axis range.

Expected behavior

The expected behavior is that the bar text should be fully rendered without clipping by default.

duplicate of #2001