dashboard #1
@@ -77,12 +77,6 @@ export class DashboardComponent implements OnInit {
|
|||||||
const fullHeight = window.innerHeight-30;
|
const fullHeight = window.innerHeight-30;
|
||||||
|
|
||||||
const request = new PlotRequest(
|
const request = new PlotRequest(
|
||||||
height,
|
|
||||||
width,
|
|
||||||
600, // thumbnailMaxWidth
|
|
||||||
500, // thumbnailMaxHeight
|
|
||||||
false, // keyOutside
|
|
||||||
false, // generateThumbnail
|
|
||||||
(<any>window).submitterId+crypto.randomUUID(),
|
(<any>window).submitterId+crypto.randomUUID(),
|
||||||
plotWidget.config,
|
plotWidget.config,
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Component, OnInit, Input, Output, ViewChild, EventEmitter } from '@angular/core';
|
import { Component, OnInit, Input, Output, ViewChild, EventEmitter } from '@angular/core';
|
||||||
import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar';
|
import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar';
|
||||||
import { PlotService, PlotRequest, PlotResponse, PlotResponseStats, DashTypeAndColor } from '../plot.service';
|
import { PlotService, PlotRequest, PlotResponse, PlotResponseStats, DashTypeAndColor, RenderedImages } from '../plot.service';
|
||||||
import { UtilService } from '../utils.service';
|
import { UtilService } from '../utils.service';
|
||||||
|
|
||||||
export class GalleryFilterData {
|
export class GalleryFilterData {
|
||||||
@@ -241,9 +241,7 @@ export class GalleryViewComponent implements OnInit {
|
|||||||
this.submitterId = request.submitterId;
|
this.submitterId = request.submitterId;
|
||||||
this.galleryItems.length = 0;
|
this.galleryItems.length = 0;
|
||||||
this.splitByValuesQueue.length = 0;
|
this.splitByValuesQueue.length = 0;
|
||||||
|
|
||||||
request.generateThumbnail = true;
|
|
||||||
|
|
||||||
this.plotService.splitQuery(request.config.query, splitByField).subscribe({
|
this.plotService.splitQuery(request.config.query, splitByField).subscribe({
|
||||||
next: function(valuesForSplitBy){
|
next: function(valuesForSplitBy){
|
||||||
console.log("valuesForSplitBy: " + JSON.stringify(valuesForSplitBy));
|
console.log("valuesForSplitBy: " + JSON.stringify(valuesForSplitBy));
|
||||||
@@ -283,8 +281,8 @@ export class GalleryViewComponent implements OnInit {
|
|||||||
|
|
||||||
that.progress = 100 * (that.totalNumberImages - that.splitByValuesQueue.length) / that.totalNumberImages;
|
that.progress = 100 * (that.totalNumberImages - that.splitByValuesQueue.length) / that.totalNumberImages;
|
||||||
|
|
||||||
plotResponse.thumbnailUrl = "//"+window.location.hostname+':'+window.location.port+'/'+plotResponse.rendered['thumbnail'];
|
//plotResponse.thumbnailUrl = "//"+window.location.hostname+':'+window.location.port+'/'+plotResponse.rendered['thumbnail'];
|
||||||
plotResponse.imageUrl = "//"+window.location.hostname+':'+window.location.port+'/'+plotResponse.rendered['main'];
|
//plotResponse.imageUrl = "//"+window.location.hostname+':'+window.location.port+'/'+plotResponse.rendered['main'];
|
||||||
let galleryItem = new GalleryItem(splitByValue, plotResponse);
|
let galleryItem = new GalleryItem(splitByValue, plotResponse);
|
||||||
that.galleryItems.push(galleryItem);
|
that.galleryItems.push(galleryItem);
|
||||||
that.sortAndFilterGallery();
|
that.sortAndFilterGallery();
|
||||||
@@ -342,16 +340,16 @@ export class GalleryItemView {
|
|||||||
|
|
||||||
|
|
||||||
export class GalleryItem {
|
export class GalleryItem {
|
||||||
thumbnailUrl: string;
|
|
||||||
imageUrl: string;
|
|
||||||
stats: PlotResponseStats;
|
stats: PlotResponseStats;
|
||||||
splitByValue : string;
|
splitByValue : string;
|
||||||
|
imageUrl: string;
|
||||||
|
thumbnailUrl :string;
|
||||||
show : boolean = false;
|
show : boolean = false;
|
||||||
|
|
||||||
constructor(splitByValue: string, plotResponse: PlotResponse){
|
constructor(splitByValue: string, plotResponse: PlotResponse){
|
||||||
this.thumbnailUrl = plotResponse.thumbnailUrl;
|
|
||||||
this.imageUrl = plotResponse.imageUrl;
|
|
||||||
this.splitByValue = splitByValue;
|
this.splitByValue = splitByValue;
|
||||||
this.stats = plotResponse.stats;
|
this.stats = plotResponse.stats;
|
||||||
|
this.thumbnailUrl = "//"+window.location.hostname+':'+window.location.port+'/'+plotResponse.rendered['thumbnail'];
|
||||||
|
this.imageUrl = "//"+window.location.hostname+':'+window.location.port+'/'+plotResponse.rendered['main'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,12 +275,6 @@ export class PlotViewComponent implements OnInit {
|
|||||||
const actualDimension = typeof dimension === "function" ? dimension() : dimension;
|
const actualDimension = typeof dimension === "function" ? dimension() : dimension;
|
||||||
|
|
||||||
const request = new PlotRequest(
|
const request = new PlotRequest(
|
||||||
actualDimension.height,
|
|
||||||
actualDimension.width,
|
|
||||||
300, // thumbnailMaxWidth
|
|
||||||
200, // thumbnailMaxHeight
|
|
||||||
false, // keyOutside
|
|
||||||
false, // generateThumbnail
|
|
||||||
(<any>window).submitterId,
|
(<any>window).submitterId,
|
||||||
this.config!,
|
this.config!,
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -215,12 +215,6 @@ export type RenderedImages = {
|
|||||||
|
|
||||||
export class PlotRequest {
|
export class PlotRequest {
|
||||||
constructor(
|
constructor(
|
||||||
public height : number,
|
|
||||||
public width : number,
|
|
||||||
public thumbnailMaxWidth : number = 300,
|
|
||||||
public thumbnailMaxHeight : number = 200,
|
|
||||||
public keyOutside : boolean = false,
|
|
||||||
public generateThumbnail : boolean,
|
|
||||||
public submitterId: string,
|
public submitterId: string,
|
||||||
public config: PlotConfig,
|
public config: PlotConfig,
|
||||||
public renders: RenderOptionsMap
|
public renders: RenderOptionsMap
|
||||||
@@ -264,9 +258,7 @@ export class YAxisDefinition {
|
|||||||
|
|
||||||
export class PlotResponse {
|
export class PlotResponse {
|
||||||
constructor(
|
constructor(
|
||||||
public imageUrl : string,
|
|
||||||
public stats : PlotResponseStats,
|
public stats : PlotResponseStats,
|
||||||
public thumbnailUrl : string,
|
|
||||||
public rendered: RenderedImages){}
|
public rendered: RenderedImages){}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -198,12 +198,6 @@ export class VisualizationPageComponent implements OnInit {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const request = new PlotRequest(
|
const request = new PlotRequest(
|
||||||
results != null ? results.offsetHeight-1: 1024,
|
|
||||||
results != null ? results.offsetWidth-1 : 1024,
|
|
||||||
300, // thumbnailMaxWidth
|
|
||||||
200, // thumbnailMaxHeight
|
|
||||||
false, // keyOutside
|
|
||||||
this.enableGallery, // generateThumbnail
|
|
||||||
(<any>window).submitterId,
|
(<any>window).submitterId,
|
||||||
config,
|
config,
|
||||||
renderOptions
|
renderOptions
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public class BarChartAggregatorForIntervals implements CustomAggregator, Indexed
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean showLabel(final int index, final int numberOfBuckets) {
|
private boolean showLabel(final int index, final int numberOfBuckets) {
|
||||||
final int width = settings.getWidth();
|
final int width = settings.getMaxWidth();
|
||||||
final int widthInPx = width - GnuplotSettings.GNUPLOT_LEFT_RIGHT_MARGIN;
|
final int widthInPx = width - GnuplotSettings.GNUPLOT_LEFT_RIGHT_MARGIN;
|
||||||
|
|
||||||
final long maxLabels = Math.max(1, widthInPx / (GnuplotSettings.TICKS_FONT_SIZE * 8));
|
final long maxLabels = Math.max(1, widthInPx / (GnuplotSettings.TICKS_FONT_SIZE * 8));
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class HistogramAggregator implements CustomAggregator {
|
|||||||
final char separator = ',';
|
final char separator = ',';
|
||||||
final char newline = '\n';
|
final char newline = '\n';
|
||||||
|
|
||||||
final int numBins = plotSettings.getWidth() / 8;
|
final int numBins = plotSettings.getMaxWidth() / 8;
|
||||||
final int binWidth = Math.max((int) (max) / numBins, 1);
|
final int binWidth = Math.max((int) (max) / numBins, 1);
|
||||||
|
|
||||||
final ToBins toBins = new ToBins(numBins, binWidth);
|
final ToBins toBins = new ToBins(numBins, binWidth);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
import org.lucares.pdb.api.DateTimeRange;
|
import org.lucares.pdb.api.DateTimeRange;
|
||||||
import org.lucares.recommind.logs.GnuplotAxis;
|
import org.lucares.recommind.logs.GnuplotAxis;
|
||||||
|
import org.lucares.recommind.logs.GnuplotSettings;
|
||||||
import org.lucares.utils.Preconditions;
|
import org.lucares.utils.Preconditions;
|
||||||
|
|
||||||
public class PlotSettings {
|
public class PlotSettings {
|
||||||
@@ -20,14 +21,6 @@ public class PlotSettings {
|
|||||||
|
|
||||||
private String query;
|
private String query;
|
||||||
|
|
||||||
private int height;
|
|
||||||
|
|
||||||
private int width;
|
|
||||||
|
|
||||||
private int thumbnailMaxWidth = 0;
|
|
||||||
|
|
||||||
private int thumbnailMaxHeight = 0;
|
|
||||||
|
|
||||||
private List<String> groupBy;
|
private List<String> groupBy;
|
||||||
|
|
||||||
private Limit limitBy;
|
private Limit limitBy;
|
||||||
@@ -41,10 +34,6 @@ public class PlotSettings {
|
|||||||
|
|
||||||
private AggregateHandlerCollection aggregates;
|
private AggregateHandlerCollection aggregates;
|
||||||
|
|
||||||
private boolean keyOutside;
|
|
||||||
|
|
||||||
private boolean generateThumbnail;
|
|
||||||
|
|
||||||
private Interval interval;
|
private Interval interval;
|
||||||
|
|
||||||
private boolean renderBarChartTickLabels;
|
private boolean renderBarChartTickLabels;
|
||||||
@@ -67,38 +56,6 @@ public class PlotSettings {
|
|||||||
this.query = query;
|
this.query = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHeight() {
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHeight(final int height) {
|
|
||||||
this.height = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWidth() {
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWidth(final int width) {
|
|
||||||
this.width = width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getThumbnailMaxWidth() {
|
|
||||||
return thumbnailMaxWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setThumbnailMaxWidth(final int thumbnailMaxWidth) {
|
|
||||||
this.thumbnailMaxWidth = thumbnailMaxWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getThumbnailMaxHeight() {
|
|
||||||
return thumbnailMaxHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setThumbnailMaxHeight(final int thumbnailMaxHeight) {
|
|
||||||
this.thumbnailMaxHeight = thumbnailMaxHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getGroupBy() {
|
public List<String> getGroupBy() {
|
||||||
return groupBy;
|
return groupBy;
|
||||||
}
|
}
|
||||||
@@ -145,11 +102,9 @@ public class PlotSettings {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "PlotSettings [query=" + query + ", height=" + height + ", width=" + width + ", thumbnailMaxWidth="
|
return "PlotSettings [query=" + query + ", groupBy=" + groupBy + ", limitBy=" + limitBy + ", limit=" + limit
|
||||||
+ thumbnailMaxWidth + ", thumbnailMaxHeight=" + thumbnailMaxHeight + ", groupBy=" + groupBy
|
+ ", dateRangeAsString=" + dateRangeAsString + ", y1=" + y1 + " y2=" + y2 + ", aggregates=" + aggregates
|
||||||
+ ", limitBy=" + limitBy + ", limit=" + limit + ", dateRangeAsString=" + dateRangeAsString + ", y1="
|
+ ", renders=" + renders + "]";
|
||||||
+ y1 + " y2=" + y2 + ", aggregates=" + aggregates + ", keyOutside=" + keyOutside
|
|
||||||
+ ", generateThumbnail=" + generateThumbnail + "]";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAggregates(final AggregateHandlerCollection aggregates) {
|
public void setAggregates(final AggregateHandlerCollection aggregates) {
|
||||||
@@ -160,22 +115,6 @@ public class PlotSettings {
|
|||||||
return aggregates;
|
return aggregates;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeyOutside(final boolean keyOutside) {
|
|
||||||
this.keyOutside = keyOutside;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isKeyOutside() {
|
|
||||||
return keyOutside;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGenerateThumbnail(final boolean generateThumbnail) {
|
|
||||||
this.generateThumbnail = generateThumbnail;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isGenerateThumbnail() {
|
|
||||||
return generateThumbnail;
|
|
||||||
}
|
|
||||||
|
|
||||||
public YAxisDefinition getY1() {
|
public YAxisDefinition getY1() {
|
||||||
return y1;
|
return y1;
|
||||||
}
|
}
|
||||||
@@ -219,4 +158,32 @@ public class PlotSettings {
|
|||||||
this.renderBarChartTickLabels = renderBarChartTickLabels;
|
this.renderBarChartTickLabels = renderBarChartTickLabels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getMaxWidth() {
|
||||||
|
int maxWidth = 1;
|
||||||
|
|
||||||
|
for (final RenderOptions renderOptions : renders.values()) {
|
||||||
|
int width = renderOptions.getWidth();
|
||||||
|
if (renderOptions.isRenderLabels()) {
|
||||||
|
width -= GnuplotSettings.GNUPLOT_LEFT_RIGHT_MARGIN;
|
||||||
|
}
|
||||||
|
maxWidth = Math.max(maxWidth, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
return maxWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxHeight() {
|
||||||
|
int maxHeight = 1;
|
||||||
|
|
||||||
|
for (final RenderOptions renderOptions : renders.values()) {
|
||||||
|
int height = renderOptions.getHeight();
|
||||||
|
if (renderOptions.isRenderLabels()) {
|
||||||
|
height -= GnuplotSettings.GNUPLOT_TOP_BOTTOM_MARGIN;
|
||||||
|
}
|
||||||
|
maxHeight = Math.max(maxHeight, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
return maxHeight;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import org.lucares.collections.Sparse2DLongArray;
|
import org.lucares.collections.Sparse2DLongArray;
|
||||||
import org.lucares.pdb.api.RuntimeIOException;
|
import org.lucares.pdb.api.RuntimeIOException;
|
||||||
import org.lucares.recommind.logs.GnuplotAxis;
|
import org.lucares.recommind.logs.GnuplotAxis;
|
||||||
import org.lucares.recommind.logs.GnuplotSettings;
|
|
||||||
import org.lucares.recommind.logs.LambdaFriendlyWriter;
|
import org.lucares.recommind.logs.LambdaFriendlyWriter;
|
||||||
import org.lucares.recommind.logs.LongUtils;
|
import org.lucares.recommind.logs.LongUtils;
|
||||||
|
|
||||||
@@ -38,8 +37,8 @@ public class ScatterAggregator implements CustomAggregator {
|
|||||||
|
|
||||||
this.tmpDir = tmpDir;
|
this.tmpDir = tmpDir;
|
||||||
useMillis = (toEpochMilli - fromEpochMilli) < TimeUnit.MINUTES.toMillis(5);
|
useMillis = (toEpochMilli - fromEpochMilli) < TimeUnit.MINUTES.toMillis(5);
|
||||||
plotAreaWidthInPx = plotSettings.getWidth() - GnuplotSettings.GNUPLOT_LEFT_RIGHT_MARGIN;
|
plotAreaWidthInPx = plotSettings.getMaxWidth();
|
||||||
plotAreaHeightInPx = plotSettings.getHeight() - GnuplotSettings.GNUPLOT_TOP_BOTTOM_MARGIN;
|
plotAreaHeightInPx = plotSettings.getMaxHeight();
|
||||||
epochMillisPerPixel = Math.max(1, (toEpochMilli - fromEpochMilli) / plotAreaWidthInPx);
|
epochMillisPerPixel = Math.max(1, (toEpochMilli - fromEpochMilli) / plotAreaWidthInPx);
|
||||||
|
|
||||||
final YAxisDefinition yAxisDefinition = plotSettings.getyAxisDefinition(yAxis);
|
final YAxisDefinition yAxisDefinition = plotSettings.getyAxisDefinition(yAxis);
|
||||||
|
|||||||
@@ -5,17 +5,13 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class PlotResult {
|
public class PlotResult {
|
||||||
private final Path imagePath;
|
|
||||||
private final List<DataSeries> dataSeries;
|
private final List<DataSeries> dataSeries;
|
||||||
private final Path thumbnail;
|
|
||||||
private final Map<String, Path> renderedImages;
|
private final Map<String, Path> renderedImages;
|
||||||
|
|
||||||
public PlotResult(final Path imagePath, final List<DataSeries> dataSeries, final Path thumbnail,
|
public PlotResult(final List<DataSeries> dataSeries, final Map<String, Path> renderedImages) {
|
||||||
final Map<String, Path> renderedImages) {
|
|
||||||
super();
|
|
||||||
this.imagePath = imagePath;
|
|
||||||
this.dataSeries = dataSeries;
|
this.dataSeries = dataSeries;
|
||||||
this.thumbnail = thumbnail;
|
|
||||||
this.renderedImages = renderedImages;
|
this.renderedImages = renderedImages;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,22 +19,6 @@ public class PlotResult {
|
|||||||
return renderedImages;
|
return renderedImages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Path getImageName() {
|
|
||||||
return imagePath.getFileName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Path getImagePath() {
|
|
||||||
return imagePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Path getThumbnailName() {
|
|
||||||
return thumbnail.getFileName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Path getThumbnailPath() {
|
|
||||||
return thumbnail;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DataSeries> getDataSeries() {
|
public List<DataSeries> getDataSeries() {
|
||||||
return dataSeries;
|
return dataSeries;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,8 +73,6 @@ public class Plotter {
|
|||||||
|
|
||||||
final String query = plotSettings.getQuery();
|
final String query = plotSettings.getQuery();
|
||||||
final List<String> groupBy = plotSettings.getGroupBy();
|
final List<String> groupBy = plotSettings.getGroupBy();
|
||||||
final int height = plotSettings.getHeight();
|
|
||||||
final int width = plotSettings.getWidth();
|
|
||||||
final DateTimeRange dateRange = plotSettings.dateRange();
|
final DateTimeRange dateRange = plotSettings.dateRange();
|
||||||
final OffsetDateTime dateFrom = dateRange.getStart();
|
final OffsetDateTime dateFrom = dateRange.getStart();
|
||||||
final OffsetDateTime dateTo = dateRange.getEnd();
|
final OffsetDateTime dateTo = dateRange.getEnd();
|
||||||
@@ -114,41 +112,6 @@ public class Plotter {
|
|||||||
DataSeries.sortAndLimit(dataSeries, limitBy, limit);
|
DataSeries.sortAndLimit(dataSeries, limitBy, limit);
|
||||||
DataSeries.setColors(dataSeries);
|
DataSeries.setColors(dataSeries);
|
||||||
|
|
||||||
final Path outputFile = Files.createTempFile(outputDir, "", ".png");
|
|
||||||
{
|
|
||||||
final Gnuplot gnuplot = new Gnuplot(tmpBaseDir);
|
|
||||||
final GnuplotSettings gnuplotSettings = new GnuplotSettings(outputFile);
|
|
||||||
gnuplotSettings.setHeight(height);
|
|
||||||
gnuplotSettings.setWidth(width);
|
|
||||||
gnuplotSettings.setDateTimeRange(plotSettings.dateRange());
|
|
||||||
|
|
||||||
gnuplotSettings.setY1(plotSettings.getY1());
|
|
||||||
gnuplotSettings.setY2(plotSettings.getY2());
|
|
||||||
|
|
||||||
gnuplotSettings.setAggregates(plotSettings.getAggregates());
|
|
||||||
gnuplotSettings.setKeyOutside(plotSettings.isKeyOutside());
|
|
||||||
gnuplotSettings.setRenderBarChartTickLabels(plotSettings.isRenderBarChartTickLabels());
|
|
||||||
gnuplot.plot(gnuplotSettings, dataSeries);
|
|
||||||
}
|
|
||||||
|
|
||||||
final Path thumbnail;
|
|
||||||
if (plotSettings.isGenerateThumbnail()) {
|
|
||||||
thumbnail = Files.createTempFile(outputDir, "", ".png");
|
|
||||||
final Gnuplot gnuplot = new Gnuplot(tmpBaseDir);
|
|
||||||
final GnuplotSettings gnuplotSettings = new GnuplotSettings(thumbnail);
|
|
||||||
gnuplotSettings.setHeight(plotSettings.getThumbnailMaxHeight());
|
|
||||||
gnuplotSettings.setWidth(plotSettings.getThumbnailMaxWidth());
|
|
||||||
gnuplotSettings.setDateTimeRange(plotSettings.dateRange());
|
|
||||||
gnuplotSettings.setY1(plotSettings.getY1());
|
|
||||||
gnuplotSettings.setY2(plotSettings.getY2());
|
|
||||||
gnuplotSettings.setAggregates(plotSettings.getAggregates());
|
|
||||||
gnuplotSettings.setKeyOutside(false);
|
|
||||||
gnuplotSettings.renderLabels(false);
|
|
||||||
gnuplot.plot(gnuplotSettings, dataSeries);
|
|
||||||
} else {
|
|
||||||
thumbnail = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Map<String, Path> renderedImages = new HashMap<>();
|
final Map<String, Path> renderedImages = new HashMap<>();
|
||||||
for (final Entry<String, RenderOptions> renders : plotSettings.getRenders().entrySet()) {
|
for (final Entry<String, RenderOptions> renders : plotSettings.getRenders().entrySet()) {
|
||||||
final Path file = Files.createTempFile(outputDir, "", ".png");
|
final Path file = Files.createTempFile(outputDir, "", ".png");
|
||||||
@@ -168,7 +131,7 @@ public class Plotter {
|
|||||||
gnuplot.plot(gnuplotSettings, dataSeries);
|
gnuplot.plot(gnuplotSettings, dataSeries);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PlotResult(outputFile, dataSeries, thumbnail, renderedImages);
|
return new PlotResult(dataSeries, renderedImages);
|
||||||
} catch (final InterruptedException e) {
|
} catch (final InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
throw new AbortException();
|
throw new AbortException();
|
||||||
|
|||||||
@@ -117,13 +117,6 @@ public class PdbController implements HardcodedValues, PropertyKeys {
|
|||||||
try {
|
try {
|
||||||
final PlotResult result = plotter.plot(plotSettings);
|
final PlotResult result = plotter.plot(plotSettings);
|
||||||
|
|
||||||
final String imageUrl = WEB_IMAGE_OUTPUT_PATH + "/" + result.getImageName();
|
|
||||||
LOGGER.trace("image url: {}", imageUrl);
|
|
||||||
|
|
||||||
final String thumbnailUrl = result.getThumbnailPath() != null
|
|
||||||
? WEB_IMAGE_OUTPUT_PATH + "/" + result.getThumbnailName()
|
|
||||||
: "img/no-thumbnail.png";
|
|
||||||
|
|
||||||
final Map<String, String> rendered = new HashMap<>();
|
final Map<String, String> rendered = new HashMap<>();
|
||||||
for (final Entry<String, Path> renderedImageEntry : result.getRenderedImages().entrySet()) {
|
for (final Entry<String, Path> renderedImageEntry : result.getRenderedImages().entrySet()) {
|
||||||
final String url = WEB_IMAGE_OUTPUT_PATH + "/"
|
final String url = WEB_IMAGE_OUTPUT_PATH + "/"
|
||||||
@@ -133,7 +126,7 @@ public class PdbController implements HardcodedValues, PropertyKeys {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final PlotResponseStats stats = PlotResponseStats.fromDataSeries(result.getDataSeries());
|
final PlotResponseStats stats = PlotResponseStats.fromDataSeries(result.getDataSeries());
|
||||||
final PlotResponse plotResponse = new PlotResponse(stats, imageUrl, thumbnailUrl, rendered);
|
final PlotResponse plotResponse = new PlotResponse(stats, rendered);
|
||||||
|
|
||||||
return ResponseEntity.ok().body(plotResponse);
|
return ResponseEntity.ok().body(plotResponse);
|
||||||
} catch (final NoDataPointsException e) {
|
} catch (final NoDataPointsException e) {
|
||||||
|
|||||||
@@ -23,16 +23,10 @@ class PlotSettingsTransformer {
|
|||||||
final PlotConfig config = request.getConfig();
|
final PlotConfig config = request.getConfig();
|
||||||
result.setQuery(config.getQuery());
|
result.setQuery(config.getQuery());
|
||||||
result.setGroupBy(config.getGroupBy());
|
result.setGroupBy(config.getGroupBy());
|
||||||
result.setHeight(request.getHeight());
|
|
||||||
result.setWidth(request.getWidth());
|
|
||||||
result.setLimit(config.getLimit());
|
result.setLimit(config.getLimit());
|
||||||
result.setLimitBy(config.getLimitBy());
|
result.setLimitBy(config.getLimitBy());
|
||||||
result.setDateRange(config.getDateRange());
|
result.setDateRange(config.getDateRange());
|
||||||
|
|
||||||
result.setKeyOutside(request.isKeyOutside());
|
|
||||||
result.setThumbnailMaxWidth(request.getThumbnailMaxWidth());
|
|
||||||
result.setThumbnailMaxHeight(request.getThumbnailMaxHeight());
|
|
||||||
result.setGenerateThumbnail(request.isGenerateThumbnail());
|
|
||||||
result.setY1(config.getY1());
|
result.setY1(config.getY1());
|
||||||
result.setY2(config.getY2());
|
result.setY2(config.getY2());
|
||||||
result.setAggregates(toAggregateInternal(config.getY1(), config.getY2(), config.getAggregates()));
|
result.setAggregates(toAggregateInternal(config.getY1(), config.getY2(), config.getAggregates()));
|
||||||
|
|||||||
@@ -6,17 +6,6 @@ import java.util.TreeMap;
|
|||||||
import org.lucares.pdb.plot.api.RenderOptions;
|
import org.lucares.pdb.plot.api.RenderOptions;
|
||||||
|
|
||||||
public class PlotRequest {
|
public class PlotRequest {
|
||||||
|
|
||||||
private int height = 1000;
|
|
||||||
|
|
||||||
private int width = 1000;
|
|
||||||
|
|
||||||
private int thumbnailMaxWidth = 0;
|
|
||||||
|
|
||||||
private int thumbnailMaxHeight = 0;
|
|
||||||
|
|
||||||
private boolean generateThumbnail;
|
|
||||||
private boolean keyOutside;
|
|
||||||
private String submitterId;
|
private String submitterId;
|
||||||
|
|
||||||
private PlotConfig config;
|
private PlotConfig config;
|
||||||
@@ -39,54 +28,6 @@ public class PlotRequest {
|
|||||||
this.config = config;
|
this.config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWidth() {
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWidth(final int width) {
|
|
||||||
this.width = width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHeight() {
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHeight(final int height) {
|
|
||||||
this.height = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getThumbnailMaxWidth() {
|
|
||||||
return thumbnailMaxWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setThumbnailMaxWidth(final int thumbnailMaxWidth) {
|
|
||||||
this.thumbnailMaxWidth = thumbnailMaxWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getThumbnailMaxHeight() {
|
|
||||||
return thumbnailMaxHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setThumbnailMaxHeight(final int thumbnailMaxHeight) {
|
|
||||||
this.thumbnailMaxHeight = thumbnailMaxHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKeyOutside(final boolean keyOutside) {
|
|
||||||
this.keyOutside = keyOutside;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isKeyOutside() {
|
|
||||||
return keyOutside;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isGenerateThumbnail() {
|
|
||||||
return generateThumbnail;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGenerateThumbnail(final boolean generateThumbnail) {
|
|
||||||
this.generateThumbnail = generateThumbnail;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubmitterId() {
|
public String getSubmitterId() {
|
||||||
return submitterId;
|
return submitterId;
|
||||||
}
|
}
|
||||||
@@ -97,7 +38,7 @@ public class PlotRequest {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return (config != null ? config.getQuery() : "<no query>") + ":" + height + "x" + width;
|
return (config != null ? config.getQuery() : "<no query>");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,16 +3,11 @@ package org.lucares.pdbui.domain;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class PlotResponse {
|
public class PlotResponse {
|
||||||
private String imageUrl = "";
|
|
||||||
private PlotResponseStats stats;
|
private PlotResponseStats stats;
|
||||||
private String thumbnailUrl;
|
|
||||||
private final Map<String, String> rendered;
|
private final Map<String, String> rendered;
|
||||||
|
|
||||||
public PlotResponse(final PlotResponseStats stats, final String imageUrl, final String thumbnailUrl,
|
public PlotResponse(final PlotResponseStats stats, final Map<String, String> rendered) {
|
||||||
final Map<String, String> rendered) {
|
|
||||||
this.stats = stats;
|
this.stats = stats;
|
||||||
this.imageUrl = imageUrl;
|
|
||||||
this.thumbnailUrl = thumbnailUrl;
|
|
||||||
this.rendered = rendered;
|
this.rendered = rendered;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,18 +15,6 @@ public class PlotResponse {
|
|||||||
return rendered;
|
return rendered;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getImageUrl() {
|
|
||||||
return imageUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImageUrl(final String imageUrl) {
|
|
||||||
this.imageUrl = imageUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getThumbnailUrl() {
|
|
||||||
return thumbnailUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PlotResponseStats getStats() {
|
public PlotResponseStats getStats() {
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
@@ -40,13 +23,9 @@ public class PlotResponse {
|
|||||||
this.stats = stats;
|
this.stats = stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setThumbnailUrl(final String thumbnailUrl) {
|
|
||||||
this.thumbnailUrl = thumbnailUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "PlotResponse [imageUrl=" + imageUrl + ", stats=" + stats + ", thumbnailUrl=" + thumbnailUrl + "]";
|
return "PlotResponse [stats=" + stats + ", rendered=" + rendered + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user