@Test public void testJava2DToValue() { DateAxis axis = new DateAxis(); 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); assertTrue(same(y1, 95.8333333, 1.0)); double y2 = axis.java2DToValue(75.0, dataArea, RectangleEdge.RIGHT); assertTrue(same(y2, 95.8333333, 1.0)); double x1 = axis.java2DToValue(75.0, dataArea, RectangleEdge.TOP); assertTrue(same(x1, 58.125, 1.0)); double x2 = axis.java2DToValue(75.0, dataArea, RectangleEdge.BOTTOM); assertTrue(same(x2, 58.125, 1.0)); axis.setInverted(true); double y3 = axis.java2DToValue(75.0, dataArea, RectangleEdge.LEFT); assertTrue(same(y3, 54.1666667, 1.0)); double y4 = axis.java2DToValue(75.0, dataArea, RectangleEdge.RIGHT); assertTrue(same(y4, 54.1666667, 1.0)); double x3 = axis.java2DToValue(75.0, dataArea, RectangleEdge.TOP); assertTrue(same(x3, 91.875, 1.0)); double x4 = axis.java2DToValue(75.0, dataArea, RectangleEdge.BOTTOM); assertTrue(same(x4, 91.875, 1.0)); }
@Override public double java2DToValue(double java2DValue, Rectangle2D area, RectangleEdge edge) { DateRange range = (DateRange) getRange(); double axisMin = this.timeline.toTimelineValue(range.getLowerMillis()); double axisMax = this.timeline.toTimelineValue(range.getUpperMillis()); 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(); } double result; if (isInverted()) { result = axisMax - ((java2DValue - min) / (max - min) * (axisMax - axisMin)); } else { result = axisMin + ((java2DValue - min) / (max - min) * (axisMax - axisMin)); } return this.timeline.toMillisecond((long) result); }
DateAxis extends ValueAxis implements Cloneable, Serializable { @Override public double java2DToValue(double java2DValue, Rectangle2D area, RectangleEdge edge) { DateRange range = (DateRange) getRange(); double axisMin = this.timeline.toTimelineValue(range.getLowerMillis()); double axisMax = this.timeline.toTimelineValue(range.getUpperMillis()); 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(); } double result; if (isInverted()) { result = axisMax - ((java2DValue - min) / (max - min) * (axisMax - axisMin)); } else { result = axisMin + ((java2DValue - min) / (max - min) * (axisMax - axisMin)); } return this.timeline.toMillisecond((long) result); } }
DateAxis extends ValueAxis implements Cloneable, Serializable { @Override public double java2DToValue(double java2DValue, Rectangle2D area, RectangleEdge edge) { DateRange range = (DateRange) getRange(); double axisMin = this.timeline.toTimelineValue(range.getLowerMillis()); double axisMax = this.timeline.toTimelineValue(range.getUpperMillis()); 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(); } double result; if (isInverted()) { result = axisMax - ((java2DValue - min) / (max - min) * (axisMax - axisMin)); } else { result = axisMin + ((java2DValue - min) / (max - min) * (axisMax - axisMin)); } return this.timeline.toMillisecond((long) result); } DateAxis();  DateAxis(String label);  DateAxis(String label, TimeZone zone, Locale locale); }
DateAxis extends ValueAxis implements Cloneable, Serializable { @Override public double java2DToValue(double java2DValue, Rectangle2D area, RectangleEdge edge) { DateRange range = (DateRange) getRange(); double axisMin = this.timeline.toTimelineValue(range.getLowerMillis()); double axisMax = this.timeline.toTimelineValue(range.getUpperMillis()); 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(); } double result; if (isInverted()) { result = axisMax - ((java2DValue - min) / (max - min) * (axisMax - axisMin)); } else { result = axisMin + ((java2DValue - min) / (max - min) * (axisMax - axisMin)); } return this.timeline.toMillisecond((long) result); } DateAxis();  DateAxis(String label);  DateAxis(String label, TimeZone zone, Locale locale); TimeZone getTimeZone(); void setTimeZone(TimeZone zone); Timeline getTimeline(); void setTimeline(Timeline timeline); DateTickUnit getTickUnit(); void setTickUnit(DateTickUnit unit); void setTickUnit(DateTickUnit unit, boolean notify,
                            boolean turnOffAutoSelection); DateFormat getDateFormatOverride(); void setDateFormatOverride(DateFormat formatter); @Override void setRange(Range range); @Override void setRange(Range range, boolean turnOffAutoRange,
                         boolean notify); void setRange(Date lower, Date upper); @Override void setRange(double lower, double upper); Date getMinimumDate(); void setMinimumDate(Date date); Date getMaximumDate(); void setMaximumDate(Date maximumDate); DateTickMarkPosition getTickMarkPosition(); void setTickMarkPosition(DateTickMarkPosition position); @Override void configure(); boolean isHiddenValue(long millis); @Override double valueToJava2D(double value, Rectangle2D area,
                                RectangleEdge edge); double dateToJava2D(Date date, Rectangle2D area,
                               RectangleEdge edge); @Override double java2DToValue(double java2DValue, Rectangle2D area,
                                RectangleEdge edge); Date calculateLowestVisibleTickValue(DateTickUnit unit); Date calculateHighestVisibleTickValue(DateTickUnit unit); static TickUnitSource createStandardDateTickUnits(); static TickUnitSource createStandardDateTickUnits(TimeZone zone,
            Locale locale); @Override List<ValueTick> refreshTicks(Graphics2D g2, AxisState state,
            Rectangle2D dataArea, RectangleEdge edge); @Override AxisState draw(Graphics2D g2, double cursor, Rectangle2D plotArea,
            Rectangle2D dataArea, RectangleEdge edge,
            PlotRenderingInfo plotState); @Override void zoomRange(double lowerPercent, double upperPercent); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone(); }
