BarChart: fix top y tick clipping when x labels are rotated (#52964)

This commit is contained in:
Leon Sorokin 2022-07-28 16:51:37 -05:00 committed by GitHub
parent 11c79cd6da
commit 7c40257baf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 */