mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Statetimeline/TimeSeries/BarChart: Limit y label width to 40% of visualiation width (#42350) (#42368)
(cherry picked from commit 820aa3ac59
)
Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
This commit is contained in:
parent
b5960313fb
commit
ce0771efea
@ -75,7 +75,10 @@ export class UPlotAxisBuilder extends PlotConfigBuilder<AxisProps, Axis> {
|
|||||||
(acc, value) => Math.max(acc, measureText(value, UPLOT_AXIS_FONT_SIZE).width),
|
(acc, value) => Math.max(acc, measureText(value, UPLOT_AXIS_FONT_SIZE).width),
|
||||||
0
|
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);
|
return Math.ceil(axisSize);
|
||||||
|
Loading…
Reference in New Issue
Block a user