68 lines
6.1 KiB
TypeScript
68 lines
6.1 KiB
TypeScript
import {Component, Input} from '@angular/core';
|
|
import {ActivatedRoute} from '@angular/router';
|
|
import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class';
|
|
import {FetchDatasets} from '../../utils/fetchEntitiesClasses/fetchDatasets.class';
|
|
import {ErrorCodes} from '../../utils/properties/errorCodes';
|
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
|
|
|
@Component({
|
|
selector: 'statisticsTab',
|
|
template: `
|
|
<errorMessages [status]="[fetchPublications.searchUtils.status, fetchDatasets.searchUtils.status]" [type]="'statistics'" tab_error_class=true></errorMessages>
|
|
|
|
<div *ngIf="(fetchPublications.searchUtils.status == errorCodes.DONE || fetchDatasets.searchUtils.status == errorCodes.DONE)">
|
|
<p class="uk-text-bold">Latest Research Result Timeline</p>
|
|
<i-frame [url]=docsTimelineUrl width="100%" height="350"></i-frame>
|
|
<p class="uk-text-bold">Research Result Types</p>
|
|
<i-frame [url]=docsTypesUrl width="100%" height="350"></i-frame>
|
|
</div>
|
|
|
|
<div *ngIf="fetchPublications.searchUtils.totalResults > 0 || (fetchDatasets.searchUtils.totalResults > 0)">
|
|
<p class="uk-text-bold">Funders in Research Results of content provider</p>
|
|
<i-frame [url]=docsFunderUrl width="100%" height="350"></i-frame>
|
|
</div>
|
|
|
|
<div *ngIf="fetchPublications.searchUtils.totalResults > 0 ">
|
|
<p class="uk-text-bold">Projects with most Publications</p>
|
|
<i-frame [url]=pubsProjectsUrl width="100%" height="350"></i-frame>
|
|
</div>
|
|
|
|
<div *ngIf="(fetchDatasets.searchUtils.totalResults > 0)">
|
|
<div>
|
|
<p class="uk-text-bold">Projects with most Research Data</p>
|
|
<i-frame [url]=dataProjectsUrl width="100%" height="350"></i-frame>
|
|
</div>
|
|
</div>
|
|
`
|
|
})
|
|
|
|
export class StatisticsTabComponent {
|
|
@Input() datasourceId;
|
|
@Input() fetchPublications : FetchPublications;
|
|
@Input() fetchDatasets : FetchDatasets;
|
|
|
|
private docsTimelineUrl: string;
|
|
private docsTypesUrl:string;
|
|
private docsFunderUrl:string;
|
|
private dataProjectsUrl:string ;
|
|
private pubsProjectsUrl:string;
|
|
public errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
constructor (private route: ActivatedRoute) {}
|
|
|
|
ngOnInit() {
|
|
this.route.data
|
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
|
var properties = data.envSpecific;
|
|
|
|
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';
|
|
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';
|
|
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';
|
|
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';
|
|
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';
|
|
});
|
|
}
|
|
|
|
ngOnDestroy() {}
|
|
}
|