@Test public void testTranslateJava2DToValue() { NumberAxis axis = new NumberAxis(); axis.setRange(50.0, 100.0); Rectangle2D dataArea = new Rectangle2D.Double(10.0, 50.0, 400.0, 300.0); double y1 = axis.java2DToValue(75.0, dataArea, RectangleEdge.LEFT); assertEquals(y1, 95.8333333, EPSILON); double y2 = axis.java2DToValue(75.0, dataArea, RectangleEdge.RIGHT); assertEquals(y2, 95.8333333, EPSILON); double x1 = axis.java2DToValue(75.0, dataArea, RectangleEdge.TOP); assertEquals(x1, 58.125, EPSILON); double x2 = axis.java2DToValue(75.0, dataArea, RectangleEdge.BOTTOM); assertEquals(x2, 58.125, EPSILON); axis.setInverted(true); double y3 = axis.java2DToValue(75.0, dataArea, RectangleEdge.LEFT); assertEquals(y3, 54.1666667, EPSILON); double y4 = axis.java2DToValue(75.0, dataArea, RectangleEdge.RIGHT); assertEquals(y4, 54.1666667, EPSILON); double x3 = axis.java2DToValue(75.0, dataArea, RectangleEdge.TOP); assertEquals(x3, 91.875, EPSILON); double x4 = axis.java2DToValue(75.0, dataArea, RectangleEdge.BOTTOM); assertEquals(x4, 91.875, EPSILON); }
@Override public double java2DToValue(double java2DValue, Rectangle2D area, RectangleEdge edge) { Range range = getRange(); double axisMin = range.getLowerBound(); double axisMax = range.getUpperBound(); double min = 0.0; double max = 0.0; if (RectangleEdge.isTopOrBottom(edge)) { min = area.getX(); max = area.getMaxX(); } else if (RectangleEdge.isLeftOrRight(edge)) { min = area.getMaxY(); max = area.getY(); } if (isInverted()) { return axisMax - (java2DValue - min) / (max - min) * (axisMax - axisMin); } else { return axisMin + (java2DValue - min) / (max - min) * (axisMax - axisMin); } }
NumberAxis extends ValueAxis implements Cloneable, Serializable { @Override public double java2DToValue(double java2DValue, Rectangle2D area, RectangleEdge edge) { Range range = getRange(); double axisMin = range.getLowerBound(); double axisMax = range.getUpperBound(); double min = 0.0; double max = 0.0; if (RectangleEdge.isTopOrBottom(edge)) { min = area.getX(); max = area.getMaxX(); } else if (RectangleEdge.isLeftOrRight(edge)) { min = area.getMaxY(); max = area.getY(); } if (isInverted()) { return axisMax - (java2DValue - min) / (max - min) * (axisMax - axisMin); } else { return axisMin + (java2DValue - min) / (max - min) * (axisMax - axisMin); } } }
NumberAxis extends ValueAxis implements Cloneable, Serializable { @Override public double java2DToValue(double java2DValue, Rectangle2D area, RectangleEdge edge) { Range range = getRange(); double axisMin = range.getLowerBound(); double axisMax = range.getUpperBound(); double min = 0.0; double max = 0.0; if (RectangleEdge.isTopOrBottom(edge)) { min = area.getX(); max = area.getMaxX(); } else if (RectangleEdge.isLeftOrRight(edge)) { min = area.getMaxY(); max = area.getY(); } if (isInverted()) { return axisMax - (java2DValue - min) / (max - min) * (axisMax - axisMin); } else { return axisMin + (java2DValue - min) / (max - min) * (axisMax - axisMin); } } NumberAxis();  NumberAxis(String label); }
NumberAxis extends ValueAxis implements Cloneable, Serializable { @Override public double java2DToValue(double java2DValue, Rectangle2D area, RectangleEdge edge) { Range range = getRange(); double axisMin = range.getLowerBound(); double axisMax = range.getUpperBound(); double min = 0.0; double max = 0.0; if (RectangleEdge.isTopOrBottom(edge)) { min = area.getX(); max = area.getMaxX(); } else if (RectangleEdge.isLeftOrRight(edge)) { min = area.getMaxY(); max = area.getY(); } if (isInverted()) { return axisMax - (java2DValue - min) / (max - min) * (axisMax - axisMin); } else { return axisMin + (java2DValue - min) / (max - min) * (axisMax - axisMin); } } NumberAxis();  NumberAxis(String label); RangeType getRangeType(); void setRangeType(RangeType rangeType); boolean getAutoRangeIncludesZero(); void setAutoRangeIncludesZero(boolean flag); boolean getAutoRangeStickyZero(); void setAutoRangeStickyZero(boolean flag); NumberTickUnit getTickUnit(); void setTickUnit(NumberTickUnit unit); void setTickUnit(NumberTickUnit unit, boolean notify,
                            boolean turnOffAutoSelect); NumberFormat getNumberFormatOverride(); void setNumberFormatOverride(NumberFormat formatter); MarkerAxisBand getMarkerBand(); void setMarkerBand(MarkerAxisBand band); @Override void configure(); @Override double valueToJava2D(double value, Rectangle2D area,
                                RectangleEdge edge); @Override double java2DToValue(double java2DValue, Rectangle2D area,
                                RectangleEdge edge); @Override AxisState draw(Graphics2D g2, double cursor, Rectangle2D plotArea,
            Rectangle2D dataArea, RectangleEdge edge,
            PlotRenderingInfo plotState); static TickUnitSource createStandardTickUnits(); static TickUnitSource createIntegerTickUnits(); static TickUnitSource createStandardTickUnits(Locale locale); static TickUnitSource createIntegerTickUnits(Locale locale); @Override List<ValueTick> refreshTicks(Graphics2D g2,
                             AxisState state,
                             Rectangle2D dataArea,
                             RectangleEdge edge); @Override Object clone(); @Override boolean equals(Object obj); @Override int hashCode(); }
