diff --git a/pdb-js/src/app/plot.service.ts b/pdb-js/src/app/plot.service.ts index d2f7134..bd7cb03 100644 --- a/pdb-js/src/app/plot.service.ts +++ b/pdb-js/src/app/plot.service.ts @@ -128,20 +128,49 @@ export enum DataType { } export class AxesTypes { - x : Set; - y : Set; + x : Array; + y : Array; - constructor(x: Set, y : Set) { + constructor(x: Array, y : Array) { 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]; } } diff --git a/pdb-js/src/app/visualization-page/visualization-page.component.ts b/pdb-js/src/app/visualization-page/visualization-page.component.ts index 9857897..7cd66ff 100644 --- a/pdb-js/src/app/visualization-page/visualization-page.component.ts +++ b/pdb-js/src/app/visualization-page/visualization-page.component.ts @@ -99,13 +99,17 @@ export class VisualizationPageComponent implements OnInit { getAxes() : AxesTypes { - var x = new Set(); - var y = new Set(); + var x = new Array(); + var y = new Array(); 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; }