diff --git a/src/main/java/hudson/plugins/plot/PlotReport.java b/src/main/java/hudson/plugins/plot/PlotReport.java index 32bf84af..3c499ebd 100644 --- a/src/main/java/hudson/plugins/plot/PlotReport.java +++ b/src/main/java/hudson/plugins/plot/PlotReport.java @@ -11,6 +11,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; +import java.text.NumberFormat; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Collections; @@ -74,6 +75,23 @@ public List getPlots() { return plots; } + // called from PlotReport/index.jelly + public String formatNumber(String number) { + String formatted; + + try { + formatted = NumberFormat.getIntegerInstance().format(Integer.parseInt(number)); + } catch (NumberFormatException e) { + try { + formatted = NumberFormat.getNumberInstance().format(Double.parseDouble(number)); + } catch (NumberFormatException e2) { + return number; + } + } + + return formatted; + } + // called from PlotReport/index.jelly public void doGetPlot(StaplerRequest req, StaplerResponse rsp) { String i = req.getParameter("index"); diff --git a/src/main/resources/hudson/plugins/plot/PlotReport/index.jelly b/src/main/resources/hudson/plugins/plot/PlotReport/index.jelly index cc1068de..45fc529a 100644 --- a/src/main/resources/hudson/plugins/plot/PlotReport/index.jelly +++ b/src/main/resources/hudson/plugins/plot/PlotReport/index.jelly @@ -9,6 +9,23 @@ +
${%top} @@ -16,7 +33,7 @@

- +
@@ -24,7 +41,7 @@ - +
${col} ${col} ${it.formatNumber(col)}