double previousText = -100;
- double minY = bounds.getMaxY() - 30;
+ double minY = bounds.getMaxY() - 40;
- double scaleRight = bounds.getMaxX() - 30;
+ double scaleRight = bounds.getMaxX() - 20;
double meterPerPixel = getMeterPerPixel(scaleRight - offsetX, minY - offsetY, scaleX, scaleY);
double newScaleLeft = scaleRight - pixels;
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f));
- Rectangle2D vertical = new Rectangle2D.Double(newScaleLeft, bounds.getMaxY() - 30, pixels, 20);
+ Rectangle2D vertical = new Rectangle2D.Double(newScaleLeft, bounds.getMaxY() - 40, pixels, 20);
g.fill(vertical);
g.setColor(GRAY);
// Horizontal ruler
double label = 0;
+ FontMetrics fm = g.getFontMetrics();
for(double x = newScaleLeft; x < scaleRight; x += stepX) {
String str = formatValue(label * meterPerPixel);
- FontMetrics fm = g.getFontMetrics();
Rectangle2D r = fm.getStringBounds(str, g);
if((x - r.getWidth() / 2) > previousText) {
g.setColor(Color.BLACK);