From 81bb5a9977ee58e237d3634d8a936960b1226ac2 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 17 Jun 2018 17:52:32 +0200 Subject: [PATCH 1/4] reduce the size of the menu --- .../analysis-types-list/analysis-types-list.component.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/analysis-types-list/analysis-types-list/analysis-types-list.component.css b/src/app/analysis-types-list/analysis-types-list/analysis-types-list.component.css index 1c9ac2bf..30e5225a 100644 --- a/src/app/analysis-types-list/analysis-types-list/analysis-types-list.component.css +++ b/src/app/analysis-types-list/analysis-types-list/analysis-types-list.component.css @@ -4,7 +4,7 @@ } mat-expansion-panel{ - width: 300px; + width: 290px; padding: 5px; } From a371404d25477c8d8a17f846c28c9cdd9c19c7ae Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 17 Jun 2018 17:52:52 +0200 Subject: [PATCH 2/4] spelling --- .../preparation-list/preparation-list.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/preparations/preparation-list/preparation-list.component.html b/src/app/preparations/preparation-list/preparation-list.component.html index 5237f4b1..07bc0608 100644 --- a/src/app/preparations/preparation-list/preparation-list.component.html +++ b/src/app/preparations/preparation-list/preparation-list.component.html @@ -1,5 +1,5 @@
-

There is {{preparations.length}} available preparations:

+

There are {{preparations.length}} available preparations:

