diff --git a/pdb-js/src/app/plot-view/plot-view.component.ts b/pdb-js/src/app/plot-view/plot-view.component.ts index 4ddc9a3..0ff48c4 100644 --- a/pdb-js/src/app/plot-view/plot-view.component.ts +++ b/pdb-js/src/app/plot-view/plot-view.component.ts @@ -1,4 +1,5 @@ import { Component, OnInit, Output, EventEmitter } from '@angular/core'; +import { DataType, AxesTypes } from '../plot.service'; @Component({ selector: 'pdb-plot-view', @@ -16,6 +17,8 @@ export class PlotViewComponent implements OnInit { imageUrl : string; + axes: AxesTypes; + @Output() zoomRange : EventEmitter = new EventEmitter(); @@ -89,7 +92,7 @@ export class PlotViewComponent implements OnInit { //console.log("dragStart inPlot: " + this.isInPlot(event)); event.preventDefault(); - if (event.buttons == 1 && this.isInPlot(event)) { + if (event.buttons == 1 && this.isInPlot(event) && this.axes.hasXAxis(DataType.Time)) { const pos = this.positionInImage(event); this.in_drag_mode = true; this.drag_start_x = pos.x; @@ -157,7 +160,7 @@ export class PlotViewComponent implements OnInit { } zoomByScroll(event) { - if (this.isInImage(event) && event.deltaY != 0) { + if (this.isInImage(event) && event.deltaY != 0 && this.axes.hasXAxis(DataType.Time)) { this.in_drag_mode = false; this.hideZoomInSlider(); diff --git a/pdb-js/src/app/plot.service.ts b/pdb-js/src/app/plot.service.ts index 5f27aa7..a328e51 100644 --- a/pdb-js/src/app/plot.service.ts +++ b/pdb-js/src/app/plot.service.ts @@ -93,14 +93,11 @@ export class PlotType { } compatible(others: Array) : boolean { - var result = true; - var other : PlotType; - var xAxisTypes = new Set([this.xAxis]); var yAxisTypes = new Set([this.yAxis]); for(var i = 0; i < others.length; i++){ - other = others[i]; + var other = others[i]; xAxisTypes.add(other.xAxis); yAxisTypes.add(other.yAxis); } @@ -129,6 +126,24 @@ export enum DataType { Other } +export class AxesTypes { + x : Set; + y : Set; + + constructor(x: Set, y : Set) { + this.x = x; + this.y = y; + } + + hasXAxis(type : DataType){ + return this.x.has(type); + } + + hasYAxis(type : DataType){ + return this.y.has(type); + } +} + export class Suggestion { value: string; newQuery: string; 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 c14da85..a968c7f 100644 --- a/pdb-js/src/app/visualization-page/visualization-page.component.ts +++ b/pdb-js/src/app/visualization-page/visualization-page.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, ViewChild } from '@angular/core'; -import { PlotService, PlotType, PlotRequest, PlotResponse, TagField, FilterDefaults } from '../plot.service'; +import { PlotService, PlotType, PlotRequest, PlotResponse, TagField, FilterDefaults, DataType, AxesTypes } from '../plot.service'; import { Observable } from 'rxjs/Observable'; import { FormControl, Validators } from '@angular/forms'; import { MatSnackBar } from '@angular/material/snack-bar'; @@ -99,11 +99,27 @@ export class VisualizationPageComponent implements OnInit { const request = this.createPlotRequest(); this.galleryView.renderGallery(request, this.splitBy.name); } + + getAxes() : AxesTypes { + + var x = new Set(); + var y = new Set(); + + for(var i = 0; i < this.selectedPlotType.length; i++){ + var plotType = this.selectedPlotType[i]; + x.add(plotType.xAxis); + y.add(plotType.yAxis); + } + + return new AxesTypes(x,y); + } plot(){ const that = this; that.plotView.imageUrl = ''; + this.plotView.axes = this.getAxes(); + console.log(JSON.stringify(this.getAxes())); that.galleryView.show=false; document.dispatchEvent(new Event("invadersStart", {}));