You can check if the label width is bigger then plot band width on afterSetExtremes event and if so hide it by setting its opacity to 0.
Function for toggling labels opacity:
function togglePlotbands() {
this.plotLinesAndBands.forEach(plotband => {
const { plotLeft, plotWidth } = this.chart
const from = Math.max(this.toPixels(plotband.options.from), plotLeft)
const to = Math.min(this.toPixels(plotband.options.to), plotLeft + plotWidth)
const plotbandWidth = to - from
const show = plotband.label.getBBox().width < plotbandWidth
plotband.label.css({ opacity: Number(show) })
})
}
Call on afterSetExtremes:
events: {
afterSetExtremes: togglePlotbands
}
Optionally on chart load:
chart: {
events: {
load: function() {
togglePlotbands.call(this.xAxis[0])
}
}
},
example: http://jsfiddle.net/r89r2sr0/