added new statistics classes - worked on monitor page

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@51322 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
myrto.koukouli 2018-03-17 22:52:30 +00:00
parent 5d38eb892b
commit 78704ca5fb
5 changed files with 297 additions and 396 deletions

View File

@ -3,311 +3,90 @@
<div class="uk-container uk-margin-bottom"> <div class="uk-container uk-margin-bottom">
<article class="uk-article "> <article class="uk-article ">
<div *ngIf="statistics" class="uk-margin uk-margin-top"> <div *ngIf="!statisticsSum || !statisticsSum.total_projects" class="uk-alert uk-alert-info" style="margin-top:40px; padding-left:40px;">
No statistics are available for {{ communityId.toUpperCase() }}
</div>
<div *ngIf="statisticsSum && statisticsDisplay && charts" class="uk-margin uk-margin-top">
<div class="uk-grid"> <div class="uk-grid">
<ul class="uk-tab uk-tab-left uk-width-1-5 uk-margin-top" data-uk-tab="{connect:'#tabs'}"> <ul class="uk-tab uk-tab-left uk-width-1-6 uk-margin-top" data-uk-tab="{connect:'#tabs'}">
<li (click)="charts.timelines.publications.load = true"><a href="#">Publications</a></li> <li *ngFor="let entity of entitiesForCommunity"
<li (click)="charts.timelines.datasets.load = true"><a href="#">Research Data</a></li> (click)="onChangeEntity(entity)">
<li (click)="charts.timelines.software.load = true"><a href="#">Software</a></li>
<a href="#">{{ entity }}{{ entity == 'software' ? '' : 's' }}</a>
</li>
</ul> </ul>
<ul id="tabs" class="uk-switcher uk-margin uk-width-4-5" style="min-height:450px; padding-left:40px;"> <ul id="tabs" class="uk-switcher uk-margin uk-width-5-6" style="min-height:450px; padding-left:40px;">
<li> <li *ngFor="let entity of entitiesForCommunity">
<div class="uk-text-uppercase uk-text-bold uk-heading-divider"> <div class="uk-text-uppercase uk-text-bold uk-heading-divider">
<h2>Research data statistics</h2> <h2>{{ getCamelCaseString(entity) }}{{ entity == 'software' ? '' : 's' }} statistics</h2>
<div *ngIf="statistics.publications.total" class="uk-text-small"> <div *ngIf="statisticsSum[entity + (entity == 'software' ? '' : 's')].total" class="uk-text-small">
<span>{{statistics.publications.total}} datasets from {{statistics.total_projects}} projects.</span><br> <span>{{statisticsSum[entity + (entity == 'software' ? '' : 's')].total}} {{ entity + (entity == 'software' ? '' : 's') }} from {{statisticsSum.total_projects}} projects.</span><br>
<span>{{statistics.publications.open_access}} are OA</span> <span>{{statisticsSum[entity + (entity == 'software' ? '' : 's')].open_access}} are OA</span>
<span *ngIf="statistics.publications.restricted && statistics.publications.restricted > 0">, <span *ngIf="statisticsSum[entity + (entity == 'software' ? '' : 's')].restricted">,
{{statistics.publications.restricted}} are restricted {{statisticsSum[entity + (entity == 'software' ? '' : 's')].restricted}} are restricted
</span> </span>
<span *ngIf="statistics.publications.embargo && statistics.publications.embargo > 0"> <span *ngIf="statisticsSum[entity + (entity == 'software' ? '' : 's')].embargo">
and {{statistics.publications.embargo}} are still in embargo and {{statisticsSum[entity + (entity == 'software' ? '' : 's')].embargo}} are still in embargo
</span> </span>
</div> </div>
</div> </div>
<div *ngIf="statistics.publications.total"> <div *ngIf="charts.get(entity)">
<div *ngIf="charts.timelines.publications.load"> <div *ngIf="charts.get(entity).get('timeline') && (displayedTimeline == (entity + 'Timeline'))">
<i-frame [url]=charts.timelines.publications.url width="1000" height="450"></i-frame> <iframe [src]=displayedTimelineUrl width="1000" height="450"></iframe>
</div>
<div *ngIf="charts.graphs.pubGraph.load">
<i-frame [url]=charts.graphs.pubGraph.url width="1000" height="600"></i-frame>
</div>
<hr> <hr>
<div>
<h4 class="uk-text-uppercase uk-text-bold">Publications per project</h4>
</div>
<div>
<ul class="uk-tab uk-margin-top" data-uk-tab="{connect: '#pubTabs'">
<li (click)="charts.projectPublications.columns.load = true"><a href="#">Columns</a></li>
<li (click)="charts.projectPublications.pie.load = true"><a href="#">Pie</a></li>
<li (click)="charts.projectPublications.table.load = true"><a href="#">Table</a></li>
</ul>
<ul id="pubTabs" class="uk-switcher uk-margin">
<li>
<div *ngIf="charts.projectPublications.columns.load">
<i-frame [url]=charts.projectPublications.columns.url width="1000" height="450"></i-frame>
</div>
</li>
<li>
<div *ngIf="charts.projectPublications.pie.load">
<i-frame [url]=charts.projectPublications.pie.url width="1000" height="450"></i-frame>
</div>
</li>
<li>
<div *ngIf="charts.projectPublications.table.load">
<i-frame [url]=charts.projectPublications.table.url width="1000" height="450"></i-frame>
</div>
</li>
</ul>
</div>
</div>
<div *ngIf="statistics.publications.total == 0" class="uk-alert uk-alert-primary">
No research data available
</div>
</li>
<li>
<div class="uk-text-uppercase uk-text-bold uk-heading-divider">
<h2>Research data statistics</h2>
<div *ngIf="statistics.datasets.total" class="uk-text-small">
<span>{{statistics.datasets.total}} datasets from {{statistics.total_projects}} projects.</span><br>
<span>{{statistics.datasets.open_access}} are OA</span>
<span *ngIf="statistics.datasets.restricted && statistics.datasets.restricted > 0">,
{{statistics.datasets.restricted}} are restricted
</span>
<span *ngIf="statistics.datasets.embargo && statistics.datasets.embargo > 0">
and {{statistics.datasets.embargo}} are still in embargo
</span>
</div>
</div>
<div *ngIf="statistics.datasets.total">
<div *ngIf="charts.timelines.datasets.load">
<i-frame [url]=charts.timelines.datasets.url width="1000" height="450"></i-frame>
</div>
<div *ngIf="charts.graphs.dataGraph.load">
<i-frame [url]=charts.graphs.dataGraph.url width="1000" height="450"></i-frame>
</div> </div>
<div *ngIf="charts.get(entity).get('graph') && (displayedGraph == (entity + 'Graph'))">
<iframe [src]=displayedGraphUrl width="1000" height="450"></iframe>
<hr> <hr>
<div>
<h4 class="uk-text-uppercase uk-text-bold">Research data per project</h4>
</div> </div>
<div> <div>
<ul class="uk-tab uk-margin-top" data-uk-tab="{connect: '#dataTabs'"> <h4 class="uk-text-uppercase uk-text-bold">{{ communityId }} {{ entity }}{{ entity == 'software' ? '' : 's' }} per project</h4>
<li (click)="charts.projectDatasets.columns.load = true"><a href="#">Columns</a></li>
<li (click)="charts.projectDatasets.pie.load = true"><a href="#">Pie</a></li>
<li (click)="charts.projectDatasets.table.load = true"><a href="#">Table</a></li>
</ul>
<ul id="dataTabs" class="uk-switcher uk-margin">
<li>
<div *ngIf="charts.projectDatasets.columns.load">
<i-frame [url]=charts.projectDatasets.columns.url width="1000" height="450"></i-frame>
</div>
</li>
<li>
<div *ngIf="charts.projectDatasets.pie.load">
<i-frame [url]=charts.projectDatasets.pie.url width="1000" height="450"></i-frame>
</div>
</li>
<li>
<div *ngIf="charts.projectDatasets.table.load">
<i-frame [url]=charts.projectDatasets.table.url width="1000" height="450"></i-frame>
</div>
</li>
</ul>
</div>
</div>
<div *ngIf="statistics.datasets.total == 0" class="uk-alert uk-alert-primary">
No research data available
</div>
</li>
<li>
<div class="uk-text-uppercase uk-text-bold uk-heading-divider">
<h2>Software statistics</h2>
<div *ngIf="statistics.software.total" class="uk-text-small">
<span>{{statistics.software.total}} datasets from {{statistics.total_projects}} projects.</span><br>
<span>{{statistics.software.open_access}} are OA</span>
<span *ngIf="statistics.software.restricted && statistics.software.restricted > 0">,
{{statistics.software.restricted}} are restricted
</span>
<span *ngIf="statistics.software.embargo && statistics.software.embargo > 0">
and {{statistics.software.embargo}} are still in embargo
</span>
</div>
</div>
<div *ngIf="statistics.software.total">
<div *ngIf="charts.timelines.software.load">
<i-frame [url]=charts.timelines.software.url width="1000" height="450"></i-frame>
</div>
<div *ngIf="charts.graphs.softwareGraph.load">
<i-frame [url]=charts.graphs.softwareGraph.url width="1000" height="450"></i-frame>
</div>
<hr>
<div>
<h4 class="uk-text-uppercase uk-text-bold">Software per project</h4>
</div> </div>
<div> <div>
<ul class="uk-tab uk-margin-top" data-uk-tab="{connect: '#softwareTabs'"> <ul class="uk-tab uk-margin-top" data-uk-tab="{connect: '#projectChartTabs'">
<li (click)="charts.projectSoftware.columns.load = true"><a href="#">Columns</a></li> <li *ngIf="charts.get(entity).get('projectColumn')"
<li (click)="charts.projectSoftware.pie.load = true"><a href="#">Pie</a></li> (click)="changeDisplayedProjectChart(entity + 'Projectcolumn')">
<li (click)="charts.projectSoftware.table.load = true"><a href="#">Table</a></li>
</ul>
<ul id="softwareTabs" class="uk-switcher uk-margin">
<li>
<div *ngIf="charts.projectSoftware.columns.load">
<i-frame [url]=charts.projectSoftware.columns.url width="1000" height="450"></i-frame>
</div>
</li>
<li>
<div *ngIf="charts.projectSoftware.pie.load">
<i-frame [url]=charts.projectSoftware.pie.url width="1000" height="450"></i-frame>
</div>
</li>
<li>
<div *ngIf="charts.projectSoftware.table.load">
<i-frame [url]=charts.projectSoftware.table.url width="1000" height="450"></i-frame>
</div>
</li>
</ul>
</div>
</div>
<div *ngIf="statistics.software.total == 0" class="uk-alert uk-alert-primary">
No software available
</div>
</li>
</ul>
</div>
<!-- ORIGINAL HTML --> <a href="#">Columns</a>
<!-- </li>
<div> <li *ngIf="charts.get(entity).get('projectPie')"
{{statistics.publications.total}} publications from (click)="changeDisplayedProjectChart(entity + 'Projectpie')">
&lt;!&ndash;span *ngIf="statistics.virtual_organizations && statistics.virtual_organizations > 0"> {{statistics.virtual_organizations}} VOs and</span&ndash;&gt;
{{statistics.total_projects}} projects.
</div>
<div>
{{statistics.publications.open_access}} are OA
<span *ngIf="statistics.publications.restricted && statistics.publications.restricted > 0">, {{statistics.publications.restricted}} are restricted </span>
<span *ngIf="statistics.publications.embargo && statistics.publications.embargo > 0">and {{statistics.publications.embargo}} are still in embargo </span>
</div>
</div>
<div *ngIf="charts && charts.timelines && statistics">
<div class="uk-text-large" >Timelines of research results</div>
<div class="uk-grid">
<ul class="uk-tab uk-tab-left uk-width-1-5 uk-margin-top" data-uk-tab="{connect:'#timelinestabs'}">
<li (click)="charts.timelines.publications.load = true"><a href="#">Publications</a></li>
<li (click)="charts.timelines.datasets.load = true"><a href="#" disabled>Research Data</a></li>
<li (click)="charts.timelines.software.load = true"><a href="#">Software</a></li>
</ul>
<ul id="timelinestabs" class="uk-switcher uk-margin uk-width-4-5" style="height:450px; padding: 5px;"> <a href="#">Pie</a>
<li>
<div *ngIf="charts.timelines.publications.load && statistics.publications.total > 0">
<i-frame [url]=charts.timelines.publications.url width="1000" height="450"></i-frame>
</div>
<div *ngIf="statistics.publications.total == 0" class="uk-alert uk-alert-primary">
No publications available
</div>
</li> </li>
<li> <li *ngIf="charts.get(entity).get('projectTable')"
<div *ngIf="charts.timelines.datasets.load && statistics.datasets.total > 0"> (click)="changeDisplayedProjectChart(entity + 'Projecttable')">
<i-frame [url]=charts.timelines.datasets.url width="1000" height="450"></i-frame>
</div>
<div *ngIf="statistics.datasets.total == 0" class="uk-alert uk-alert-primary">
No research data available
</div>
</li>
<li>
<div *ngIf="charts.timelines.software.load && statistics.software.total > 0">
<i-frame [url]=charts.timelines.software.url width="1000" height="450"></i-frame>
</div>
<div *ngIf="statistics.software.total == 0" class="uk-alert uk-alert-primary">
No software available
</div>
</li>
</ul>
</div>
</div>
<div *ngIf="charts && charts.projectPublications && statistics && statistics.publications.total > 0"> <a href="#">Table</a>
<div class="uk-text-large" >Publications per projects</div> </li>
<ul class="uk-tab uk-margin-top" data-uk-tab="{connect:'#publicationtabs'}">
<li (click)="charts.projectPublications.columns.load = true"><a href="#">Columns</a></li>
<li (click)="charts.projectPublications.pie.load = true"><a href="#">Pie</a></li>
<li (click)="charts.projectPublications.table.load = true"><a href="#">Table</a></li>
</ul> </ul>
<ul id="projectChartTabs" class="uk-switcher uk-margin">
<ul id="publicationtabs" class="uk-switcher uk-margin" style="height:450px;">
<li> <li>
<div *ngIf="charts.projectPublications.columns.load"> <div *ngIf="charts.get(entity).get('projectColumn') && (displayedProjectChart == (entity + 'Projectcolumn'))">
<i-frame [url]=charts.projectPublications.columns.url width="1000" height="450"></i-frame> <iframe [src]=displayedProjectChartUrl width="1000" height="450"></iframe>
</div> </div>
</li> </li>
<li> <li>
<div *ngIf="charts.projectPublications.pie.load"> <div *ngIf="charts.get(entity).get('projectPie') && (displayedProjectChart == (entity + 'Projectpie'))">
<i-frame [url]=charts.projectPublications.pie.url width="1000" height="450"></i-frame> <iframe [src]=displayedProjectChartUrl width="1000" height="450"></iframe>
</div> </div>
</li> </li>
<li> <li>
<div *ngIf="charts.projectPublications.table.load"> <div *ngIf="charts.get(entity).get('projectTable') && displayedProjectChart == (entity + 'Projecttable')">
<i-frame [url]=charts.projectPublications.table.url width="1000" height="450"></i-frame> <iframe [src]=displayedProjectChartUrl width="1000" height="450"></iframe>
</div> </div>
</li> </li>
</ul> </ul>
</div> </div>
<div *ngIf="charts && charts.projectDatasets && statistics && statistics.datasets.total > 0">
<div class="uk-text-large" >Research data per projects</div>
<ul class="uk-tab uk-margin-top" data-uk-tab="{connect:'#datasettabs'}">
<li (click)="charts.projectDatasets.columns.load = true"><a href="#">Columns</a></li>
<li (click)="charts.projectDatasets.pie.load = true"><a href="#">Pie</a></li>
<li (click)="charts.projectDatasets.table.load = true"><a href="#">Table</a></li>
</ul>
<ul id="datasettabs" class="uk-switcher uk-margin" style="height:450px;">
<li>
<div *ngIf="charts.projectDatasets.columns.load">
<i-frame [url]=charts.projectDatasets.columns.url width="1000" height="450"></i-frame>
</div> </div>
</li> <div *ngIf="!statisticsSum[entity + (entity == 'software' ? '' : 's')].total" class="uk-alert uk-alert-primary">
<li> No {{ entity }}{{ entity == 'software' ? '' : 's' }} available
<div *ngIf="charts.projectDatasets.pie.load">
<i-frame [url]=charts.projectDatasets.pie.url width="1000" height="450"></i-frame>
</div>
</li>
<li>
<div *ngIf="charts.projectDatasets.table.load">
<i-frame [url]=charts.projectDatasets.table.url width="1000" height="450"></i-frame>
</div> </div>
</li> </li>
</ul> </ul>
</div> </div>
<div *ngIf="charts && charts.projectSoftware && statistics && statistics.software.total > 0">
<div class="uk-text-large" >Software per projects</div>
<ul class="uk-tab uk-margin-top" data-uk-tab="{connect:'#softwaretabs'}">
<li (click)="charts.projectSoftware.columns.load = true"><a href="#">Columns</a></li>
<li (click)="charts.projectSoftware.pie.load = true"><a href="#">Pie</a></li>
<li (click)="charts.projectSoftware.table.load = true"><a href="#">Table</a></li>
</ul>
<ul id="softwaretabs" class="uk-switcher uk-margin" style="height:450px;">
<li>
<div *ngIf="charts.projectSoftware.columns.load">
<i-frame [url]=charts.projectSoftware.columns.url width="1000" height="450"></i-frame>
</div>
</li>
<li>
<div *ngIf="charts.projectSoftware.pie.load">
<i-frame [url]=charts.projectSoftware.pie.url width="1000" height="450"></i-frame>
</div>
</li>
<li>
<div *ngIf="charts.projectSoftware.table.load">
<i-frame [url]=charts.projectSoftware.table.url width="1000" height="450"></i-frame>
</div>
</li>
</ul>
-->
</div> </div>
</article> </article>
</div> </div>
</div> </div>

