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,7 +36,12 @@ public class GnuplotFileGenerator {
final int min = Math.max(settings.getYRangeMin(), graphOffset);
final int max = settings.getYRangeMax();
appendfln(result, String.format("set yrange [\"%d\":\"%d\"]", min, max));
} else {
} 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 {
appendfln(result, "set yrange [\"" + graphOffset + "\":]");
}