update plotType drop down on selection
The drop down for plot types should only contain plot types that can be combined. The reason is, that we can only draw images with two x/y-axis. Therefore a combination of types that would need three or more axis is not supported.
This commit is contained in:
@@ -14,13 +14,13 @@ export class PlotService {
|
||||
constructor(private http: HttpClient) {
|
||||
this.plotTypes = new Array<PlotType>();
|
||||
this.plotTypes.push(new PlotType("SCATTER","Scatter","scatter-chart2",true,DataType.Time,DataType.Duration));
|
||||
this.plotTypes.push(new PlotType("HEATMAP", "Heatmap", "heatmap", false, DataType.Other, DataType.Other));
|
||||
this.plotTypes.push(new PlotType("CONTOUR", "Contour", "contour-chart", false, DataType.Time, DataType.Duration));
|
||||
this.plotTypes.push(new PlotType("CUM_DISTRIBUTION", "Cumulative Distribution", "cumulative-distribution-chart", true, DataType.Percent, DataType.Duration));
|
||||
this.plotTypes.push(new PlotType("HISTOGRAM", "Histogram", "histogram", true, DataType.HistogramBin, DataType.HistogramCount));
|
||||
this.plotTypes.push(new PlotType("PARALLEL", "Parallel Requests", "parallel-requests-chart", true, DataType.Time, DataType.Count));
|
||||
this.plotTypes.push(new PlotType("HEATMAP", "Heatmap", "heatmap", false, DataType.Other, DataType.Other));
|
||||
this.plotTypes.push(new PlotType("CONTOUR", "Contour", "contour-chart", false, DataType.Time, DataType.Duration));
|
||||
this.plotTypes.push(new PlotType("RIDGELINES", "Ridgelines", "ridgelines", false, DataType.Other, DataType.Other));
|
||||
this.plotTypes.push(new PlotType("QQ", "Quantile-Quantile", "quantile-quantile", false, DataType.Other, DataType.Other));
|
||||
this.plotTypes.push(new PlotType("PARALLEL", "Parallel Requests", "parallel-requests-chart", true, DataType.Time, DataType.Count));
|
||||
this.plotTypes.push(new PlotType("VIOLIN", "Violin", "violin-chart", false, DataType.Group, DataType.Duration));
|
||||
this.plotTypes.push(new PlotType("STRIP", "Strip", "strip-chart", false, DataType.Group, DataType.Duration));
|
||||
this.plotTypes.push(new PlotType("PIE", "Pie", "pie-chart", false, DataType.Other, DataType.Other));
|
||||
@@ -92,24 +92,21 @@ export class PlotType {
|
||||
this.yAxis = yAxis;
|
||||
}
|
||||
|
||||
compatible(other: PlotType) : boolean {
|
||||
|
||||
const xEqual = this.xAxis === other.xAxis;
|
||||
const yEqual = this.yAxis === other.yAxis;
|
||||
const anyIsOther = this.xAxis === DataType.Other
|
||||
|| this.yAxis === DataType.Other
|
||||
|| other.xAxis === DataType.Other
|
||||
|| other.yAxis === DataType.Other;
|
||||
|
||||
var result = xEqual || yEqual;
|
||||
compatible(others: Array<PlotType>) : boolean {
|
||||
var result = true;
|
||||
var other : PlotType;
|
||||
|
||||
// if either dimension is Other, then this plot is not compatible with any other plot
|
||||
result = result && !anyIsOther;
|
||||
|
||||
// is not the same
|
||||
result = result && this.name != other.name;
|
||||
return result;
|
||||
}
|
||||
var xAxisTypes = new Set([this.xAxis]);
|
||||
var yAxisTypes = new Set([this.yAxis]);
|
||||
|
||||
for(var i = 0; i < others.length; i++){
|
||||
other = others[i];
|
||||
xAxisTypes.add(other.xAxis);
|
||||
yAxisTypes.add(other.yAxis);
|
||||
}
|
||||
|
||||
return xAxisTypes.size <= 2 && yAxisTypes.size <= 2;
|
||||
}
|
||||
}
|
||||
|
||||
export class TagField {
|
||||
|
||||
Reference in New Issue
Block a user