draw better dashboard images

Scaling big plots to small thumbnails results in bad images that barely
show any details.
We solve this by calling gnuplot a second time to generate the
thumbnails. They don't have any labels and are rendered in the required
size, so that not scaling is necessary.
Thumbnails have to be requested explicitly, because it can be expensive
to compute them.
This commit is contained in:
2018-05-01 07:54:10 +02:00
parent f573436219
commit bfcbd0a451
9 changed files with 109 additions and 96 deletions

View File

@@ -130,7 +130,7 @@ public class PdbController implements HardcodedValues, PropertyKeys {
final String thumbnailUrl = result.getThumbnailPath() != null
? WEB_IMAGE_OUTPUT_PATH + "/" + result.getThumbnailName()
: imageUrl;
: "img/no-thumbnail.png";
final PlotResponseStats stats = PlotResponseStats.fromDataSeries(result.getDataSeries());
final PlotResponse plotResponse = new PlotResponse(stats, imageUrl, thumbnailUrl);
@@ -184,6 +184,7 @@ public class PdbController implements HardcodedValues, PropertyKeys {
plotSettings.setPlotType(plotType);
plotSettings.setAggregate(PlotSettingsTransformer.toAggregateInternal(aggregate));
plotSettings.setKeyOutside(keyOutside);
plotSettings.setGenerateThumbnail(false);
if (plotterLock.tryLock()) {
try {

View File

@@ -26,6 +26,7 @@ class PlotSettingsTransformer {
result.setKeyOutside(request.isKeyOutside());
result.setThumbnailMaxWidth(request.getThumbnailMaxWidth());
result.setThumbnailMaxHeight(request.getThumbnailMaxHeight());
result.setGenerateThumbnail(request.isGenerateThumbnail());
return result;
}

View File

@@ -35,6 +35,8 @@ public class PlotRequest {
private boolean keyOutside;
private boolean generateThumbnail;
public String getQuery() {
return query;
}
@@ -154,4 +156,13 @@ public class PlotRequest {
public boolean isKeyOutside() {
return keyOutside;
}
public boolean isGenerateThumbnail() {
return generateThumbnail;
}
public void setGenerateThumbnail(final boolean generateThumbnail) {
this.generateThumbnail = generateThumbnail;
}
}