altoslib: Add AltosUnits.graph_format
authorKeith Packard <keithp@keithp.com>
Sat, 9 Feb 2013 10:00:13 +0000 (02:00 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 10 Feb 2013 08:30:32 +0000 (00:30 -0800)
This describes the format of numbers used on a graph axis for use with jfreechart

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosUnits.java

index 4351123b3ce846335226404385d57d98c199f996..4f4278b8e86b786950cddccaf82ae0980b73cc26 100644 (file)
@@ -43,6 +43,10 @@ public abstract class AltosUnits {
                return String.format("%%1.%df %s", say_fraction(), say_units());
        }
 
+       public String graph_format(int width) {
+               return String.format(String.format("%%%d.%df", width, show_fraction(width)), 0.0);
+       }
+
        public String show(int width, double v) {
                return String.format(show_format(width), value(v));
        }