extract shareable plot config
This commit is contained in:
@@ -244,7 +244,7 @@ export class GalleryViewComponent implements OnInit {
|
||||
|
||||
request.generateThumbnail = true;
|
||||
|
||||
this.plotService.splitQuery(request.query, splitByField).subscribe({
|
||||
this.plotService.splitQuery(request.config.query, splitByField).subscribe({
|
||||
next: function(valuesForSplitBy){
|
||||
console.log("valuesForSplitBy: " + JSON.stringify(valuesForSplitBy));
|
||||
that.splitByValuesQueue = valuesForSplitBy;
|
||||
@@ -269,7 +269,7 @@ export class GalleryViewComponent implements OnInit {
|
||||
const splitByValue = <string>this.splitByValuesQueue.pop();
|
||||
|
||||
let request = masterRequest.copy();
|
||||
request.query = "("+request.query+") and " + splitByField+"="+ splitByValue;
|
||||
request.config.query = "("+request.config.query+") and " + splitByField+"="+ splitByValue;
|
||||
|
||||
const expectedSequenceId = ++this.sequenceId;
|
||||
|
||||
|
||||
@@ -207,11 +207,24 @@ export class AutocompleteResult{
|
||||
|
||||
export class PlotRequest {
|
||||
constructor(
|
||||
public query : string,
|
||||
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 config: PlotConfig
|
||||
){}
|
||||
|
||||
|
||||
copy(): PlotRequest {
|
||||
return JSON.parse(JSON.stringify(this));
|
||||
}
|
||||
}
|
||||
|
||||
export class PlotConfig {
|
||||
constructor( public query : string,
|
||||
public groupBy : Array<string>,
|
||||
public limitBy : string,
|
||||
public limit : number,
|
||||
@@ -219,16 +232,9 @@ export class PlotRequest {
|
||||
public y2:YAxisDefinition|undefined,
|
||||
public dateRange : string,
|
||||
public aggregates : Array<string>,
|
||||
public keyOutside : boolean = false,
|
||||
public generateThumbnail : boolean,
|
||||
public intervalUnit: string,
|
||||
public intervalValue: number,
|
||||
public submitterId: string,
|
||||
public renderBarChartTickLabels: boolean = false){}
|
||||
|
||||
copy(): PlotRequest {
|
||||
return JSON.parse(JSON.stringify(this));
|
||||
}
|
||||
public renderBarChartTickLabels: boolean = false,) {}
|
||||
}
|
||||
|
||||
export class YAxisDefinition {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { PlotService, PlotType, PlotRequest, PlotResponse, TagField, FilterDefaults, DataType, YAxisDefinition, AxesTypes } from '../plot.service';
|
||||
import { PlotService, PlotType, PlotRequest, PlotResponse, TagField, FilterDefaults, DataType, YAxisDefinition, AxesTypes, PlotConfig } from '../plot.service';
|
||||
import { UntypedFormControl, Validators } from '@angular/forms';
|
||||
import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar';
|
||||
import { LimitByComponent } from '../limit-by/limit-by.component';
|
||||
@@ -189,12 +189,8 @@ export class VisualizationPageComponent implements OnInit {
|
||||
const y2 = this.y2AxisDefinitionComponent ? this.y2AxisDefinitionComponent.getAxisDefinition() : undefined;
|
||||
const results = document.getElementById("results");
|
||||
|
||||
const request = new PlotRequest(
|
||||
const config = new PlotConfig(
|
||||
this.query.query,
|
||||
results != null ? results.offsetHeight-1: 1024,
|
||||
results != null ? results.offsetWidth-1 : 1024,
|
||||
300, // thumbnailMaxWidth
|
||||
200, // thumbnailMaxHeight
|
||||
this.groupBy.map(o => o.name),
|
||||
this.limitbycomponent.limitBy,
|
||||
this.limitbycomponent.limit,
|
||||
@@ -202,12 +198,20 @@ export class VisualizationPageComponent implements OnInit {
|
||||
y2,
|
||||
this.dateRangeAsString(), // dateRange
|
||||
aggregates, // aggregates
|
||||
false, // keyOutside
|
||||
this.enableGallery, // generateThumbnail
|
||||
this.intervalUnit,
|
||||
this.intervalValue,
|
||||
this.renderBarChartTickLabels,
|
||||
);
|
||||
|
||||
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
|
||||
this.submitterId,
|
||||
this.renderBarChartTickLabels);
|
||||
config);
|
||||
return request;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user