List of usage examples for org.jfree.chart.axis DateTickUnit addToDate
public Date addToDate(Date base)
From source file:figs.treeVisualization.gui.PhyloDateAxis.java
protected List<DateTick> refreshTicksVertical(Graphics2D g2, Rectangle2D dataArea) { List<DateTick> result = new ArrayList<DateTick>(); DateFormat formatter = getDateFormatOverride(); Font tickLabelFont = getTickLabelFont(); g2.setFont(tickLabelFont);/*from ww w.ja v a 2s. com*/ if (isAutoTickUnitSelection()) { selectAutoTickUnit(g2, dataArea, RectangleEdge.RIGHT); } DateTickUnit unit = getTickUnit(); // nextStandardDate is adding to the min which makes no sense, so just call previous Date tickDate = previousStandardDate(getMinimumDate(), unit); Date upperDate = getMaximumDate(); while (!tickDate.after(upperDate)) { if (!isHiddenValue(tickDate.getTime())) { // work out the value, label and position String tickLabel; if (formatter != null) { tickLabel = formatter.format(tickDate); } else { tickLabel = this.getTickUnit().dateToString(tickDate); } TextAnchor anchor = null; TextAnchor rotationAnchor = null; double angle = 0.0; if (isVerticalTickLabels()) { anchor = TextAnchor.BOTTOM_CENTER; rotationAnchor = TextAnchor.BOTTOM_CENTER; // RectangeEdge.RIGHT angle = Math.PI / 2.0; } else { // RectangeEdge.RIGHT anchor = TextAnchor.CENTER_LEFT; rotationAnchor = TextAnchor.CENTER_LEFT; } DateTick tick = new DateTick(tickDate, tickLabel, anchor, rotationAnchor, angle); result.add(tick); tickDate = unit.addToDate(tickDate); } else { tickDate = unit.rollDate(tickDate); } } return result; }