group plots by a single field
This commit is contained in:
@@ -50,7 +50,7 @@ public class PdbController implements HardcodedValues, CollectionUtils {
|
||||
final int width = request.getWidth();
|
||||
|
||||
System.out.println(query);
|
||||
final File image = plotter.plot(query, height, width);
|
||||
final File image = plotter.plot(query, height, width, request.getGroupBy());
|
||||
|
||||
final Path relativeImagePath = plotter.getOutputDir().relativize(image.toPath());
|
||||
return new PlotResponse(WEB_IMAGE_OUTPUT_PATH + "/" + relativeImagePath.toString());
|
||||
@@ -88,6 +88,26 @@ public class PdbController implements HardcodedValues, CollectionUtils {
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/fields", //
|
||||
method = RequestMethod.GET, //
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, //
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE //
|
||||
)
|
||||
@ResponseBody
|
||||
List<String> fields() {
|
||||
|
||||
try {
|
||||
|
||||
final List<String> fields = db.getDb().getFields();
|
||||
|
||||
return fields;
|
||||
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new InternalServerError(e);
|
||||
}
|
||||
}
|
||||
|
||||
private List<AutocompleteProposal> toAutocompleteProposals(final List<Proposal> proposals) {
|
||||
|
||||
final List<AutocompleteProposal> result = new ArrayList<>();
|
||||
|
||||
@@ -7,6 +7,8 @@ public class PlotRequest {
|
||||
|
||||
private int width;
|
||||
|
||||
private String groupBy;
|
||||
|
||||
public String getQuery() {
|
||||
return query;
|
||||
}
|
||||
@@ -35,4 +37,12 @@ public class PlotRequest {
|
||||
public String toString() {
|
||||
return query + ":" + height + "x" + width;
|
||||
}
|
||||
|
||||
public String getGroupBy() {
|
||||
return groupBy;
|
||||
}
|
||||
|
||||
public void setGroupBy(final String groupBy) {
|
||||
this.groupBy = groupBy;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user