From 3303afd115e3dc2cf18c33c3aa6e767003ed13e0 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Thu, 31 Oct 2019 19:30:29 +0100 Subject: [PATCH] render images without any data on it instead of throwing errors This makes it easier to use the mouse wheel to zoom in. Without it you could zoom into a region that had not data and then had to use the date picker to change the date. --- .../org/lucares/recommind/logs/GnuplotFileGenerator.java | 6 +++++- .../src/main/java/org/lucares/recommind/logs/Plotter.java | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pdb-plotting/src/main/java/org/lucares/recommind/logs/GnuplotFileGenerator.java b/pdb-plotting/src/main/java/org/lucares/recommind/logs/GnuplotFileGenerator.java index bd1589d..cddfe03 100644 --- a/pdb-plotting/src/main/java/org/lucares/recommind/logs/GnuplotFileGenerator.java +++ b/pdb-plotting/src/main/java/org/lucares/recommind/logs/GnuplotFileGenerator.java @@ -103,7 +103,11 @@ public class GnuplotFileGenerator { appendf(result, "plot "); - settings.getAggregates().addPlots(result, dataSeries); + settings.getAggregates().addPlots(result, dataSeries); + + // Add a plot outside of the visible range. Without this gnuplot would not + // render images when there are not data points on it. + appendf(result, "-1 with lines notitle"); return result.toString(); } diff --git a/pdb-plotting/src/main/java/org/lucares/recommind/logs/Plotter.java b/pdb-plotting/src/main/java/org/lucares/recommind/logs/Plotter.java index 4d7735e..5c2c341 100644 --- a/pdb-plotting/src/main/java/org/lucares/recommind/logs/Plotter.java +++ b/pdb-plotting/src/main/java/org/lucares/recommind/logs/Plotter.java @@ -97,10 +97,6 @@ public class Plotter { }); METRICS_LOGGER.debug("csv generation took: " + (System.nanoTime() - start) / 1_000_000.0 + "ms"); - if (dataSeries.isEmpty()) { - throw new NoDataPointsException(); - } - final Limit limitBy = plotSettings.getLimitBy(); final int limit = plotSettings.getLimit(); DataSeries.sortAndLimit(dataSeries, limitBy, limit);