Tweak x-axis labels of charts (#4733)
* Avoid overlapping of labels Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>pull/4823/head
parent
cb42343c3e
commit
3211e2012d
|
@ -206,6 +206,11 @@ public class DefaultChartProvider implements ChartProvider {
|
|||
}
|
||||
styler.setYAxisTickMarkSpacingHint(yAxisSpacing);
|
||||
styler.setYAxisLabelAlignment(TextAlignment.Right);
|
||||
// avoid overlapping labels on x-axis;
|
||||
// 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
|
||||
int xAxisSpacing = Math.max(width / 15, chartTheme.getAxisTickLabelsFont(dpi).getSize() * pattern.length());
|
||||
styler.setXAxisTickMarkSpacingHint(xAxisSpacing);
|
||||
// chart
|
||||
styler.setChartBackgroundColor(chartTheme.getChartBackgroundColor());
|
||||
styler.setChartFontColor(chartTheme.getChartFontColor());
|
||||
|
|
Loading…
Reference in New Issue