From 7467abc6f8db952bee811cfbafa3d74920a0d4c5 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 17 Jun 2018 18:50:13 +0200 Subject: [PATCH 3/4] fix bug with multiple click --- src/app/plotly/plotly.component.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app/plotly/plotly.component.ts b/src/app/plotly/plotly.component.ts index 4fd5f90d..9768e2d1 100644 --- a/src/app/plotly/plotly.component.ts +++ b/src/app/plotly/plotly.component.ts @@ -40,8 +40,8 @@ export class PlotlyComponent implements OnInit, AfterViewInit, OnChanges { initialized: boolean; constructor( - private cdRef: ChangeDetectorRef, - private guid: GuidService + private cdRef: ChangeDetectorRef, + private guid: GuidService ) { this.randomId = guid.next(); this.initialized = false; @@ -64,15 +64,15 @@ export class PlotlyComponent implements OnInit, AfterViewInit, OnChanges { } ngAfterViewInit() { - console.log('[PlotlyComponent] nfAfterViewInit'); - this.createPlot(); - console.log('[PlotlyComponent] created plotly-' + this.randomId); + console.log('[PlotlyComponent] nfAfterViewInit'); + this.createPlot(); + const plotlyElement = document.getElementById('plotly-' + this.randomId); + plotlyElement.on('plotly_click', (event) => this.onClickFunction(event)); + console.log('[PlotlyComponent] created plotly-' + this.randomId); } createPlot() { Plotly.react('plotly-' + this.randomId, this.data, this.layout, this.options); - const plotlyElement = document.getElementById('plotly-' + this.randomId); - plotlyElement.on('plotly_click', (event) => this.onClickFunction(event)); this.initialized = true; this.cdRef.detectChanges(); } From d746b1b59eb9ddb6fef8846adfa7e51a0b2b604a Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 16 Jul 2018 20:13:18 +0200 Subject: [PATCH 4/4] get spectrum by initial point --- .../preparation/preparation.component.ts | 87 +++++++++++-------- 1 file changed, 53 insertions(+), 34 deletions(-) diff --git a/src/app/preparations/preparation/preparation.component.ts b/src/app/preparations/preparation/preparation.component.ts index 0e65461f..33521473 100644 --- a/src/app/preparations/preparation/preparation.component.ts +++ b/src/app/preparations/preparation/preparation.component.ts @@ -18,15 +18,16 @@ */ import { Component, OnInit } from '@angular/core'; -import { ActivatedRoute} from '@angular/router'; -import { SpectrumService} from '../../spectra/shared/spectrum.service'; -import { HeatmapService} from '../../heatmaps/shared/heatmap.service'; +import { ActivatedRoute } from '@angular/router'; +import { SpectrumService } from '../../spectra/shared/spectrum.service'; +import { HeatmapService } from '../../heatmaps/shared/heatmap.service'; import { Spectrum } from '../../spectra/shared/spectrum'; import { Heatmap } from '../../heatmaps/shared/heatmap'; import { PreparationService } from '../shared/preparation.service'; import { Preparation } from '../shared/preparation'; import { MessageService } from 'primeng/components/common/messageservice'; import { BlockUI, NgBlockUI } from 'ng-block-ui'; +import { isUndefined } from "util"; @Component({ selector: 'app-preparation', @@ -51,35 +52,41 @@ export class PreparationComponent implements OnInit { public minHeatmapRow: number; public onClickBind: Function; @BlockUI() blockUI: NgBlockUI; - public colors = [ {value: 'RdBu'}, {value: 'Greys'}, {value: 'YlGnBu'} , {value: 'Greens'}, {value: 'YlOrRd'}, - {value: 'Bluered'}, {value: 'Reds'}, {value: 'Blues'}, {value: 'Picnic'}, {value: 'Rainbow'}, {value: 'Portland'}, - {value: 'Jet'}, {value: 'Hot'}, {value: 'Blackbody'}, {value: 'Earth'}, {value: 'Electric'}, {value: 'Viridis'}]; + public colors = [{value: 'RdBu'}, {value: 'Greys'}, {value: 'YlGnBu'}, {value: 'Greens'}, {value: 'YlOrRd'}, + {value: 'Bluered'}, {value: 'Reds'}, {value: 'Blues'}, {value: 'Picnic'}, {value: 'Rainbow'}, {value: 'Portland'}, + {value: 'Jet'}, {value: 'Hot'}, {value: 'Blackbody'}, {value: 'Earth'}, {value: 'Electric'}, {value: 'Viridis'}]; public selectedValue = 'RdBu'; public heatmap: Heatmap; constructor( - private route: ActivatedRoute, - private spectrumService: SpectrumService, - private heatmapService: HeatmapService, - private preparationService: PreparationService, - private messageService: MessageService - ) { } + private route: ActivatedRoute, + private spectrumService: SpectrumService, + private heatmapService: HeatmapService, + private preparationService: PreparationService, + private messageService: MessageService + ) { + } ngOnInit() { this.onClickBind = this.onClickFunction.bind(this); - this.route.params.subscribe(params => { - console.log('[PreparationComponent] ngOnInit'); - this.id = Number.parseInt(params['id']); - console.log(this.id); - console.log('[PreparationComponent] parsed id'); - this.preparationService - .getPreparationById(this.id) - .subscribe(preparation => this.preparation = preparation); - this.heatmapService - .get(this.id, 0) - .subscribe(heatmap => this.heatmapData = this.toHeatmapDataset(heatmap)); - console.log('[SpectrumComponent] layout setup'); - }); + this.route.params.subscribe(params => { + console.log('[PreparationComponent] ngOnInit'); + this.id = Number.parseInt(params['id']); + console.log(this.id); + console.log('[PreparationComponent] parsed id'); + this.preparationService + .getPreparationById(this.id) + .subscribe(preparation => this.preparation = preparation); + this.heatmapService + .get(this.id, 0) + .subscribe(heatmap => { + this.heatmapData = this.toHeatmapDataset(heatmap); + this.findInitialPointToSpectrum(); + this.getSpectrumByCoordinates(); + } + ); + console.log('[SpectrumComponent] layout setup'); + }); } onInputChannelId(event: any) { @@ -87,13 +94,13 @@ export class PreparationComponent implements OnInit { } onChangedChannelId(event: any) { - this.blockUI.start('Getting heatmap...'); - this.heatmapService - .get(this.id, this.currentChannelId) - .subscribe(heatmap => { - this.heatmapData = this.toHeatmapDataset(heatmap); - this.blockUI.stop(); - }); + this.blockUI.start('Getting heatmap...'); + this.heatmapService + .get(this.id, this.currentChannelId) + .subscribe(heatmap => { + this.heatmapData = this.toHeatmapDataset(heatmap); + this.blockUI.stop(); + }); } changeColor() { @@ -118,7 +125,7 @@ export class PreparationComponent implements OnInit { this.xCoordinate = point.x; this.yCoordinate = point.y; this.getSpectrumByCoordinates(); -} + } /* * Parameters: @@ -142,6 +149,16 @@ export class PreparationComponent implements OnInit { }); } + findInitialPointToSpectrum() { + for (let i = 0; i < this.xHeatmapSize; i++) + for (let j = 0; j < this.yHeatmapSize; j++) + if (!isUndefined(this.heatmap.data[j][i])) { + this.xCoordinate = i; + this.yCoordinate = j; + return; + } + } + showError(msg: string) { this.blockUI.stop(); console.log(msg); @@ -159,7 +176,9 @@ export class PreparationComponent implements OnInit { if (isNaN(selectNumber) || selectNumber > this.preparation.spectraNumber || selectNumber < 0) { this.showError('Type properly number from 0 to ' + 997); - } else { this.getSpectrum(selectNumber); } + } else { + this.getSpectrum(selectNumber); + } } toHeatmapDataset(heatmap: Heatmap) {