diff options
author | Keith Packard <keithp@keithp.com> | 2013-02-09 02:00:13 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-02-10 00:30:32 -0800 |
commit | 9d3da1530c1007d5d1f28062b3947f4aa981bfa8 (patch) | |
tree | fcfe06002f5414e9e09f9630388c0ebc83840973 | |
parent | ab9caa22ea905844a99e08b5f6d3b072f094283e (diff) |
altoslib: Add AltosUnits.graph_format
This describes the format of numbers used on a graph axis for use with jfreechart
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | altoslib/AltosUnits.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/altoslib/AltosUnits.java b/altoslib/AltosUnits.java index 4351123b..4f4278b8 100644 --- a/altoslib/AltosUnits.java +++ b/altoslib/AltosUnits.java @@ -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)); } |