finished statistics monitor and added statistics to dashboard

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@51332 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
myrto.koukouli 2018-03-19 14:48:13 +00:00
parent 8558a25b7b
commit 439232fa7a
8 changed files with 163 additions and 123 deletions

View File

@ -106,16 +106,9 @@
<results-comp [(results)]=softwareResults resultType="software" [community]=community [params]=params></results-comp>
</div>
</div>
<!--div class="uk-grid">
<div class="uk-text-center uk-width-1-2@m uk-width-1-1@s">
<p class="uk-text-large"> Publications through the years</p>
<img alt="stats" class="uk-responsive-width" src="./assets/stats1.png">
</div>
<div class="uk-text-center uk-width-1-2@m uk-width-1-1@s">
<p class="uk-text-large"> Publications per project</p>
<img alt="stats" class="uk-responsive-width" src="./assets/pub-per-pr.png">
</div>
</div-->
<div>
<statistics-for-dashboard [currentMode]="'showInDashboard'"></statistics-for-dashboard>
</div>
</article>
</div>

View File

@ -16,11 +16,12 @@ import {CommunityService} from '../openaireLibrary/connect/community/community.s
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {SubscribeModule} from '../utils/subscribe/subscribe.module';
import {StatisticsModule} from "../statistics/statistics.module";
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule,
CommunityRoutingModule, SubscribeModule
CommunityRoutingModule, SubscribeModule, StatisticsModule
],
declarations: [
CommunityComponent, ResultsComponent

View File

@ -0,0 +1,47 @@
<div>
<h2 class="uk-h3 uk-text-primary">
<span>Most recent statistics</span>
</h2>
</div>
<div>
<div *ngFor="let entity of allowedEntities">
<div *ngIf="statisticsSum[entity].total">
<div class="uk-text-uppercase uk-text-bold uk-heading-divider">
<h3>{{ entity == 'software' ? getCamelCaseString(entity) : (entity == 'dataset'? 'Research Data' : getCamelCaseString(entity) + 's') }} statistics</h3>
<div class="uk-text-small">
<span *ngIf="statisticsDisplay.entities[entity].numbers.map['total'][currentMode]">
{{statisticsSum[entity].total}} {{ entity + (entity == 'software' ? '' : 's') }}
</span>
<span *ngIf="statisticsDisplay.entities[entity].numbers.map['project'][currentMode]">
from {{statisticsSum[entity].projects}} projects.
</span><br>
<span *ngIf="statisticsSum[entity].open_access &&
statisticsDisplay.entities[entity].numbers.map['open'][currentMode]">
{{statisticsSum[entity].open_access}}
{{statisticsSum[entity].open_access > 1 ? 'are' : 'is'}} OA
</span>
<span *ngIf="statisticsSum[entity].closed_access &&
statisticsDisplay.entities[entity].numbers.map['closed'][currentMode]">,
{{statisticsSum[entity].closed_access}}
{{statisticsSum[entity].closed_access > 1 ? 'are' : 'is'}} closed
</span>
<span *ngIf="statisticsSum[entity].restricted &&
statisticsDisplay.entities[entity].numbers.map['open'][currentMode]">,<!--CORRECT ME WHEN RESTRICTED ARE ADDED!-->
{{statisticsSum[entity].restricted}}
{{statisticsSum[entity].restricted > 1 ? 'are' : 'is'}} restricted
</span>
<span *ngIf="statisticsSum[entity].embargo &&
statisticsDisplay.entities[entity].numbers.map['embargo'][currentMode]">
and {{statisticsSum[entity].embargo}}
{{statisticsSum[entity].embargo > 1 ? 'are' : 'is'}} still in embargo.
</span>
</div>
</div>
<div class="uk-grid">
<div *ngFor="let chart of allowedCharts[entity]" class="uk-width-1-2 uk-first-column">
<iframe [src]=chartsUrlMap[chart] width="750" height="450"></iframe>
</div>
</div>
</div>
</div>
</div>

View File

@ -19,66 +19,84 @@
<ul id="tabs" class="uk-switcher uk-margin uk-width-5-6" style="min-height:450px; padding-left:40px;">
<li *ngFor="let entity of entitiesList">
<div *ngIf="!(statisticsSum[entity + (entity == 'software' ? '' : 's')]['total'])"
class="uk-alert uk-alert-info">
No {{ entity }}{{ entity == 'software' ? '' : 's' }} available
</div>
<div *ngIf="statisticsDisplay.entities[entity] && statisticsSum[entity+(entity=='software'?'':'s')].total">
<div *ngIf="displayedEntity == entity && statisticsDisplay.entities[entity] && statisticsSum[entity]">
<div class="uk-text-uppercase uk-text-bold uk-heading-divider">
<h2>{{ getCamelCaseString(entity) }}{{ entity == 'software' ? '' : 's' }} statistics</h2>
<div *ngIf="statisticsSum[entity + (entity == 'software' ? '' : 's')].total" class="uk-text-small">
<span>{{statisticsSum[entity + (entity == 'software' ? '' : 's')].total}} {{ entity + (entity == 'software' ? '' : 's') }} from {{statisticsSum.total_projects}} projects.</span><br>
<span>{{statisticsSum[entity + (entity == 'software' ? '' : 's')].open_access}} are OA</span>
<span *ngIf="statisticsSum[entity + (entity == 'software' ? '' : 's')].restricted">,
{{statisticsSum[entity + (entity == 'software' ? '' : 's')].restricted}} are restricted
</span>
<span *ngIf="statisticsSum[entity + (entity == 'software' ? '' : 's')].embargo">
and {{statisticsSum[entity + (entity == 'software' ? '' : 's')].embargo}} are still in embargo
</span>
<div *ngIf="!statisticsSum[entity].total"
class="uk-alert uk-alert-info">
No {{ entity }}{{ entity == 'software' ? '' : 's' }} available
</div>
<div *ngIf="statisticsSum[entity].total"
class="uk-text-small">
<span *ngIf="statisticsDisplay.entities[entity].numbers.map['total'][currentMode]">
{{statisticsSum[entity].total}} {{ entity + (entity == 'software' ? '' : 's') }}
</span>
<span *ngIf="statisticsDisplay.entities[entity].numbers.map['project'][currentMode]">
from {{statisticsSum[entity].projects}} projects.
</span><br>
<span *ngIf="statisticsSum[entity].open_access &&
statisticsDisplay.entities[entity].numbers.map['open'][currentMode]">
{{statisticsSum[entity].open_access}}
{{statisticsSum[entity].open_access > 1 ? 'are' : 'is'}} OA
</span>
<span *ngIf="statisticsSum[entity].closed_access &&
statisticsDisplay.entities[entity].numbers.map['closed'][currentMode]">,
{{statisticsSum[entity].closed_access}}
{{statisticsSum[entity].closed_access > 1 ? 'are' : 'is'}} closed
</span>
<span *ngIf="statisticsSum[entity].restricted &&
statisticsDisplay.entities[entity].numbers.map['open'][currentMode]">,<!--CORRECT ME WHEN RESTRICTED ARE ADDED!-->
{{statisticsSum[entity].restricted}}
{{statisticsSum[entity].restricted > 1 ? 'are' : 'is'}} restricted
</span>
<span *ngIf="statisticsSum[entity].embargo &&
statisticsDisplay.entities[entity].numbers.map['embargo'][currentMode]">
and {{statisticsSum[entity].embargo}}
{{statisticsSum[entity].embargo > 1 ? 'are' : 'is'}} still in embargo.
</span>
</div>
</div>
<div>
<div *ngIf="statisticsDisplay.entities[entity].charts.map['timeline'] &&
statisticsDisplay.entities[entity].charts.map['timeline'].showInMonitor &&
chartsUrlMap[entity + 'Timeline'] &&
(displayedTimeline == (entity + 'Timeline'))">
<iframe [src]=displayedTimelineUrl width="1000" height="450"></iframe>
<hr>
</div>
<div *ngIf="statisticsDisplay.entities[entity].charts.map['graph'] &&
statisticsDisplay.entities[entity].charts.map['graph'].showInMonitor &&
chartsUrlMap[entity + 'Graph'] &&
(displayedGraph == (entity + 'Graph'))">
<iframe [src]=displayedGraphUrl width="1000" height="450"></iframe>
<hr>
<div *ngIf="statisticsSum[entity].total">
<div class="uk-grid">
<div *ngIf="statisticsDisplay.entities[entity].charts.map['timeline'] &&
statisticsDisplay.entities[entity].charts.map['timeline'][currentMode] &&
chartsUrlMap[entity + 'Timeline'] &&
(displayedTimeline == (entity + 'Timeline'))">
<iframe [src]=displayedTimelineUrl width="1000" height="450"></iframe>
</div>
<div *ngIf="statisticsDisplay.entities[entity].charts.map['graph'] &&
statisticsDisplay.entities[entity].charts.map['graph'][currentMode] &&
chartsUrlMap[entity + 'Graph'] &&
(displayedGraph == (entity + 'Graph'))">
<iframe [src]=displayedGraphUrl width="1000" height="450"></iframe>
</div>
</div>
<hr>
<div>
<h4 class="uk-text-uppercase uk-text-bold">{{ communityId }} {{ entity }}{{ entity == 'software' ? '' : 's' }} per project</h4>
</div>
<div>
<ul class="uk-tab uk-margin-top" data-uk-tab="{connect: '#projectChartTabs'">
<li *ngIf=" statisticsDisplay.entities[entity].charts.map['projectColumn'] &&
statisticsDisplay.entities[entity].charts.map['projectColumn'].showInMonitor &&
chartsUrlMap[entity + 'Projectcolumn'] &&
(displayedProjectChart == (entity + 'Projectcolumn'))"
statisticsDisplay.entities[entity].charts.map['projectColumn'][currentMode] &&
chartsUrlMap[entity + 'Projectcolumn']"
(click)="changeDisplayedProjectChart(entity + 'Projectcolumn')">
<a href="#">Columns</a>
</li>
<li *ngIf=" statisticsDisplay.entities[entity].charts.map['projectPie'] &&
statisticsDisplay.entities[entity].charts.map['projectPie'].showInMonitor &&
chartsUrlMap[entity + 'Projectpie'] &&
(displayedProjectChart == (entity + 'Projectpie'))"
statisticsDisplay.entities[entity].charts.map['projectPie'][currentMode] &&
chartsUrlMap[entity + 'Projectpie']"
(click)="changeDisplayedProjectChart(entity + 'Projectpie')">
<a href="#">Pie</a>
</li>
<li *ngIf=" statisticsDisplay.entities[entity].charts.map['projectTable'] &&
statisticsDisplay.entities[entity].charts.map['projectTable'].showInMonitor &&
chartsUrlMap[entity + 'Projecttable'] &&
(displayedProjectChart == (entity + 'Projecttable'))"
statisticsDisplay.entities[entity].charts.map['projectTable'][currentMode] &&
chartsUrlMap[entity + 'Projecttable']"
(click)="changeDisplayedProjectChart(entity + 'Projecttable')">
<a href="#">Table</a>
@ -86,12 +104,12 @@
</ul>
<ul id="projectChartTabs" class="uk-switcher uk-margin">
<li>
<div *ngIf="displayedProjectChart == (entity + 'Projectcolumn')">
<div *ngIf="displayedProjectChart == (entity + 'Projectcolumn')">
<iframe [src]=displayedProjectChartUrl width="1000" height="450"></iframe>
</div>
</li>
<li>
<div *ngIf="displayedProjectChart == (entity + 'Projectpie')">
<div *ngIf="displayedProjectChart == (entity + 'Projectpie')">
<iframe [src]=displayedProjectChartUrl width="1000" height="450"></iframe>
</div>
</li>

View File

@ -1,4 +1,4 @@
import {Component} from '@angular/core';
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Router} from '@angular/router';
import { Location, TitleCasePipe } from '@angular/common';
@ -35,20 +35,23 @@ export class StatisticsComponent {
public communityId = null;
public communityInfo = null;
@Input() currentMode = 'showInMonitor';
entitiesList: string[] = availableEntities;
chartCatsList: string[] = availableCharts;
allowedCharts: string[] = [];
allowedCharts: Map<string,string[]> = new Map<string,string[]>();
allowedEntities: string[] = [];
statisticsSum: StatisticsSummary;
statisticsDisplay: StatisticsDisplay;
chartsUrlMap: {};
public displayedTimeline: string;
public displayedTimelineUrl: string;
public displayedGraph: string;
public displayedGraphUrl: string;
public displayedProjectChart: string;
public displayedProjectChartUrl: string;
displayedTimeline: string;
displayedTimelineUrl: string;
displayedGraph: string;
displayedGraphUrl: string;
displayedProjectChart: string;
displayedProjectChartUrl: string;
displayedEntity: string;
constructor (
private route: ActivatedRoute,
@ -134,66 +137,28 @@ export class StatisticsComponent {
},
() => {
this.createChartUrlMap();
this.initializeDisplayedCharts('showInMonitor');
this.initializeDisplayedCharts();
}
);
}
/* /!* checks which charts exist and which the admin has chosen to display in connect monitor *!/
private createCharts() {
this.createChartUrlMap();
/!* 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));
}
}
/!* add the entity's charts to the charts map *!/
this.charts.set(entity, chartsMap);
/!* add the entity in the available entities for the current community *!/
this.entitiesForCommunity.push(entity);
}
}
this.onChangeEntity(this.entitiesForCommunity[0]);
}*/
initializeDisplayedCharts(mode: string) {
initializeDisplayedCharts() {
let firstEntity: string;
console.log(`my current mode is: ${this.currentMode}`);
for (let entity of this.entitiesList) {
if (this.statisticsDisplay.entities[entity]) {
this.allowedEntities.push(entity);
this.allowedCharts[entity] = [];
for (let chart of this.chartCatsList){
if (this.statisticsDisplay.entities[entity].charts.map[chart] &&
this.statisticsDisplay.entities[entity].charts.map[chart][mode] &&
if (this.statisticsSum[entity].total &&
this.statisticsDisplay.entities[entity].charts.map[chart] &&
this.statisticsDisplay.entities[entity].charts.map[chart][this.currentMode] &&
this.chartsUrlMap[entity + this.getCamelCaseString(chart)]) {
this.allowedCharts.push(entity + this.getCamelCaseString(chart));
this.allowedCharts[entity].push(entity + this.getCamelCaseString(chart));
}
}
if (!firstEntity){
@ -207,20 +172,20 @@ export class StatisticsComponent {
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%`),
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=70%`),
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"}`),
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=70%`),
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":["datasets"],"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%`),
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%`),
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":["Datasets"],"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"}`),
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=70%`),
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"}&w=70%&h=90%`),
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%')
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":["Software"],"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%')
};
}
@ -228,13 +193,14 @@ export class StatisticsComponent {
onChangeEntity (entity: string) {
this.displayedTimeline = `${entity}Timeline`;
this.displayedTimelineUrl = this.chartsUrlMap[this.displayedTimeline];
console.log(`displayed Timeline is: ${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}`);
let firstProjectChart = this.allowedCharts[entity].filter( x => x.includes(entity+'Project') );
this.changeDisplayedProjectChart(firstProjectChart.shift());
this.displayedEntity = entity;
console.log(`displayed entity is ${entity}`);
}
changeDisplayedProjectChart(chartName: string) {
@ -244,3 +210,16 @@ export class StatisticsComponent {
}
}
@Component({
selector: 'statistics-for-dashboard',
templateUrl: 'statistics-for-dashboard.component.html',
})
export class StatisticsForDashboardComponent extends StatisticsComponent {
ngOnInit() {
super.ngOnInit();
}
}

View File

@ -6,7 +6,7 @@ import {RouterModule} from '@angular/router';
import {StatisticsRoutingModule} from './statistics-routing.module';
import {IFrameModule} from '../openaireLibrary/utils/iframe.module';
import {StatisticsComponent} from './statistics.component';
import {StatisticsComponent, StatisticsForDashboardComponent} from './statistics.component';
import {StatisticsService} from '../utils/services/statistics.service';
import {CommunityService} from '../openaireLibrary/connect/community/community.service';
@ -24,14 +24,15 @@ import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previo
StatisticsRoutingModule, IFrameModule
],
declarations: [
StatisticsComponent
StatisticsComponent,
StatisticsForDashboardComponent
],
providers:[
FreeGuard, PreviousRouteRecorder, ConfigurationService, Meta,
PiwikService, CommunityService, CommunitiesService, StatisticsService, TitleCasePipe
],
exports: [
StatisticsComponent
StatisticsForDashboardComponent
]
})
export class StatisticsModule { }

View File

@ -47,6 +47,7 @@ export class StatisticsNumbers {
embargo: number;
restricted: number;
closed_access: number;
projects: number;
}
export class StatisticsSummary {

View File

@ -4,7 +4,7 @@
"useCache" : true,
"metricsAPIURL" : "https://beta.services.openaire.eu/usagestats/",
"framesAPIURL" : "https://beta.openaire.eu/stats3/",
"statisticsAPIURL" : "http://vatopedi.di.uoa.gr:8080/stats-api/",
"statisticsAPIURL" : "https://beta.services.openaire.eu/stats-api/",
"statisticsFrameAPIURL":"https://beta.openaire.eu/stats/",
"claimsAPIURL" : "http://scoobydoo.di.uoa.gr:8080/dnet-claims-service-2.0.0-SNAPSHOT/rest/claimsService/",