AxisTypes has a better toString method
This commit is contained in:
@@ -128,20 +128,49 @@ export enum DataType {
|
||||
}
|
||||
|
||||
export class AxesTypes {
|
||||
x : Set<DataType>;
|
||||
y : Set<DataType>;
|
||||
x : Array<DataType>;
|
||||
y : Array<DataType>;
|
||||
|
||||
constructor(x: Set<DataType>, y : Set<DataType>) {
|
||||
constructor(x: Array<DataType>, y : Array<DataType>) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
hasXAxis(type : DataType){
|
||||
return this.x.has(type);
|
||||
return this.x.includes(type);
|
||||
}
|
||||
|
||||
hasYAxis(type : DataType){
|
||||
return this.y.has(type);
|
||||
return this.y.includes(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* return the 1-indexed axis data type, e.g. getXAxisDataType(1) for the x1 axis
|
||||
*/
|
||||
getXAxisDataType(index: number){
|
||||
if (this.x.length+1 >= index){
|
||||
return this.x[index-1];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* return the 1-indexed axis data type, e.g. getYAxisDataType(1) for the x1 axis
|
||||
*/
|
||||
getYAxisDataType(index: number){
|
||||
if (this.y.length+1 >= index){
|
||||
return this.y[index-1];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
toString() {
|
||||
const x1 = this.getXAxisDataType(1);
|
||||
const y1 = this.getYAxisDataType(1);
|
||||
const x2 = this.getXAxisDataType(2);
|
||||
const y2 = this.getYAxisDataType(2);
|
||||
|
||||
return "x1:"+DataType[x1]+ " y1:"+DataType[y1]+ " x2:"+DataType[x2]+ " y2:"+DataType[y2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -99,13 +99,17 @@ export class VisualizationPageComponent implements OnInit {
|
||||
|
||||
getAxes() : AxesTypes {
|
||||
|
||||
var x = new Set<DataType>();
|
||||
var y = new Set<DataType>();
|
||||
var x = new Array<DataType>();
|
||||
var y = new Array<DataType>();
|
||||
|
||||
for(var i = 0; i < this.selectedPlotType.length; i++){
|
||||
var plotType = this.selectedPlotType[i];
|
||||
x.add(plotType.xAxis);
|
||||
y.add(plotType.yAxis);
|
||||
if (!x.includes(plotType.xAxis)) {
|
||||
x.push(plotType.xAxis);
|
||||
}
|
||||
if (!y.includes(plotType.yAxis)) {
|
||||
y.push(plotType.yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
return new AxesTypes(x,y);
|
||||
@@ -233,6 +237,11 @@ export class DateRange {
|
||||
startDate: any;
|
||||
endDate: any;
|
||||
duration: any;
|
||||
|
||||
|
||||
}
|
||||
|
||||
export class AxesUsed {
|
||||
x1: DataType;
|
||||
y1: DataType;
|
||||
x2: DataType;
|
||||
y2: DataType;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user