View File

@ -1,14 +1,14 @@
import {Component} from '@angular/core'; import {Component} from '@angular/core';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {Location} from '@angular/common'; import { Location, TitleCasePipe } from '@angular/common';
import "rxjs/add/observable/zip"; import "rxjs/add/observable/zip";
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes'; import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
import {StatisticsSummary} from "./statisticsEntities"; import { availableCharts, availableEntities, StatisticsDisplay, StatisticsSummary } from "./statisticsEntities";
import {Properties} from '../utils/properties'; import {Properties} from '../utils/properties';
import {StatisticsService} from '../utils/services/statistics.service'; import {StatisticsService} from '../utils/services/statistics.service';
@ -18,6 +18,7 @@ import {CommunitiesService} from "../openaireLibrary/connect/communitie
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service'; import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
import {Meta} from '../openaireLibrary/sharedComponents/metaService'; import {Meta} from '../openaireLibrary/sharedComponents/metaService';
import { DomSanitizer, SafeResourceUrl, SafeUrl } from '@angular/platform-browser';
@Component({ @Component({
selector: 'statistics', selector: 'statistics',
@ -33,15 +34,36 @@ export class StatisticsComponent {
properties:EnvProperties; properties:EnvProperties;
public communityId = null; public communityId = null;
public communityInfo = null; public communityInfo = null;
public statistics: StatisticsSummary;
charts = null; entitiesList: string[] = availableEntities;
entitiesForCommunity: string[] = [];
chartCatsList: string[] = availableCharts;
allowedCharts: string[] = [];
statisticsSum: StatisticsSummary;
statisticsDisplay: StatisticsDisplay;
charts: Map<string,Map<string,any>> = new Map<string,Map<string,any>>();
chartsUrlMap: {};
public displayedTimeline: string;
public displayedTimelineUrl: string;
public displayedGraph: string;
public displayedGraphUrl: string;
public displayedProjectChart: string;
public displayedProjectChartUrl: string;
constructor ( constructor (
private route: ActivatedRoute, private route: ActivatedRoute,
private _router: Router, private _router: Router,
private location: Location, private _meta: Meta, private _piwikService:PiwikService, private location: Location,
private _meta: Meta,
private _piwikService:PiwikService,
private config: ConfigurationService, private config: ConfigurationService,
private _communityService:CommunityService, private _communitiesService:CommunitiesService, private _statisticsService: StatisticsService private _communityService:CommunityService,
private _communitiesService:CommunitiesService,
private _statisticsService: StatisticsService,
private titleCase: TitleCasePipe,
private sanitizer: DomSanitizer
) { ) {
var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects "; var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ";
@ -61,7 +83,7 @@ export class StatisticsComponent {
this.route.data this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => { .subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific; this.properties = data.envSpecific;
var url = data.envSpecific.baseLink+this._router.url var url = data.envSpecific.baseLink+this._router.url;
this._meta.updateProperty("og:url", url); this._meta.updateProperty("og:url", url);
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE").subscribe(); this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE").subscribe();
@ -71,20 +93,8 @@ export class StatisticsComponent {
communityId => { communityId => {
this.communityId = communityId['communityId']; this.communityId = communityId['communityId'];
console.log(" Stats! "+ this.properties.statisticsAPIURL); console.log(" Stats! "+ this.properties.statisticsAPIURL);
this._statisticsService.getCommunityStatistics(this.properties.statisticsAPIURL+"communities/",this.communityId).subscribe ( this.createStatisticsObjects();
res => {
this.statistics = res;
console.log(this.statistics);
}); });
this.createCharts();
});
/* NOT NEEDED ??*/
/*this._communityService.getCommunity(this.properties.communityAPI+this.communityId).subscribe (
communityInfo => {
this.communityInfo = communityInfo;
console.log(communityInfo);
});*/
}); });
} }
@ -97,67 +107,120 @@ export class StatisticsComponent {
} }
getCamelCaseString(inputString: string) {
return this.titleCase.transform(inputString);
}
createStatisticsObjects() {
console.log(" Stats! "+ this.properties.statisticsAPIURL);
this._statisticsService.getCommunityStatistics(this.properties.statisticsAPIURL,this.communityId).subscribe (
res => {
this.statisticsSum = res;
},
error => {
console.log(error)
},
() => {
this.getDisplayOptions();
});
}
getDisplayOptions() {
this._statisticsService.getCommunityAdminStatisticsChoices(this.properties.adminToolsAPIURL,this.communityId)
.subscribe(
res => {
this.statisticsDisplay = res;
},
error => {
console.log(error)
},
() => {
this.createCharts();
}
);
}
/* checks which charts exist and which the admin has chosen to display in connect monitor */
private createCharts() { private createCharts() {
this.charts = { this.createChartUrlMap();
graphs: {
pubGraph:
{url: this.properties.statisticsFrameAPIURL + 'chart.php?com=query&data={"query":"comOAPubs","comId":"'+ this.communityId + '","table":"result","fields":[{"fld":"number","agg":"count","type":"pie","yaxis":1,"c":false}],"xaxis":{"name":"bestlicense","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"order":"d","yaxisheaders":[""],"fieldsheaders":[""],"in":[],"filters":[],"having":[],"incfilters":[],"inchaving":[],"title":"Publications by access mode","subtitle":"","xaxistitle":"","nulls":true}&w=500&amph=600',
load:true},
dataGraph:
{url: this.properties.statisticsFrameAPIURL + 'chart.php?com=query&data={"query":"comOAData","comId":"'+ this.communityId +'","table":"result","fields":[{"fld":"number","agg":"count","type":"pie","yaxis":1,"c":false}],"xaxis":{"name":"bestlicense","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"order":"d","yaxisheaders":[""],"fieldsheaders":[""],"in":[],"filters":[],"having":[],"incfilters":[],"inchaving":[],"title":"Datasets by access mode","subtitle":"","xaxistitle":"","nulls":true}&w=500&amph=600',
load: true},
softwareGraph:
{url: this.properties.statisticsFrameAPIURL + 'chart.php?com=query&data={"query":"comOASoft","comId":"'+ this.communityId +'","table":"result","fields":[{"fld":"number","agg":"count","type":"pie","yaxis":1,"c":false}],"xaxis":{"name":"bestlicense","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"order":"d","yaxisheaders":[""],"fieldsheaders":[""],"in":[],"filters":[],"having":[],"incfilters":[],"inchaving":[],"title":"Software by access mode","subtitle":"","xaxistitle":"","nulls":true}&w=500&amph=600',
load:true}
},
timelines: {
publications:
{url: this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data=com=query&data={"query":"comTimelinePubs","comId":"'+ this.communityId + '","table":"result","fields":[{"fld":"number","agg":"count","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Publications"],"fieldsheaders":["publications"],"in":[{"f":0,"text":"Yearly"}],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"Timeline of publications through the years","subtitle":"","xaxistitle":"Year"}&w=70%&h=83%',
load:true},
datasets:
{url: this.properties.statisticsFrameAPIURL + 'chart.php?com=query&data={"query":"comTimelineData","comId":"'+ this.communityId + '","table":"result","fields":[{"fld":"number","agg":"count","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Datasets"],"fieldsheaders":["publications"],"in":[{"f":0,"text":"Yearly"}],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"Research data through the years","subtitle":"","xaxistitle":"Year"}&w=90%&h=83%',
load:false},
software:
{url: this.properties.statisticsFrameAPIURL + 'chart.php?com=query&data={"query":"comTimelineSoft","comId":"'+ this.communityId + '","table":"result","fields":[{"fld":"number","agg":"count","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Software"],"fieldsheaders":["publications"],"in":[{"f":0,"text":"Yearly"}],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"Software through the years","subtitle":"","xaxistitle":"Year"}&w=90%&h=83%',
load:false},
},
projectPublications: {
columns:
{url: this.properties.statisticsFrameAPIURL + 'chart.php?com=query&data={"query":"comProjectPubs","comId":"'+ this.communityId + '","table":"result","fields":[{"fld":"number","agg":"count","type":"bar","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Publications"],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"","subtitle":"","xaxistitle":"Project"}&w=70%&h=83%',
load:true},
pie:
{url: this.properties.statisticsFrameAPIURL + 'chart.php?com=query&data={"query":"comProjectPubs","comId":"'+ this.communityId + '","table":"result","fields":[{"fld":"number","agg":"count","type":"pie","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Publications"],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"","subtitle":"","xaxistitle":"Project"}&w=100%&h=83%',
display:false},
table:{url: this.properties.statisticsFrameAPIURL + 'gtable.php?com=query&data={"query":"comProjectPubs","comId":"'+ this.communityId + '","table":"result","fields":[{"fld":"number","agg":"count","type":"bar","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Publications"],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"","subtitle":"","xaxistitle":"Project"}&w=90%&h=83%',
load:false}
},
projectDatasets: {
columns:
{url: this.properties.statisticsFrameAPIURL + 'chart.php?com=query&data={"query":"comProjectData","comId":"'+ this.communityId + '","table":"result","fields":[{"fld":"number","agg":"count","type":"bar","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Datasets"],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"","subtitle":"","xaxistitle":"Project"}&w=90%&h=83%',
load:true},
pie:
{url: this.properties.statisticsFrameAPIURL + 'chart.php?com=query&data={"query":"comProjectData","comId":"'+ this.communityId + '","table":"result","fields":[{"fld":"number","agg":"count","type":"pie","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Datasets"],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"","subtitle":"","xaxistitle":"Project"}&w=90%&h=83%',
load:false},
table:{url: this.properties.statisticsFrameAPIURL + 'gtable.php?com=query&data={"query":"comProjectData","comId":"'+ this.communityId + '","table":"result","fields":[{"fld":"number","agg":"count","type":"bar","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Datasets"],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"","subtitle":"","xaxistitle":"Project"}&w=90%&h=83%',
load:false}
},
projectSoftware: {
columns:
{url: this.properties.statisticsFrameAPIURL + 'chart.php?com=query&data={"query":"comProjectSoft","comId":"'+ this.communityId +'","table":"result","fields":[{"fld":"number","agg":"count","type":"bar","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Software"],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"","subtitle":"","xaxistitle":"Project"}',
load:true},
pie:
{url: this.properties.statisticsFrameAPIURL + 'chart.php?com=query&data={"query":"comProjectSoft","comId":"'+ this.communityId + '","table":"result","fields":[{"fld":"number","agg":"count","type":"pie","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Software"],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"","subtitle":"","xaxistitle":"Project"}&w=90%&h=83%',
load:false},
table:{url: this.properties.statisticsFrameAPIURL + 'gtable.php?com=query&data={"query":"comProjectSoft","comId":"'+ this.communityId + '","table":"result","fields":[{"fld":"number","agg":"count","type":"bar","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Software"],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"","subtitle":"","xaxistitle":"Project"}&w=90%&h=83%',
load:false}
}
/* for each entity find the statistics display information
from apiUrl/statistics/communityId
*/
for ( let entity of this.entitiesList ) {
let displayOptionsForEntity = this.statisticsDisplay.entities[entity];
/* if the community has produced such entities */
if (displayOptionsForEntity && this.statisticsSum[entity+(entity=='software'?'':'s')]['total'] ) {
/* create a map of charts to be displayed */
let chartsMap: Map<string,any> = new Map<string,any>();
/* for each chart category find which charts exist
and which the admin has chosen to be displayed here
*/
for (let chart of this.chartCatsList) {
/* current chart is */
let displayOptionsForCharts = this.statisticsDisplay.entities[entity].charts.map[chart];
/* in the future we probably won't need to check if the url exists */
/* currently the url titles are created using the entity name and the chart name in camelcase */
let urlString = this.chartsUrlMap[entity + this.getCamelCaseString(chart)];
if (displayOptionsForCharts && displayOptionsForCharts.showInMonitor && urlString ) {
chartsMap.set( chart, urlString );
this.allowedCharts.push(entity + this.getCamelCaseString(chart));
} }
} }
toggleLoadChart(property: string, subprop: string) { /* add the entity's charts to the charts map */
this.charts[property][subprop]['load'] = !this.charts[property][subprop]['load']; this.charts.set(entity, chartsMap);
console.log(`changed to ${this.charts[property][subprop]['load']}`);
/* add the entity in the available entities for the current community */
this.entitiesForCommunity.push(entity);
}
}
this.onChangeEntity(this.entitiesForCommunity[0]);
}
createChartUrlMap() {
this.chartsUrlMap = {
publicationTimeline : this.sanitizer.bypassSecurityTrustResourceUrl(`${this.properties.statisticsFrameAPIURL}chart.php?com=query&persistent=false&data=com=query&data={"query":"comTimelinePubs","comId":"${this.communityId}","table":"result","fields":[{"fld":"number","agg":"count","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Publications"],"fieldsheaders":["publications"],"in":[{"f":0,"text":"Yearly"}],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"${this.communityId.toUpperCase()} publications through the years","subtitle":"","xaxistitle":"Year"}&w=70%&h=83%`),
publicationGraph: this.sanitizer.bypassSecurityTrustResourceUrl(`${this.properties.statisticsFrameAPIURL}chart.php?com=query&data={"query":"comOAPubs","comId":"${this.communityId}","table":"result","fields":[{"fld":"number","agg":"count","type":"pie","yaxis":1,"c":false}],"xaxis":{"name":"bestlicense","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"order":"d","yaxisheaders":[""],"fieldsheaders":[""],"in":[],"filters":[],"having":[],"incfilters":[],"inchaving":[],"title":"${this.communityId.toUpperCase()} publications by access mode","subtitle":"","xaxistitle":"","nulls":true}&w=70%&h=90%`),
publicationProjectcolumn: this.sanitizer.bypassSecurityTrustResourceUrl(`${this.properties.statisticsFrameAPIURL}chart.php?com=query&data={"query":"comProjectPubs","comId":"${this.communityId}","table":"result","fields":[{"fld":"number","agg":"count","type":"bar","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Publications"],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"","subtitle":"","xaxistitle":"Project"}&w=70%&h=90%`),
publicationProjectpie: this.sanitizer.bypassSecurityTrustResourceUrl(`${this.properties.statisticsFrameAPIURL}chart.php?com=query&data={"query":"comProjectPubs","comId":"${this.communityId}","table":"result","fields":[{"fld":"number","agg":"count","type":"pie","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Publications"],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"","subtitle":"","xaxistitle":"Project"}&w=91%&h=90%`),
publicationProjecttable: this.sanitizer.bypassSecurityTrustResourceUrl(`${this.properties.statisticsFrameAPIURL}gtable.php?com=query&data={"query":"comProjectPubs","comId":"${this.communityId}","table":"result","fields":[{"fld":"number","agg":"count","type":"bar","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Publications"],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"","subtitle":"","xaxistitle":"Project"}&w=90%&h=83%`),
datasetTimeline: this.sanitizer.bypassSecurityTrustResourceUrl(`${this.properties.statisticsFrameAPIURL}chart.php?com=query&data={"query":"comTimelineData","comId":"${this.communityId}","table":"result","fields":[{"fld":"number","agg":"count","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Datasets"],"fieldsheaders":["publications"],"in":[{"f":0,"text":"Yearly"}],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"${this.communityId.toUpperCase()} datasets through the years","subtitle":"","xaxistitle":"Year"}&w=70%&h=83%`),
datasetGraph: this.sanitizer.bypassSecurityTrustResourceUrl(`${this.properties.statisticsFrameAPIURL}chart.php?com=query&data={"query":"comOAData","comId":"${this.communityId}","table":"result","fields":[{"fld":"number","agg":"count","type":"pie","yaxis":1,"c":false}],"xaxis":{"name":"bestlicense","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"order":"d","yaxisheaders":[""],"fieldsheaders":[""],"in":[],"filters":[],"having":[],"incfilters":[],"inchaving":[],"title":"${this.communityId.toUpperCase()} datasets by access mode","subtitle":"","xaxistitle":"","nulls":true}&w=70%&h=90%`),
datasetProjectcolumn: this.sanitizer.bypassSecurityTrustResourceUrl(`${this.properties.statisticsFrameAPIURL}chart.php?com=query&data={"query":"comProjectData","comId":"${this.communityId}","table":"result","fields":[{"fld":"number","agg":"count","type":"bar","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Datasets"],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"","subtitle":"","xaxistitle":"Project"}`),
datasetProjectpie: this.sanitizer.bypassSecurityTrustResourceUrl(`${this.properties.statisticsFrameAPIURL}chart.php?com=query&data={"query":"comProjectData","comId":"${this.communityId}","table":"result","fields":[{"fld":"number","agg":"count","type":"pie","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Datasets"],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"","subtitle":"","xaxistitle":"Project"}&w=91%&h=90%`),
datasetProjecttable: this.sanitizer.bypassSecurityTrustResourceUrl(`${this.properties.statisticsFrameAPIURL}gtable.php?com=query&data={"query":"comProjectData","comId":"${this.communityId}","table":"result","fields":[{"fld":"number","agg":"count","type":"bar","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Datasets"],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"","subtitle":"","xaxistitle":"Project"}&w=90%&h=83%`),
softwareTimeline: this.sanitizer.bypassSecurityTrustResourceUrl(`${this.properties.statisticsFrameAPIURL}chart.php?com=query&data={"query":"comTimelineSoft","comId":"${this.communityId}","table":"result","fields":[{"fld":"number","agg":"count","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Software"],"fieldsheaders":["publications"],"in":[{"f":0,"text":"Yearly"}],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"${this.communityId.toUpperCase()} software through the years","subtitle":"","xaxistitle":"Year"}&w=70%&h=83%`),
softwareGraph: this.sanitizer.bypassSecurityTrustResourceUrl(`${this.properties.statisticsFrameAPIURL}chart.php?com=query&data={"query":"comOASoft","comId":"${this.communityId}","table":"result","fields":[{"fld":"number","agg":"count","type":"pie","yaxis":1,"c":false}],"xaxis":{"name":"bestlicense","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"order":"d","yaxisheaders":[""],"fieldsheaders":[""],"in":[],"filters":[],"having":[],"incfilters":[],"inchaving":[],"title":"${this.communityId.toUpperCase()} software by access mode","subtitle":"","xaxistitle":"","nulls":true}&w=70%&h=90%`),
softwareProjectcolumn: this.sanitizer.bypassSecurityTrustResourceUrl(`${this.properties.statisticsFrameAPIURL}chart.php?com=query&data={"query":"comProjectSoft","comId":"${this.communityId}","table":"result","fields":[{"fld":"number","agg":"count","type":"bar","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Software"],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"","subtitle":"","xaxistitle":"Project"}`),
softwareProjectpie: this.sanitizer.bypassSecurityTrustResourceUrl(`${this.properties.statisticsFrameAPIURL}chart.php?com=query&data={"query":"comProjectSoft","comId":"${this.communityId}","table":"result","fields":[{"fld":"number","agg":"count","type":"pie","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Software"],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"","subtitle":"","xaxistitle":"Project"}&w=91%&h=90%`),
softwareProjecttable: this.sanitizer.bypassSecurityTrustResourceUrl(this.properties.statisticsFrameAPIURL + 'gtable.php?com=query&data={"query":"comProjectSoft","comId":"'+ this.communityId + '","table":"result","fields":[{"fld":"number","agg":"count","type":"bar","yaxis":1,"c":false}],"xaxis":{"name":"year","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"yaxisheaders":["Software"],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"year","max":"2013","min":"2007","to":-1},{"name":"result_projects-project-funding_lvl0","values":["FP7"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funding_lvl2","values":["ERC"],"to":"-1"}],"having":[],"incfilters":[],"inchaving":[],"title":"","subtitle":"","xaxistitle":"Project"}&w=90%&h=83%')
};
}
onChangeEntity (entity: string) {
this.displayedTimeline = `${entity}Timeline`;
this.displayedTimelineUrl = this.chartsUrlMap[this.displayedTimeline];
this.displayedGraph = `${entity}Graph`;
this.displayedGraphUrl = this.chartsUrlMap[this.displayedGraph];
this.displayedProjectChart = this.allowedCharts.filter( x => x.includes(entity+'Project') )[0];
this.displayedProjectChartUrl = this.chartsUrlMap[this.displayedProjectChart];
console.log(`displayed Timeline is: ${this.displayedTimeline}`);
console.log(`displayed Graph is: ${this.displayedGraph}`);
console.log(`displayed ProjectChart is: ${this.displayedProjectChart}`);
}
changeDisplayedProjectChart(chartName: string) {
this.displayedProjectChart = chartName;
this.displayedProjectChartUrl = this.chartsUrlMap[this.displayedProjectChart];
console.log(`displayed ProjectChart is: ${this.displayedProjectChart}`);
} }
} }

