提交 4d4286d9 编写于 作者: D Daniel Beck 提交者: Oliver Gondža

[JENKINS-22686] Don't use fixed pixel count for label distance.

Instead, use a distance of 0.5x the width/height of the label.

This improves appearance in combination with JENKINS-22688 for
different font sizes.
上级 44d170b2
......@@ -46,12 +46,6 @@ import java.util.*;
* @author Kohsuke Kawaguchi
*/
public class NoOverlapCategoryAxis extends CategoryAxis {
/**
* Minimum distance between labels.
*/
private static final double MIN_DISTANCE = 6.0;
public NoOverlapCategoryAxis(String label) {
super(label);
}
......@@ -147,10 +141,10 @@ public class NoOverlapCategoryAxis extends CategoryAxis {
}
r = bounds.getBounds2D();
// add margins in all directions
r.add(r.getMaxX() + MIN_DISTANCE, r.getCenterY());
r.add(r.getMinX() - MIN_DISTANCE, r.getCenterY());
r.add(r.getCenterX(), r.getMinY() - MIN_DISTANCE);
r.add(r.getCenterX(), r.getMaxX() + MIN_DISTANCE);
r.add(r.getMaxX() + r.getWidth()/2, r.getCenterY());
r.add(r.getMinX() - r.getWidth()/2, r.getCenterY());
r.add(r.getCenterX(), r.getMinY() - r.getHeight()/2);
r.add(r.getCenterX(), r.getMaxX() + r.getHeight()/2);
}
categoryIndex++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册