--- old/application/org.openjdk.jmc.ui/src/main/java/org/openjdk/jmc/ui/charts/AWTChartToolkit.java 2019-10-22 09:27:19.239118125 -0400 +++ new/application/org.openjdk.jmc.ui/src/main/java/org/openjdk/jmc/ui/charts/AWTChartToolkit.java 2019-10-22 09:27:19.081115867 -0400 @@ -1,6 +1,7 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. - * + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, Red Hat Inc. All rights reserved. + * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * The contents of this file are subject to the terms of either the Universal Permissive License @@ -10,17 +11,17 @@ * * Redistribution and use in source and binary forms, with or without modification, are permitted * provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of conditions * and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials provided with * the distribution. - * + * * 3. Neither the name of the copyright holder nor the names of its contributors may be used to * endorse or promote products derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR @@ -291,8 +292,14 @@ } public static void drawAxis( + Graphics2D ctx, SubdividedQuantityRange range, int axisPos, boolean labelAhead, int labelLimit, + boolean vertical) { + drawAxis(ctx, range, axisPos, labelAhead, labelLimit, vertical, 0); + } + + public static void drawAxis( Graphics2D ctx, SubdividedQuantityRange range, int axisPos, boolean labelAhead, int labelLimit, - boolean vertical) { + boolean vertical, int xOffset) { int axisSize = range.getPixelExtent(); FontMetrics fm = ctx.getFontMetrics(); int textAscent = fm.getAscent(); @@ -305,7 +312,7 @@ drawUpArrow(ctx, axisPos, Y_AXIS_TOP_SPACE, Math.min(ARROW_SIZE, axisSize - 2)); labelSpacing = fm.getHeight() - textAscent; } else { - ctx.drawLine(0, axisPos, axisSize - 1, axisPos); + ctx.drawLine(0 + xOffset, axisPos, axisSize + xOffset, axisPos); labelSpacing = fm.charWidth(' ') * 2; } @@ -354,14 +361,14 @@ } else { label = formatter.format(currentTick); } - ctx.drawLine(tickPos, axisPos - TICK_LINE, tickPos, axisPos + TICK_LINE); + ctx.drawLine(tickPos + xOffset, axisPos - TICK_LINE, tickPos + xOffset, axisPos + TICK_LINE); int textXadjust = fm.stringWidth(label) / 2; // FIXME: Decide if truncated labels should be shown // if ((tickPos + textXadjust) >= axisSize) { if (tickPos >= axisSize) { break; } else if ((tickPos - textXadjust) >= labelLimit) { - ctx.drawString(label, tickPos - textXadjust, labelYPos); + ctx.drawString(label, tickPos - textXadjust + xOffset, labelYPos); labelLimit = tickPos + textXadjust + labelSpacing; lastShownTick = currentTick; }