View File

@ -1,5 +1,5 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common'; import { CommonModule, TitleCasePipe } from '@angular/common';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
import {RouterModule} from '@angular/router'; import {RouterModule} from '@angular/router';
@ -28,7 +28,7 @@ import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previo
], ],
providers:[ providers:[
FreeGuard, PreviousRouteRecorder, ConfigurationService, Meta, FreeGuard, PreviousRouteRecorder, ConfigurationService, Meta,
PiwikService, CommunityService, CommunitiesService, StatisticsService PiwikService, CommunityService, CommunitiesService, StatisticsService, TitleCasePipe
], ],
exports: [ exports: [
StatisticsComponent StatisticsComponent

View File

@ -1,3 +1,45 @@
export const availableCharts = [
'timeline',
'graph',
'projectColumn',
'projectPie',
'projectTable'
];
export const availableNumbers = [
'total',
'open',
'embargo',
'project',
'closed'
];
export const availableEntities = [
'publication',
'datasets',
'software'
];
export class DisplayStatsOptions {
showInMonitor: boolean;
showInDashboard: boolean;
}
export class StatisticsMap {
map: Map<string,DisplayStatsOptions>;
}
export class EntityStats {
charts: StatisticsMap;
numbers: StatisticsMap;
}
export class StatisticsDisplay {
pid: string;
entities: Map<string,EntityStats>;
id: string;
}
export class StatisticsNumbers { export class StatisticsNumbers {
total: number; total: number;

View File

@ -1,21 +1,38 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions } from '@angular/http'; import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Rx'; import { Observable } from 'rxjs/Rx';
import { StatisticsDisplay, StatisticsSummary } from '../../statistics/statisticsEntities';
@Injectable() @Injectable()
export class StatisticsService { export class StatisticsService {
constructor(private http:Http) { constructor(private http:Http) { }
getCommunityStatistics(apiUrl: string, communityId: string): Observable<StatisticsSummary> {
let url = `${apiUrl}communities/${communityId}`;
console.log(`getting statistics summary from: ${url}`);
return this.http.get(url)
.map(res => <any>res.json())
.do(res => {console.log(res)})
.map(res => res.statistics)
.do(res => {console.log(res)});
} }
getCommunityStatistics(url: string, community) { getCommunityAdminStatisticsChoices(apiUrl: string, communityId: string): Observable<StatisticsDisplay> {
return this.http.get(url+community) let url = `${apiUrl}/statistics/${communityId}`;
.map(res => <any> res.json()).do(res => {console.log(res)}).map(res => res.statistics).do(res => {console.log(res)}); console.log(`getting admin choices for statistics from: ${url}`);
return this.http.get(url)
.map(stats => <StatisticsDisplay>stats.json())
.catch(this.handleError);
} }
private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
console.log(error);
return Observable.throw(error || 'Server error');
}
} }