AxisTypes has a better toString method
This commit is contained in:
@@ -128,20 +128,49 @@ export enum DataType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class AxesTypes {
|
export class AxesTypes {
|
||||||
x : Set<DataType>;
|
x : Array<DataType>;
|
||||||
y : Set<DataType>;
|
y : Array<DataType>;
|
||||||
|
|
||||||
constructor(x: Set<DataType>, y : Set<DataType>) {
|
constructor(x: Array<DataType>, y : Array<DataType>) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
hasXAxis(type : DataType){
|
hasXAxis(type : DataType){
|
||||||
return this.x.has(type);
|
return this.x.includes(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
hasYAxis(type : DataType){
|
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 {
|
getAxes() : AxesTypes {
|
||||||
|
|
||||||
var x = new Set<DataType>();
|
var x = new Array<DataType>();
|
||||||
var y = new Set<DataType>();
|
var y = new Array<DataType>();
|
||||||
|
|
||||||
for(var i = 0; i < this.selectedPlotType.length; i++){
|
for(var i = 0; i < this.selectedPlotType.length; i++){
|
||||||
var plotType = this.selectedPlotType[i];
|
var plotType = this.selectedPlotType[i];
|
||||||
x.add(plotType.xAxis);
|
if (!x.includes(plotType.xAxis)) {
|
||||||
y.add(plotType.yAxis);
|
x.push(plotType.xAxis);
|
||||||
|
}
|
||||||
|
if (!y.includes(plotType.yAxis)) {
|
||||||
|
y.push(plotType.yAxis);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new AxesTypes(x,y);
|
return new AxesTypes(x,y);
|
||||||
@@ -233,6 +237,11 @@ export class DateRange {
|
|||||||
startDate: any;
|
startDate: any;
|
||||||
endDate: any;
|
endDate: any;
|
||||||
duration: any;
|
duration: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class AxesUsed {
|
||||||
|
x1: DataType;
|
||||||
|
y1: DataType;
|
||||||
|
x2: DataType;
|
||||||
|
y2: DataType;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user