Revision 58853
Added by Stefania Martziou almost 4 years ago
continent-overview.component.ts | ||
---|---|---|
1 | 1 |
import { Component, OnInit } from '@angular/core'; |
2 |
import {ActivatedRoute} from '@angular/router'; |
|
3 |
import {DomSanitizer} from '@angular/platform-browser'; |
|
4 |
import {DataService} from '../../services/data.service'; |
|
2 |
import { ActivatedRoute } from '@angular/router'; |
|
3 |
import { DomSanitizer } from '@angular/platform-browser'; |
|
4 |
import { DataService } from '../../services/data.service'; |
|
5 |
import { DataHandlerService } from '../../services/data-handler.service'; |
|
6 |
import { EuropeData } from '../../domain/overview-map-data'; |
|
5 | 7 |
|
6 | 8 |
@Component({ |
7 | 9 |
selector: 'app-continent-overview', |
... | ... | |
12 | 14 |
|
13 | 15 |
continentName: string; |
14 | 16 |
|
17 |
europeOverviewData: EuropeData; |
|
18 |
|
|
15 | 19 |
constructor(private dataService: DataService, |
20 |
private dataHandlerService: DataHandlerService, |
|
16 | 21 |
private route: ActivatedRoute, |
17 | 22 |
private sanitizer: DomSanitizer) { } |
18 | 23 |
|
19 | 24 |
ngOnInit(): void { |
20 | 25 |
this.continentName = this.route.snapshot.paramMap.get('continentName'); |
26 |
|
|
27 |
this.dataService.getEuropeOAPercentages().subscribe( |
|
28 |
rawData => { |
|
29 |
this.europeOverviewData = this.dataHandlerService.convertRawDataToEuropeOverviewData(rawData); |
|
30 |
}, error => { |
|
31 |
console.log(error); |
|
32 |
} |
|
33 |
); |
|
21 | 34 |
} |
35 |
|
|
36 |
getHeight(percentage: number) { |
|
37 |
if (percentage < 50) { |
|
38 |
return Math.round(percentage) * 1.5; |
|
39 |
} else { |
|
40 |
return Math.round(percentage); |
|
41 |
} |
|
42 |
} |
|
43 |
|
|
44 |
getNumberFontSize(percentage: number) { |
|
45 |
if (percentage < 50) { |
|
46 |
return Math.round(percentage * 45 / 100) * 1.5; |
|
47 |
} else { |
|
48 |
return Math.round(percentage * 45 / 100); |
|
49 |
} |
|
50 |
} |
|
51 |
|
|
52 |
getEntityNameFontSize(percentage: number) { |
|
53 |
if (percentage < 50) { |
|
54 |
return Math.round(percentage * 30 / 100) * 1.5; |
|
55 |
} else { |
|
56 |
return Math.round(percentage * 30 / 100); |
|
57 |
} |
|
58 |
} |
|
59 |
|
|
60 |
getPublicationsIconWidth(percentage: number) { |
|
61 |
if (percentage < 50) { |
|
62 |
return Math.round(percentage * 60 / 100) * 1.5; |
|
63 |
} else { |
|
64 |
return Math.round(percentage * 60 / 100); |
|
65 |
} |
|
66 |
} |
|
67 |
|
|
68 |
getDatasetsIconWidth(percentage: number) { |
|
69 |
if (percentage < 50) { |
|
70 |
return Math.round(percentage * 45 / 100) * 1.5; |
|
71 |
} else { |
|
72 |
return Math.round(percentage * 45 / 100); |
|
73 |
} |
|
74 |
} |
|
75 |
|
|
76 |
getSoftwareIconWidth(percentage: number) { |
|
77 |
if (percentage < 50) { |
|
78 |
return Math.round(percentage * 50 / 100) * 1.5; |
|
79 |
} else { |
|
80 |
return Math.round(percentage * 50 / 100); |
|
81 |
} |
|
82 |
} |
|
83 |
|
|
84 |
getOtherIconWidth(percentage: number) { |
|
85 |
if (percentage < 50) { |
|
86 |
return Math.round(percentage * 45 / 100) * 1.5; |
|
87 |
} else { |
|
88 |
return Math.round(percentage * 45 / 100); |
|
89 |
} |
|
90 |
} |
|
91 |
|
|
22 | 92 |
} |
Also available in: Unified diff
Working on the new version of the oso - almost done with tha data part of the pages