Project

General

Profile

1
import {Component, Input}  from '@angular/core';
2
import {ActivatedRoute}    from '@angular/router';
3
import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class';
4
import {FetchDatasets}     from '../../utils/fetchEntitiesClasses/fetchDatasets.class';
5
import {ErrorCodes}        from '../../utils/properties/errorCodes';
6
import {EnvProperties}     from '../../utils/properties/env-properties';
7

    
8
@Component({
9
    selector: 'statisticsTab',
10
    template: `
11
      <errorMessages [status]="[fetchPublications.searchUtils.status, fetchDatasets.searchUtils.status]" [type]="'statistics'" tab_error_class=true></errorMessages>
12

    
13
      <div *ngIf="(fetchPublications.searchUtils.status == errorCodes.DONE || fetchDatasets.searchUtils.status == errorCodes.DONE)">
14
        <p class="uk-text-bold">Latest Research Result Timeline</p>
15
        <i-frame  [url]=docsTimelineUrl width="100%" height="350"></i-frame>
16
        <p class="uk-text-bold">Research Result Types</p>
17
        <i-frame [url]=docsTypesUrl width="100%" height="350"></i-frame>
18
      </div>
19

    
20
      <div *ngIf="fetchPublications.searchUtils.totalResults > 0 || (fetchDatasets.searchUtils.totalResults > 0)">
21
        <p class="uk-text-bold">Funders in Research Results of content provider</p>
22
        <i-frame  [url]=docsFunderUrl width="100%" height="350"></i-frame>
23
      </div>
24

    
25
      <div *ngIf="fetchPublications.searchUtils.totalResults > 0 ">
26
        <p class="uk-text-bold">Projects with most Publications</p>
27
        <i-frame [url]=pubsProjectsUrl width="100%" height="350"></i-frame>
28
      </div>
29

    
30
      <div *ngIf="(fetchDatasets.searchUtils.totalResults > 0)">
31
        <div>
32
          <p class="uk-text-bold">Projects with most Research Data</p>
33
          <i-frame  [url]=dataProjectsUrl width="100%" height="350"></i-frame>
34
        </div>
35
      </div>
36
    `
37
})
38

    
39
export class StatisticsTabComponent {
40
    @Input() datasourceId;
41
    @Input() fetchPublications : FetchPublications;
42
    @Input() fetchDatasets : FetchDatasets;
43

    
44
    private docsTimelineUrl: string;
45
    private docsTypesUrl:string;
46
    private docsFunderUrl:string;
47
    private dataProjectsUrl:string ;
48
    private pubsProjectsUrl:string;
49
    public  errorCodes:ErrorCodes = new ErrorCodes();
50

    
51
    constructor (private route: ActivatedRoute) {}
52

    
53
    ngOnInit() {
54
      this.route.data
55
        .subscribe((data: { envSpecific: EnvProperties }) => {
56
          var properties = data.envSpecific;
57

    
58
          this.docsTimelineUrl =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":30, "sort": "xaxis", "xStyle":{"r": -30, "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "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=100%&h=250';
59
          this.docsTypesUrl = 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 Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250';
60
          this.docsFunderUrl =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 Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250';
61
          this.dataProjectsUrl =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=100%&h=250';
62
          this.pubsProjectsUrl =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=100%&h=250';
63
      });
64
    }
65

    
66
    ngOnDestroy() {}
67
}
(14-14/14)