fix image creation for automatic y-range

This commit is contained in:
2019-11-10 14:22:22 +01:00
parent 4367323fcd
commit 0fb7a0aaf6

View File

@@ -36,6 +36,11 @@ public class GnuplotFileGenerator {
final int min = Math.max(settings.getYRangeMin(), graphOffset); final int min = Math.max(settings.getYRangeMin(), graphOffset);
final int max = settings.getYRangeMax(); final int max = settings.getYRangeMax();
appendfln(result, String.format("set yrange [\"%d\":\"%d\"]", min, max)); appendfln(result, String.format("set yrange [\"%d\":\"%d\"]", min, max));
} else if(dataSeries.isEmpty()) {
// If there is no data, then Gnuplot won't generate an image.
// Workaround is to explicitly specify the y-axis range.
// We choose a range for which no ticks are defined. This creates an empty y-axis.
appendfln(result, "set yrange [\"%d\":\"%d\"]", 0, -1);
}else { }else {
appendfln(result, "set yrange [\"" + graphOffset + "\":]"); appendfln(result, "set yrange [\"" + graphOffset + "\":]");
} }