diff --git a/pdb-js/src/app/gallery-view/gallery-item-view.component.html b/pdb-js/src/app/gallery-view/gallery-item-view.component.html index ec627eb..41e113b 100644 --- a/pdb-js/src/app/gallery-view/gallery-item-view.component.html +++ b/pdb-js/src/app/gallery-view/gallery-item-view.component.html @@ -1,14 +1,44 @@ -
diff --git a/pdb-js/src/app/gallery-view/gallery-view.component.scss b/pdb-js/src/app/gallery-view/gallery-view.component.scss index 55134af..b04b703 100644 --- a/pdb-js/src/app/gallery-view/gallery-view.component.scss +++ b/pdb-js/src/app/gallery-view/gallery-view.component.scss @@ -18,6 +18,13 @@ padding: 10px; } +.card-grid-100p { + display: grid; + grid-template-columns: repeat(auto-fit, 1fr); + grid-gap: 10px; + padding: 10px; +} + #gallery-progress mat-progress-bar { width: 20em; display: inline-block; diff --git a/pdb-js/src/app/gallery-view/gallery-view.component.ts b/pdb-js/src/app/gallery-view/gallery-view.component.ts index 9c620fb..5ec0a4d 100644 --- a/pdb-js/src/app/gallery-view/gallery-view.component.ts +++ b/pdb-js/src/app/gallery-view/gallery-view.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, Input, Output, ViewChild, EventEmitter } from '@angular/core'; import { MatSnackBar } from '@angular/material/snack-bar'; -import { PlotService, PlotRequest, PlotResponse, PlotResponseStats } from '../plot.service'; +import { PlotService, PlotRequest, PlotResponse, PlotResponseStats, DashTypeAndColor } from '../plot.service'; export class GalleryFilterData { filterBy :string; @@ -110,6 +110,8 @@ export class GalleryViewComponent implements OnInit { totalNumberImages = 0; sequenceId = 0; + + showDetails = false; @ViewChild(GalleryFilterView) filter : GalleryFilterView; @@ -304,6 +306,9 @@ export class GalleryViewComponent implements OnInit { export class GalleryItemView { @Input() data: GalleryItem; + + @Input() + showDetails: boolean = false; showImage: boolean= false; @@ -330,7 +335,15 @@ export class GalleryItemView { return result; } + + pointTypeClass(typeAndColor: DashTypeAndColor): string { + return "gallery-item-plotType gallery-item-plotType_"+typeAndColor.pointType+"_"+typeAndColor.color.toLocaleLowerCase(); + } + toPercent(percentage: number) : string{ + return (Math.round(percentage * 10000) / 100)+"%"; + } + openImage() { this.showImage=true; } diff --git a/pdb-js/src/app/plot.service.ts b/pdb-js/src/app/plot.service.ts index 6eca1de..f48b501 100644 --- a/pdb-js/src/app/plot.service.ts +++ b/pdb-js/src/app/plot.service.ts @@ -231,10 +231,17 @@ export class PlotResponseStats { } export class DataSeriesStats { + name: string; values : number; maxValue : number; average : number; plottedValues : number; + dashTypeAndColor: DashTypeAndColor; +} + +export class DashTypeAndColor { + color: string; + pointType: number; } export class FilterDefaults { diff --git a/pdb-js/src/assets/img/pointTypes.png b/pdb-js/src/assets/img/pointTypes.png new file mode 100644 index 0000000..359ffac Binary files /dev/null and b/pdb-js/src/assets/img/pointTypes.png differ diff --git a/pdb-plotting/src/main/java/org/lucares/recommind/logs/DataSeries.java b/pdb-plotting/src/main/java/org/lucares/recommind/logs/DataSeries.java index 3fc9514..0c9ddb3 100644 --- a/pdb-plotting/src/main/java/org/lucares/recommind/logs/DataSeries.java +++ b/pdb-plotting/src/main/java/org/lucares/recommind/logs/DataSeries.java @@ -98,7 +98,8 @@ public interface DataSeries { final GnuplotColor color = GnuplotColorPalettes.DEFAULT.get(i % numColors); final DashTypes dashType = DashTypes.get(i / numColors); - final LineStyle lineStyle = new LineStyle(color, dashType); + final int pointType = PointTypes.getPointType(i); + final LineStyle lineStyle = new LineStyle(color, dashType, pointType); dataSerie.setStyle(lineStyle); i++; } diff --git a/pdb-plotting/src/main/java/org/lucares/recommind/logs/LineStyle.java b/pdb-plotting/src/main/java/org/lucares/recommind/logs/LineStyle.java index c950dd4..0165ba8 100644 --- a/pdb-plotting/src/main/java/org/lucares/recommind/logs/LineStyle.java +++ b/pdb-plotting/src/main/java/org/lucares/recommind/logs/LineStyle.java @@ -4,16 +4,23 @@ public class LineStyle { private final GnuplotColor color; private final DashTypes dashType; + private final int pointType; - public LineStyle(final GnuplotColor color, final DashTypes dashType) { + public LineStyle(final GnuplotColor color, final DashTypes dashType, final int pointType) { this.color = color; this.dashType = dashType; + this.pointType = pointType; } private String asGnuplotLineStyle(final String colorHex) { - return String.format("lt rgb \"#%s\" dt %s ", // - colorHex, // - dashType.toGnuplotDashType()// + // TODO revert +// return String.format("lt rgb \"#%s\" dt %s ", // +// colorHex, // +// dashType.toGnuplotDashType()// +// ); + + return String.format("lt rgb \"#%s\" ", // + colorHex// ); } @@ -29,6 +36,18 @@ public class LineStyle { return asGnuplotLineStyle("77" + color.getDark()); } + public GnuplotColor getColor() { + return color; + } + + public DashTypes getDashType() { + return dashType; + } + + public int getPointType() { + return pointType; + } + @Override public String toString() { return asGnuplotLineStyle(); diff --git a/pdb-plotting/src/main/java/org/lucares/recommind/logs/PointTypes.java b/pdb-plotting/src/main/java/org/lucares/recommind/logs/PointTypes.java new file mode 100644 index 0000000..5b91d5d --- /dev/null +++ b/pdb-plotting/src/main/java/org/lucares/recommind/logs/PointTypes.java @@ -0,0 +1,9 @@ +package org.lucares.recommind.logs; + +public class PointTypes { + + static int getPointType(final int i) { + return i % 13;// gnuplot has 13 point types + } + +} diff --git a/pdb-ui/src/main/java/org/lucares/pdbui/PdbController.java b/pdb-ui/src/main/java/org/lucares/pdbui/PdbController.java index c7903ce..1348180 100644 --- a/pdb-ui/src/main/java/org/lucares/pdbui/PdbController.java +++ b/pdb-ui/src/main/java/org/lucares/pdbui/PdbController.java @@ -54,10 +54,6 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - @Controller @EnableAutoConfiguration @RequestMapping(path = "/api") @@ -91,22 +87,6 @@ public class PdbController implements HardcodedValues, PropertyKeys { this.csvUploadHandler = csvUploadHandler; } - @RequestMapping(path = "/plots", // - method = RequestMethod.GET, // - consumes = MediaType.APPLICATION_JSON_VALUE, // - produces = MediaType.APPLICATION_JSON_VALUE // - ) - @ResponseBody - ResponseEntity createPlotGet(@RequestParam(name = "request") final String request) - throws InternalPlottingException, InterruptedException, JsonParseException, JsonMappingException, - IOException { - - final ObjectMapper objectMapper = new ObjectMapper(); - final PlotRequest plotRequest = objectMapper.readValue(request, PlotRequest.class); - - return createPlot(plotRequest); - } - @RequestMapping(path = "/plots", // method = RequestMethod.POST, // consumes = MediaType.APPLICATION_JSON_VALUE, // diff --git a/pdb-ui/src/main/java/org/lucares/pdbui/domain/DataSeriesStats.java b/pdb-ui/src/main/java/org/lucares/pdbui/domain/DataSeriesStats.java index def1afd..9f38e95 100644 --- a/pdb-ui/src/main/java/org/lucares/pdbui/domain/DataSeriesStats.java +++ b/pdb-ui/src/main/java/org/lucares/pdbui/domain/DataSeriesStats.java @@ -6,8 +6,21 @@ public class DataSeriesStats { private final int values; private final long maxValue; private final double average; + private final String name; + private final StyleAndColor dashTypeAndColor; public DataSeriesStats(final int values, final long maxValue, final double average) { + this.name = ""; + this.dashTypeAndColor = new StyleAndColor("000", 0); + this.values = values; + this.maxValue = maxValue; + this.average = average; + } + + public DataSeriesStats(final String name, final StyleAndColor dashTypeAndColor, final int values, + final long maxValue, final double average) { + this.name = name; + this.dashTypeAndColor = dashTypeAndColor; this.values = values; this.maxValue = maxValue; this.average = average; @@ -22,6 +35,10 @@ public class DataSeriesStats { return values; } + public StyleAndColor getDashTypeAndColor() { + return dashTypeAndColor; + } + public long getMaxValue() { return maxValue; } @@ -30,9 +47,14 @@ public class DataSeriesStats { return average; } + public String getName() { + return name; + } + @Override public String toString() { - return "[values=" + values + ", maxValue=" + maxValue + ", average=" + average + "]"; + return "[name=" + name + ", dashTypeAndColor=" + dashTypeAndColor + ", values=" + values + ", maxValue=" + + maxValue + ", average=" + average + "]"; } public static double average(final Collection stats) { diff --git a/pdb-ui/src/main/java/org/lucares/pdbui/domain/PlotResponseStats.java b/pdb-ui/src/main/java/org/lucares/pdbui/domain/PlotResponseStats.java index 0b4ce99..ee59781 100644 --- a/pdb-ui/src/main/java/org/lucares/pdbui/domain/PlotResponseStats.java +++ b/pdb-ui/src/main/java/org/lucares/pdbui/domain/PlotResponseStats.java @@ -75,8 +75,11 @@ public class PlotResponseStats { values += dataSerie.getValues(); maxValue = Math.max(maxValue, dataSerie.getMaxValue()); - dataSeriesStats - .add(new DataSeriesStats(dataSerie.getValues(), dataSerie.getMaxValue(), dataSerie.getAverage())); + final StyleAndColor lineStyle = new StyleAndColor(dataSerie.getStyle().getColor().getColor(), + dataSerie.getStyle().getPointType()); + + dataSeriesStats.add(new DataSeriesStats(dataSerie.getTitle(), lineStyle, dataSerie.getValues(), + dataSerie.getMaxValue(), dataSerie.getAverage())); } final double average = Math.round(DataSeriesStats.average(dataSeriesStats)); diff --git a/pdb-ui/src/main/java/org/lucares/pdbui/domain/StyleAndColor.java b/pdb-ui/src/main/java/org/lucares/pdbui/domain/StyleAndColor.java new file mode 100644 index 0000000..cdac7c2 --- /dev/null +++ b/pdb-ui/src/main/java/org/lucares/pdbui/domain/StyleAndColor.java @@ -0,0 +1,36 @@ +package org.lucares.pdbui.domain; + +public class StyleAndColor { + private String color; + + private final int pointType; + + public StyleAndColor(final String color, final int pointType) { + super(); + this.color = color; + this.pointType = pointType; + } + + public String getColor() { + return color; + } + + public void setColor(final String color) { + this.color = color; + } + + public int getPointType() { + return pointType; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append("LineStyleAndColor [color="); + builder.append(color); + builder.append(", pointType="); + builder.append(pointType); + builder.append("]"); + return builder.toString(); + } +}