< prev index next >

application/org.openjdk.jmc.ui/src/main/java/org/openjdk/jmc/ui/charts/AWTChartToolkit.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2018, Oracle and/or its affiliates. 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 * v 1.0 as shown at http://oss.oracle.com/licenses/upl --- 1,8 ---- /* ! * 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 * v 1.0 as shown at http://oss.oracle.com/licenses/upl
*** 291,300 **** --- 292,307 ---- } 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, int xOffset) { int axisSize = range.getPixelExtent(); FontMetrics fm = ctx.getFontMetrics(); int textAscent = fm.getAscent(); int textYadjust = textAscent / 2; int labelYPos = labelAhead ? axisPos - TICK_SIZE : axisPos + TICK_SIZE + textAscent;
*** 303,313 **** if (vertical) { ctx.drawLine(axisPos, Y_AXIS_TOP_SPACE, axisPos, axisSize - 1); 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); labelSpacing = fm.charWidth(' ') * 2; } IRange<IQuantity> firstBucket = QuantityRange.createWithEnd(range.getSubdivider(0), range.getSubdivider(1)); IQuantity lastShownTick = null; --- 310,320 ---- if (vertical) { ctx.drawLine(axisPos, Y_AXIS_TOP_SPACE, axisPos, axisSize - 1); drawUpArrow(ctx, axisPos, Y_AXIS_TOP_SPACE, Math.min(ARROW_SIZE, axisSize - 2)); labelSpacing = fm.getHeight() - textAscent; } else { ! ctx.drawLine(0 + xOffset, axisPos, axisSize + xOffset, axisPos); labelSpacing = fm.charWidth(' ') * 2; } IRange<IQuantity> firstBucket = QuantityRange.createWithEnd(range.getSubdivider(0), range.getSubdivider(1)); IQuantity lastShownTick = null;
*** 352,369 **** if (changeFormatter != null) { label = changeFormatter.formatAdjacent(lastShownTick, range.getSubdivider(i)); } else { label = formatter.format(currentTick); } ! ctx.drawLine(tickPos, axisPos - TICK_LINE, tickPos, 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); labelLimit = tickPos + textXadjust + labelSpacing; lastShownTick = currentTick; } } } --- 359,376 ---- if (changeFormatter != null) { label = changeFormatter.formatAdjacent(lastShownTick, range.getSubdivider(i)); } else { label = formatter.format(currentTick); } ! 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 + xOffset, labelYPos); labelLimit = tickPos + textXadjust + labelSpacing; lastShownTick = currentTick; } } }
< prev index next >