DateAxis extends ValueAxis implements Cloneable, Serializable { @Override public double java2DToValue(double java2DValue, Rectangle2D area, RectangleEdge edge) { DateRange range = (DateRange) getRange(); double axisMin = this.timeline.toTimelineValue(range.getLowerMillis()); double axisMax = this.timeline.toTimelineValue(range.getUpperMillis()); 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(); } double result; if (isInverted()) { result = axisMax - ((java2DValue - min) / (max - min) * (axisMax - axisMin)); } else { result = axisMin + ((java2DValue - min) / (max - min) * (axisMax - axisMin)); } return this.timeline.toMillisecond((long) result); } DateAxis();  DateAxis(String label);  DateAxis(String label, TimeZone zone, Locale locale); TimeZone getTimeZone(); void setTimeZone(TimeZone zone); Timeline getTimeline(); void setTimeline(Timeline timeline); DateTickUnit getTickUnit(); void setTickUnit(DateTickUnit unit); void setTickUnit(DateTickUnit unit, boolean notify,
                            boolean turnOffAutoSelection); DateFormat getDateFormatOverride(); void setDateFormatOverride(DateFormat formatter); @Override void setRange(Range range); @Override void setRange(Range range, boolean turnOffAutoRange,
                         boolean notify); void setRange(Date lower, Date upper); @Override void setRange(double lower, double upper); Date getMinimumDate(); void setMinimumDate(Date date); Date getMaximumDate(); void setMaximumDate(Date maximumDate); DateTickMarkPosition getTickMarkPosition(); void setTickMarkPosition(DateTickMarkPosition position); @Override void configure(); boolean isHiddenValue(long millis); @Override double valueToJava2D(double value, Rectangle2D area,
                                RectangleEdge edge); double dateToJava2D(Date date, Rectangle2D area,
                               RectangleEdge edge); @Override double java2DToValue(double java2DValue, Rectangle2D area,
                                RectangleEdge edge); Date calculateLowestVisibleTickValue(DateTickUnit unit); Date calculateHighestVisibleTickValue(DateTickUnit unit); static TickUnitSource createStandardDateTickUnits(); static TickUnitSource createStandardDateTickUnits(TimeZone zone,
            Locale locale); @Override List<ValueTick> refreshTicks(Graphics2D g2, AxisState state,
            Rectangle2D dataArea, RectangleEdge edge); @Override AxisState draw(Graphics2D g2, double cursor, Rectangle2D plotArea,
            Rectangle2D dataArea, RectangleEdge edge,
            PlotRenderingInfo plotState); @Override void zoomRange(double lowerPercent, double upperPercent); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone(); static final DateRange DEFAULT_DATE_RANGE; static final double DEFAULT_AUTO_RANGE_MINIMUM_SIZE_IN_MILLISECONDS; static final Date DEFAULT_ANCHOR_DATE; }