forked from LupusNobilis/java-org.hwo.ui
added static doubleToTimeFormat method to TimePlotLabeler
parent
632781caad
commit
7004f6ef5a
|
@ -32,6 +32,10 @@ public class TimePlotLabeler implements PlotLabeler{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAbzisseLabel(JDiagram diagram, Double pos) {
|
public String getAbzisseLabel(JDiagram diagram, Double pos) {
|
||||||
|
return doubleSecToString(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String doubleSecToString(Double pos) {
|
||||||
//pos == seconds
|
//pos == seconds
|
||||||
int hour, minute, second, millisecond;
|
int hour, minute, second, millisecond;
|
||||||
hour = (int)(pos / 3600);
|
hour = (int)(pos / 3600);
|
||||||
|
@ -43,8 +47,6 @@ public class TimePlotLabeler implements PlotLabeler{
|
||||||
sm = minute < 10? String.format("0%d", minute) : String.format("%d", minute);
|
sm = minute < 10? String.format("0%d", minute) : String.format("%d", minute);
|
||||||
ss = second < 10? String.format("0%d", second) : String.format("%d", second);
|
ss = second < 10? String.format("0%d", second) : String.format("%d", second);
|
||||||
sms = millisecond < 10? String.format("0%d", millisecond) : String.format("%d", millisecond);
|
sms = millisecond < 10? String.format("0%d", millisecond) : String.format("%d", millisecond);
|
||||||
|
|
||||||
return sh + ":" + sm + ":" + ss + "." + sms;
|
return sh + ":" + sm + ":" + ss + "." + sms;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue