@Override public double java2DToValue(double java2DValue,Rectangle2D dataArea,RectangleEdge edge){
  Range range=getRange();
  double vmax=range.getUpperBound();
  double vp=getCycleBound();
  double jmin=0.0;
  double jmax=0.0;
  if (RectangleEdge.isTopOrBottom(edge)) {
    jmin=dataArea.getMinX();
    jmax=dataArea.getMaxX();
  }
 else   if (RectangleEdge.isLeftOrRight(edge)) {
    jmin=dataArea.getMaxY();
    jmax=dataArea.getMinY();
  }
  if (isInverted()) {
    double jbreak=jmax - (vmax - vp) * (jmax - jmin) / this.period;
    if (java2DValue >= jbreak) {
      return vp + (jmax - java2DValue) * this.period / (jmax - jmin);
    }
 else {
      return vp - (java2DValue - jmin) * this.period / (jmax - jmin);
    }
  }
 else {
    double jbreak=(vmax - vp) * (jmax - jmin) / this.period + jmin;
    if (java2DValue <= jbreak) {
      return vp + (java2DValue - jmin) * this.period / (jmax - jmin);
    }
 else {
      return vp - (jmax - java2DValue) * this.period / (jmax - jmin);
    }
  }
}

@ Override public double java2DToValue ( double java2DValue , Rectangle2D dataArea , RectangleEdge edge ) { Range range = getRange ( ) ; double vmax = range . getUpperBound ( ) ; double vp = getCycleBound ( ) ; double jmin = 0.0 ; double jmax = 0.0 ; if ( RectangleEdge . isTopOrBottom ( edge ) ) { jmin = dataArea . getMinX ( ) ; jmax = dataArea . getMaxX ( ) ; } else if ( RectangleEdge . isLeftOrRight ( edge ) ) { jmin = dataArea . getMaxY ( ) ; jmax = dataArea . getMinY ( ) ; } if ( isInverted ( ) ) { double jbreak = jmax - ( vmax - vp ) * ( jmax - jmin ) / this . period ; if ( java2DValue >= jbreak ) { return vp + ( jmax - java2DValue ) * this . period / ( jmax - jmin ) ; } else { return vp - ( java2DValue - jmin ) * this . period / ( jmax - jmin ) ; } } else { double jbreak = ( vmax - vp ) * ( jmax - jmin ) / this . period + jmin ; if ( java2DValue <= jbreak ) { return vp + ( java2DValue - jmin ) * this . period / ( jmax - jmin ) ; } else { return vp - ( jmax - java2DValue ) * this . period / ( jmax - jmin ) ; } } }
converts a coordinate from java 2d space to data space .
