List of usage examples for org.jfree.chart.axis TickUnit valueToString
public String valueToString(double value)
From source file:com.att.aro.ui.view.waterfalltab.WaterfallPanel.java
/** * @return the timeAxis// w w w . java 2 s .co m */ private NumberAxis getTimeAxis() { if (timeAxis == null) { timeAxis = new NumberAxis(ResourceBundleHelper.getMessageString("waterfall.time")) { private static final long serialVersionUID = 1L; /** * This override prevents the tick units from changing * as the timeline is scrolled to numbers with more digits */ @Override protected double estimateMaximumTickLabelWidth(Graphics2D g2d, TickUnit unit) { if (isVerticalTickLabels()) { return super.estimateMaximumTickLabelWidth(g2d, unit); } else { RectangleInsets tickLabelInsets = getTickLabelInsets(); double result = tickLabelInsets.getLeft() + tickLabelInsets.getRight(); // look at lower and upper bounds... FontMetrics fMetrics = g2d.getFontMetrics(getTickLabelFont()); double upper = traceDuration; String upperStr = ""; NumberFormat formatter = getNumberFormatOverride(); if (formatter == null) { upperStr = unit.valueToString(upper); } else { upperStr = formatter.format(upper); } double width2 = fMetrics.stringWidth(upperStr); result += width2; return result; } } }; timeAxis.setRange(new Range(0, DEFAULT_TIMELINE)); timeAxis.setStandardTickUnits(units); } return timeAxis; }