automatically determine which axis a plot needs
This commit is contained in:
@@ -10,7 +10,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
public class AxisSettings {
|
||||
|
||||
public enum Type {
|
||||
Number, Time
|
||||
Number, Time, Duration
|
||||
}
|
||||
|
||||
private String format = "";
|
||||
@@ -179,7 +179,5 @@ public class AxisSettings {
|
||||
} catch (JsonProcessingException e) {
|
||||
return e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ public class AxisTime {
|
||||
public static AxisSettings createYAxis(GnuplotSettings settings, Collection<DataSeries> dataSeries) {
|
||||
AxisSettings result = new AxisSettings();
|
||||
result.setLabel("Duration");
|
||||
result.setType(Type.Duration);
|
||||
result.setAxis(GnuplotAxis.Y1);
|
||||
result.setTicsEnabled(true);
|
||||
|
||||
|
||||
@@ -1,28 +1,43 @@
|
||||
package org.lucares.recommind.logs;
|
||||
|
||||
public enum GnuplotAxis {
|
||||
X1("x", ""),
|
||||
|
||||
X2("x2", "x2"),
|
||||
|
||||
Y1("y", "y"),
|
||||
|
||||
Y2("y2", "y2");
|
||||
|
||||
private String axis;
|
||||
private String axisNameForTics;
|
||||
X1("x", "x1"),
|
||||
|
||||
private GnuplotAxis(String axis, String axisNameForTics) {
|
||||
this.axis = axis;
|
||||
this.axisNameForTics = axisNameForTics;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return axis;
|
||||
}
|
||||
|
||||
public String getAxisNameForTics() {
|
||||
return axisNameForTics;
|
||||
X2("x2", "x2"),
|
||||
|
||||
Y1("y", "y1"),
|
||||
|
||||
Y2("y2", "y2");
|
||||
|
||||
private String axis;
|
||||
private String axisNameForPlots;
|
||||
|
||||
private GnuplotAxis(String axis, String axisNameForPlots) {
|
||||
this.axis = axis;
|
||||
this.axisNameForPlots = axisNameForPlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return axis;
|
||||
}
|
||||
|
||||
public String getAxisNameForPlots() {
|
||||
return axisNameForPlots;
|
||||
}
|
||||
|
||||
public GnuplotAxis mirrorAxis() {
|
||||
switch (this) {
|
||||
case X1:
|
||||
return X2;
|
||||
case X2:
|
||||
return X1;
|
||||
case Y1:
|
||||
return Y2;
|
||||
case Y2:
|
||||
return Y1;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unexpected value: " + this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user