Tweak x-axis labels of charts (#4830)

* More tuning to avoid overlapping of labels,
      follow-up to #4733

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
pull/4835/head
Holger Friedrich 2025-05-30 03:10:53 +02:00 committed by GitHub
parent cce185af64
commit 07ad5b52b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -209,7 +209,8 @@ public class DefaultChartProvider implements ChartProvider {
// avoid overlapping labels on x-axis; // avoid overlapping labels on x-axis;
// Font.getSize() is related to font height, but will also give an indication of the width; // Font.getSize() is related to font height, but will also give an indication of the width;
// pattern is not the actual label, but also gives a rough estimation of the width of the label // pattern is not the actual label, but also gives a rough estimation of the width of the label
int xAxisSpacing = Math.max(width / 15, chartTheme.getAxisTickLabelsFont(dpi).getSize() * pattern.length()); int xAxisSpacing = Math.max(width / 15,
chartTheme.getAxisTickLabelsFont(dpi).getSize() * pattern.length() * 4 / 3);
styler.setXAxisTickMarkSpacingHint(xAxisSpacing); styler.setXAxisTickMarkSpacingHint(xAxisSpacing);
// chart // chart
styler.setChartBackgroundColor(chartTheme.getChartBackgroundColor()); styler.setChartBackgroundColor(chartTheme.getChartBackgroundColor());