From 7c40257bafc951fd7d2ecf111d95cfd8d2462283 Mon Sep 17 00:00:00 2001 From: Leon Sorokin Date: Thu, 28 Jul 2022 16:51:37 -0500 Subject: [PATCH] BarChart: fix top y tick clipping when x labels are rotated (#52964) --- public/app/plugins/panel/barchart/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/panel/barchart/utils.ts b/public/app/plugins/panel/barchart/utils.ts index 1f12e968a8f..29c894747fb 100644 --- a/public/app/plugins/panel/barchart/utils.ts +++ b/public/app/plugins/panel/barchart/utils.ts @@ -1,5 +1,5 @@ import { orderBy } from 'lodash'; -import { Padding } from 'uplot'; +import uPlot, { Padding } from 'uplot'; import { ArrayVector, @@ -302,7 +302,7 @@ function getRotationPadding(frame: DataFrame, rotateLabel: number, valueMaxLengt // Add padding to the bottom to avoid clipping the rotated labels. const paddingBottom = Math.sin(((rotateLabel >= 0 ? rotateLabel : rotateLabel * -1) * Math.PI) / 180) * maxLength; - return [0, paddingRight, paddingBottom, paddingLeft]; + return [Math.round(UPLOT_AXIS_FONT_SIZE * uPlot.pxRatio), paddingRight, paddingBottom, paddingLeft]; } /** @internal */