*/
protected void selectVerticalAutoTickUnit(final GC g2,
final Rectangle dataArea, final RectangleEdge edge) {
// start with the current tick unit...
final TickUnitSource tickUnits = this.getStandardTickUnits();
final double zero = this.valueToJava2D(0.0, dataArea, edge);
// start with a unit that is at least 1/10th of the axis length
final double estimate1 = this.getRange().getLength() / 10.0;
final DateTickUnit candidate1 = (DateTickUnit) tickUnits
.getCeilingTickUnit(estimate1);
final double labelHeight1 = this.estimateMaximumTickLabelHeight(g2,
candidate1);
final double y1 = this.valueToJava2D(candidate1.getSize(), dataArea,
edge);
final double candidate1UnitHeight = Math.abs(y1 - zero);
// now extrapolate based on label height and unit height...
final double estimate2 = (labelHeight1 / candidate1UnitHeight)
* candidate1.getSize();
final DateTickUnit candidate2 = (DateTickUnit) tickUnits
.getCeilingTickUnit(estimate2);
final double labelHeight2 = this.estimateMaximumTickLabelHeight(g2,
candidate2);
final double y2 = this.valueToJava2D(candidate2.getSize(), dataArea,
edge);
final double unit2Height = Math.abs(y2 - zero);
// make final selection...
DateTickUnit finalUnit;
if (labelHeight2 < unit2Height) {
finalUnit = candidate2;
} else {
finalUnit = (DateTickUnit) tickUnits.getLargerTickUnit(candidate2);
}
this.setTickUnit(finalUnit, false, false);
}