show fullscreen image
This commit is contained in:
@@ -2,17 +2,25 @@ package org.lucares.recommind.logs;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class PlotResult {
|
||||
private final Path imagePath;
|
||||
private final List<DataSeries> dataSeries;
|
||||
private final Path thumbnail;
|
||||
private final Map<String, Path> renderedImages;
|
||||
|
||||
public PlotResult(final Path imagePath, final List<DataSeries> dataSeries, final Path thumbnail) {
|
||||
public PlotResult(final Path imagePath, final List<DataSeries> dataSeries, final Path thumbnail,
|
||||
final Map<String, Path> renderedImages) {
|
||||
super();
|
||||
this.imagePath = imagePath;
|
||||
this.dataSeries = dataSeries;
|
||||
this.thumbnail = thumbnail;
|
||||
this.renderedImages = renderedImages;
|
||||
}
|
||||
|
||||
public Map<String, Path> getRenderedImages() {
|
||||
return renderedImages;
|
||||
}
|
||||
|
||||
public Path getImageName() {
|
||||
|
||||
@@ -8,9 +8,12 @@ import java.time.OffsetDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
@@ -26,6 +29,7 @@ import org.lucares.pdb.api.Tags;
|
||||
import org.lucares.pdb.plot.api.AggregatorCollection;
|
||||
import org.lucares.pdb.plot.api.Limit;
|
||||
import org.lucares.pdb.plot.api.PlotSettings;
|
||||
import org.lucares.pdb.plot.api.RenderOptions;
|
||||
import org.lucares.performance.db.PerformanceDb;
|
||||
import org.lucares.utils.file.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
@@ -145,7 +149,26 @@ public class Plotter {
|
||||
thumbnail = null;
|
||||
}
|
||||
|
||||
return new PlotResult(outputFile, dataSeries, thumbnail);
|
||||
final Map<String, Path> renderedImages = new HashMap<>();
|
||||
for (final Entry<String, RenderOptions> renders : plotSettings.getRenders().entrySet()) {
|
||||
final Path file = Files.createTempFile(outputDir, "", ".png");
|
||||
renderedImages.put(renders.getKey(), file);
|
||||
final RenderOptions renderOptions = renders.getValue();
|
||||
|
||||
final Gnuplot gnuplot = new Gnuplot(tmpBaseDir);
|
||||
final GnuplotSettings gnuplotSettings = new GnuplotSettings(file);
|
||||
gnuplotSettings.setHeight(renderOptions.getHeight());
|
||||
gnuplotSettings.setWidth(renderOptions.getWidth());
|
||||
gnuplotSettings.setDateTimeRange(plotSettings.dateRange());
|
||||
gnuplotSettings.setY1(plotSettings.getY1());
|
||||
gnuplotSettings.setY2(plotSettings.getY2());
|
||||
gnuplotSettings.setAggregates(plotSettings.getAggregates());
|
||||
gnuplotSettings.setKeyOutside(renderOptions.isKeyOutside());
|
||||
gnuplotSettings.renderLabels(renderOptions.isRenderLabels());
|
||||
gnuplot.plot(gnuplotSettings, dataSeries);
|
||||
}
|
||||
|
||||
return new PlotResult(outputFile, dataSeries, thumbnail, renderedImages);
|
||||
} catch (final InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new AbortException();
|
||||
|
||||
Reference in New Issue
Block a user