Skip to content

Commit 07ad5b5

Browse files
Tweak x-axis labels of charts (#4830)
* More tuning to avoid overlapping of labels, follow-up to #4733 Signed-off-by: Holger Friedrich <[email protected]>
1 parent cce185a commit 07ad5b5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/chart/defaultchartprovider/DefaultChartProvider.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ public BufferedImage createChart(@Nullable String serviceId, @Nullable String th
209209
// avoid overlapping labels on x-axis;
210210
// Font.getSize() is related to font height, but will also give an indication of the width;
211211
// pattern is not the actual label, but also gives a rough estimation of the width of the label
212-
int xAxisSpacing = Math.max(width / 15, chartTheme.getAxisTickLabelsFont(dpi).getSize() * pattern.length());
212+
int xAxisSpacing = Math.max(width / 15,
213+
chartTheme.getAxisTickLabelsFont(dpi).getSize() * pattern.length() * 4 / 3);
213214
styler.setXAxisTickMarkSpacingHint(xAxisSpacing);
214215
// chart
215216
styler.setChartBackgroundColor(chartTheme.getChartBackgroundColor());

0 commit comments

Comments
 (0)