1
|
import {Component, Input} from '@angular/core';
|
2
|
import {ActivatedRoute} from '@angular/router';
|
3
|
import {FetchResearchResults} from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
|
4
|
import {ErrorCodes} from '../../utils/properties/errorCodes';
|
5
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
6
|
import {StringUtils} from "../../utils/string-utils.class";
|
7
|
import {Subscriber} from "rxjs";
|
8
|
import {properties} from "../../../../environments/environment";
|
9
|
|
10
|
@Component({
|
11
|
selector: 'statisticsTab',
|
12
|
template: `
|
13
|
<errorMessages [status]="[fetchPublications.searchUtils.status, fetchDatasets.searchUtils.status,
|
14
|
fetchSoftware.searchUtils.status, fetchOther.searchUtils.status]"
|
15
|
[type]="'statistics'" tab_error_class=true></errorMessages>
|
16
|
|
17
|
<!-- <ng-container *ngIf="(fetchPublications.searchUtils.status == errorCodes.DONE -->
|
18
|
<!-- || fetchDatasets.searchUtils.status == errorCodes.DONE-->
|
19
|
<!-- || fetchSoftware.searchUtils.status == errorCodes.DONE-->
|
20
|
<!-- || fetchOther.searchUtils.status == errorCodes.DONE)">-->
|
21
|
<div *ngIf="fetchPublications.searchUtils.totalResults > 0 || (fetchDatasets.searchUtils.totalResults > 0 ||
|
22
|
fetchSoftware.searchUtils.totalResults > 0 || fetchOther.searchUtils.totalResults > 0)"
|
23
|
class="uk-grid uk-child-width-1-1 uk-child-width-1-2@m">
|
24
|
<div class="uk-padding uk-padding-remove-top">
|
25
|
<div *ngIf=" properties && !properties.useNewStatistisTool" class="uk-text-center uk-text-large">Produced research outcomes per year</div>
|
26
|
<i-frame [url]=docsTimelineUrl ></i-frame>
|
27
|
</div>
|
28
|
<div class="uk-padding uk-padding-remove-top">
|
29
|
<div *ngIf=" properties && !properties.useNewStatistisTool" class="uk-text-center uk-text-large">Research outcomes Types</div>
|
30
|
<i-frame [url]=docsTypesUrl ></i-frame>
|
31
|
</div>
|
32
|
<!-- </ng-container>-->
|
33
|
|
34
|
<!-- <div *ngIf="fetchPublications.searchUtils.totalResults > 0 || (fetchDatasets.searchUtils.totalResults > 0-->
|
35
|
<!-- || fetchSoftware.searchUtils.totalResults > 0 || fetchOther.searchUtils.totalResults > 0)"-->
|
36
|
<div
|
37
|
class="uk-padding uk-padding-remove-top">
|
38
|
<div *ngIf=" properties && !properties.useNewStatistisTool" class="uk-text-center uk-text-large">Research outcomes per funder</div>
|
39
|
<i-frame [url]=docsFunderUrl ></i-frame>
|
40
|
</div>
|
41
|
|
42
|
<div *ngIf="fetchPublications.searchUtils.totalResults > 0 "
|
43
|
class="uk-padding uk-padding-remove-top">
|
44
|
<div *ngIf=" properties && !properties.useNewStatistisTool" class="uk-text-center uk-text-large">Projects with most Publications</div>
|
45
|
<i-frame [url]=pubsProjectsUrl ></i-frame>
|
46
|
</div>
|
47
|
|
48
|
<div *ngIf="(fetchDatasets.searchUtils.totalResults > 0)"
|
49
|
class="uk-padding uk-padding-remove-top">
|
50
|
<div *ngIf=" properties && !properties.useNewStatistisTool" class="uk-text-center uk-text-large">Projects with most Research Data</div>
|
51
|
<i-frame [url]=dataProjectsUrl></i-frame>
|
52
|
</div>
|
53
|
</div>
|
54
|
|
55
|
`
|
56
|
})
|
57
|
|
58
|
export class StatisticsTabComponent {
|
59
|
@Input() datasourceId;
|
60
|
@Input() fetchPublications : FetchResearchResults;
|
61
|
@Input() fetchDatasets : FetchResearchResults;
|
62
|
@Input() fetchSoftware: FetchResearchResults;
|
63
|
@Input() fetchOther: FetchResearchResults;
|
64
|
|
65
|
private docsTimelineUrl: string;
|
66
|
private docsTypesUrl:string;
|
67
|
private docsFunderUrl:string;
|
68
|
private dataProjectsUrl:string ;
|
69
|
private pubsProjectsUrl:string;
|
70
|
public errorCodes:ErrorCodes = new ErrorCodes();
|
71
|
properties:EnvProperties;
|
72
|
sub;
|
73
|
constructor (private route: ActivatedRoute) {}
|
74
|
|
75
|
ngOnInit() {
|
76
|
|
77
|
this.properties = properties;
|
78
|
|
79
|
if (this.properties.useNewStatistisTool) {
|
80
|
this.docsTimelineUrl = this.properties.statisticsFrameNewAPIURL +
|
81
|
'chart?json='+StringUtils.URIEncode('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Research outcomes","type":"column","query":{"name":"dtsrcYear","parameters":["'+this.datasourceId+'"]}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Produced research outcomes per year"},"subtitle":{},"yAxis":{"title":{"text":"Research outcomes"}},"xAxis":{"title":{"text":"Year"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
|
82
|
this.docsTypesUrl = this.properties.statisticsFrameNewAPIURL +
|
83
|
'chart?json='+StringUtils.URIEncode('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Research outcomes ","type":"pie","query":{"name":"dtsrcPubs","parameters":["'+this.datasourceId+'"]}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Research outcomes types"},"subtitle":{},"yAxis":{"title":{"text":"Publications"}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":true}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
|
84
|
this.docsFunderUrl = this.properties.statisticsFrameNewAPIURL +
|
85
|
'chart?json='+StringUtils.URIEncode('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Research outcomes","type":"pie","query":{"name":"dtsrcPubsFund","parameters":["'+this.datasourceId+'"]}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Research outcomes per funder"},"subtitle":{},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":true}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
|
86
|
this.pubsProjectsUrl = this.properties.statisticsFrameNewAPIURL +
|
87
|
'chart?json='+StringUtils.URIEncode('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Publications","type":"bar","query":{"name":"dtsrcProjPubs","parameters":["'+this.datasourceId+'"]}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":" Projects with most publications"},"subtitle":{},"yAxis":{"title":{"text":"Publications"}},"xAxis":{"title":{"text":"Project"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
|
88
|
this.dataProjectsUrl = this.properties.statisticsFrameNewAPIURL +
|
89
|
'chart?json='+StringUtils.URIEncode('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Research data","type":"bar","query":{"name":"dtsrcProjData","parameters":["'+this.datasourceId+'"]}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Projects with most research data"},"subtitle":{},"yAxis":{"title":{"text":"Research data"}},"xAxis":{"title":{"text":"Project"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
|
90
|
} else {
|
91
|
this.docsTimelineUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"dtsrcYear","dtsrcName":"' + this.datasourceId + '","table": "result", "fields": [{"fld": "number", "agg": "count", "type": "line", "yaxis":1, "c":true}], "xaxis":{"name": "year", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":80, "sort": "xaxis", "xStyle":{"r": -30, "s": "6", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Outcomes"], "in": [{"f":0, "text": "Yearly"}], "filters": [{"name":"year","max":"2016","min":"1997"},{"name": "result_datasources-datasource-name", "values":[""], "to": "-1"}],"having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": "Year"}&w=90%&h=90%';
|
92
|
this.docsTypesUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"dtsrcPubs","dtsrcName":"' + this.datasourceId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Outcomes"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=90%&h=90%';
|
93
|
this.docsFunderUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"dtsrcPubsFund","dtsrcName":"' + this.datasourceId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Outcomes"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=90%&h=90%';
|
94
|
this.dataProjectsUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"dtsrcProjData","dtsrcName":"' + this.datasourceId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Data"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=90%&h=90%';
|
95
|
this.pubsProjectsUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"dtsrcProjPubs","dtsrcName":"' + this.datasourceId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Publications"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=90%&h=90%';
|
96
|
}
|
97
|
|
98
|
}
|
99
|
|
100
|
ngOnDestroy() {
|
101
|
if (this.sub instanceof Subscriber) {
|
102
|
this.sub.unsubscribe();
|
103
|
}
|
104
|
}}
|