added static doubleToTimeFormat method to TimePlotLabeler

master
Niclas Thobaben 2018-02-14 12:06:33 +01:00 committed by Harald Wolff
parent 632781caad
commit 7004f6ef5a
1 changed files with 4 additions and 2 deletions

View File

@ -32,6 +32,10 @@ public class TimePlotLabeler implements PlotLabeler{
@Override
public String getAbzisseLabel(JDiagram diagram, Double pos) {
return doubleSecToString(pos);
}
public static String doubleSecToString(Double pos) {
//pos == seconds
int hour, minute, second, millisecond;
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);
ss = second < 10? String.format("0%d", second) : String.format("%d", second);
sms = millisecond < 10? String.format("0%d", millisecond) : String.format("%d", millisecond);
return sh + ":" + sm + ":" + ss + "." + sms;
}
}