NumberAxis extends ValueAxis implements Cloneable, Serializable { @Override public double java2DToValue(double java2DValue, Rectangle2D area, RectangleEdge edge) { Range range = getRange(); double axisMin = range.getLowerBound(); double axisMax = range.getUpperBound(); double min = 0.0; double max = 0.0; if (RectangleEdge.isTopOrBottom(edge)) { min = area.getX(); max = area.getMaxX(); } else if (RectangleEdge.isLeftOrRight(edge)) { min = area.getMaxY(); max = area.getY(); } if (isInverted()) { return axisMax - (java2DValue - min) / (max - min) * (axisMax - axisMin); } else { return axisMin + (java2DValue - min) / (max - min) * (axisMax - axisMin); } } NumberAxis();  NumberAxis(String label); RangeType getRangeType(); void setRangeType(RangeType rangeType); boolean getAutoRangeIncludesZero(); void setAutoRangeIncludesZero(boolean flag); boolean getAutoRangeStickyZero(); void setAutoRangeStickyZero(boolean flag); NumberTickUnit getTickUnit(); void setTickUnit(NumberTickUnit unit); void setTickUnit(NumberTickUnit unit, boolean notify,
                            boolean turnOffAutoSelect); NumberFormat getNumberFormatOverride(); void setNumberFormatOverride(NumberFormat formatter); MarkerAxisBand getMarkerBand(); void setMarkerBand(MarkerAxisBand band); @Override void configure(); @Override double valueToJava2D(double value, Rectangle2D area,
                                RectangleEdge edge); @Override double java2DToValue(double java2DValue, Rectangle2D area,
                                RectangleEdge edge); @Override AxisState draw(Graphics2D g2, double cursor, Rectangle2D plotArea,
            Rectangle2D dataArea, RectangleEdge edge,
            PlotRenderingInfo plotState); static TickUnitSource createStandardTickUnits(); static TickUnitSource createIntegerTickUnits(); static TickUnitSource createStandardTickUnits(Locale locale); static TickUnitSource createIntegerTickUnits(Locale locale); @Override List<ValueTick> refreshTicks(Graphics2D g2,
                             AxisState state,
                             Rectangle2D dataArea,
                             RectangleEdge edge); @Override Object clone(); @Override boolean equals(Object obj); @Override int hashCode(); static final boolean DEFAULT_AUTO_RANGE_INCLUDES_ZERO; static final boolean DEFAULT_AUTO_RANGE_STICKY_ZERO; static final NumberTickUnit DEFAULT_TICK_UNIT; static final boolean DEFAULT_VERTICAL_TICK_LABELS; }