yScreenToYphys method
Converts screen y coordinate yscreen
which is given relative to the
data area, to physical y coordinate.
This conversion is the inverse operation of yphysToXscreen(double y)
and is valid for this polyline by using the constants a and b computed
by yphysToXscreen
.
If this method is called prior to calling yphysToXscreen
the constants
a and b and not available yet, null is returned.
Implementation
double yScreenToYphys(int yscreen) {
if (a == null || b == null) {
return null;
}
// the following checks are important for y axis labelling!
if (a.abs() < 1.0e-10 && yscreen <= 0) {
return ymax / yscale;
}
if (a.abs() < 1.0e-10 && yscreen >= dataAreaHeight) {
return -ymax / yscale;
}
double y = -(yscreen - b) / a;
return y;
}