diff --git a/packages/grafana-ui/src/components/uPlot/config/UPlotAxisBuilder.ts b/packages/grafana-ui/src/components/uPlot/config/UPlotAxisBuilder.ts index 80b245141f7..bac588eb8c7 100644 --- a/packages/grafana-ui/src/components/uPlot/config/UPlotAxisBuilder.ts +++ b/packages/grafana-ui/src/components/uPlot/config/UPlotAxisBuilder.ts @@ -75,7 +75,10 @@ export class UPlotAxisBuilder extends PlotConfigBuilder { (acc, value) => Math.max(acc, measureText(value, UPLOT_AXIS_FONT_SIZE).width), 0 ); - axisSize += axis!.gap! + axis!.labelGap! + maxTextWidth; + // limit y tick label width to 40% of visualization + const textWidthWithLimit = Math.min(self.width * 0.4, maxTextWidth); + // Not sure why this += and not normal assignment + axisSize += axis!.gap! + axis!.labelGap! + textWidthWithLimit; } return Math.ceil(axisSize);