+
diff --git a/src/app/community/community.component.html b/src/app/community/community.component.html
index f178506..c959012 100644
--- a/src/app/community/community.component.html
+++ b/src/app/community/community.component.html
@@ -90,7 +90,7 @@
-
+
diff --git a/src/app/statistics/statistics-routing.module.ts b/src/app/statistics/statistics-routing.module.ts
new file mode 100644
index 0000000..36eb84a
--- /dev/null
+++ b/src/app/statistics/statistics-routing.module.ts
@@ -0,0 +1,16 @@
+import { NgModule } from '@angular/core';
+import { RouterModule } from '@angular/router';
+
+import{StatisticsComponent} from './statistics.component';
+import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
+import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
+
+@NgModule({
+ imports: [
+ RouterModule.forChild([
+ { path: '', component: StatisticsComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
+
+ ])
+ ]
+})
+export class StatisticsRoutingModule { }
diff --git a/src/app/statistics/statistics.component.html b/src/app/statistics/statistics.component.html
new file mode 100644
index 0000000..8857c6e
--- /dev/null
+++ b/src/app/statistics/statistics.component.html
@@ -0,0 +1,135 @@
+
+
+
+
+
+
+
+
+ {{statistics.publications}} publications from
+
+ {{statistics.total_projects}} projects.
+
+
+ {{statistics.open_access}} are OA 0">, {{statistics.restricted}} are restricted
+ 0">and {{statistics.embargo}} are still in embargo
+
+
+
+
Timelines of research results
+
+
+
+ -
+
0">
+
+
+
+ No publications available
+
+
+ -
+
0">
+
+
+
+ No research data available
+
+
+ -
+
0">
+
+
+
+ No software available
+
+
+
+
+
+ 0">
+
Publications per projects
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+
+
+ 0">
+
Research data per projects
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+
+
+ 0">
+
Software per projects
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/statistics/statistics.component.ts b/src/app/statistics/statistics.component.ts
new file mode 100644
index 0000000..c584a00
--- /dev/null
+++ b/src/app/statistics/statistics.component.ts
@@ -0,0 +1,140 @@
+
+import {Component} from '@angular/core';
+import {Observable} from 'rxjs/Observable';
+import {ActivatedRoute, Router} from '@angular/router';
+import {Location} from '@angular/common';
+import "rxjs/add/observable/zip";
+import { EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
+import { ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
+
+import {Properties} from '../utils/properties';
+import {CommunityService} from "../community/community.service";
+import {CommunitiesService} from "../communities/communities.service";
+import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
+import {Meta} from '../openaireLibrary/sharedComponents/metaService';
+import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
+import{ StatisticsService} from '../utils/services/statistics.service';
+
+@Component({
+ selector: 'statistics',
+ templateUrl: 'statistics.component.html',
+})
+export class StatisticsComponent {
+ public piwiksub: any;
+ public subfunders: any;
+
+ public pageTitle = "OpenAIRE"
+
+ properties:EnvProperties;
+ public communityId = null;
+ public communityInfo = null;
+ public statistics = null;
+ charts = null;
+ constructor (
+ private route: ActivatedRoute,
+ private _router: Router,
+ private location: Location, private _meta: Meta, private _piwikService:PiwikService,
+ private config: ConfigurationService,
+ private _communityService:CommunityService, private _communitiesService:CommunitiesService, private _statisticsService: StatisticsService
+ ) {
+
+ var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ";
+
+ var title = "OpenAIRE";
+
+ this._meta.setTitle(title);
+ this._meta.updateMeta("description", description);
+ this._meta.updateProperty("og:description", description);
+ this._meta.updateProperty("og:title", title);
+ console.log("Heree " +document.location.hostname);
+
+
+ }
+
+ public ngOnInit() {
+ this.route.data
+ .subscribe((data: { envSpecific: EnvProperties }) => {
+ this.properties = data.envSpecific;
+ var url = data.envSpecific.baseLink+this._router.url
+ this._meta.updateProperty("og:url", url);
+ if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
+ this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE").subscribe();
+ }
+
+ });
+
+
+ this.route.queryParams.subscribe(
+ communityId => {
+ this.communityId = communityId['communityId'];
+ this._statisticsService.getCommunityStatistics("http://vatopedi.di.uoa.gr:8080/stats/communities/",this.communityId).subscribe (
+ res => {
+ this.statistics = res;
+ console.log(this.statistics);
+ });
+ this.createCharts();
+ });
+ this._communityService.getCommunity('https://dev-openaire.d4science.org/openaire/community/'+this.communityId).subscribe (
+ communityInfo => {
+ this.communityInfo = communityInfo;
+ console.log(communityInfo);
+ });
+
+
+ }
+
+
+ public ngOnDestroy() {
+ if(this.piwiksub){
+ this.piwiksub.unsubscribe();
+ }
+
+ }
+ private createCharts(){
+ this.charts = {
+ timelines: {
+ publications:
+ {url:'https://beta.openaire.eu/stats/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":"Publications through the years","subtitle":"","xaxistitle":"Year"}&w=90%&h=83%',
+ load:true},
+ datasets:
+ {url:'https://beta.openaire.eu/stats/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:'https://beta.openaire.eu/stats/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:'https://beta.openaire.eu/stats/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":"Publications per project","subtitle":"","xaxistitle":"Project"}&w=90%&h=83%',
+ load:true},
+ pie:
+ {url:'https://beta.openaire.eu/stats/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":"Publications per project","subtitle":"","xaxistitle":"Project"}&w=90%&h=83%',
+ display:false},
+ table:{url:'https://beta.openaire.eu/stats/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":"Publications per project","subtitle":"","xaxistitle":"Project"}&w=90%&h=83%',
+ load:false}
+ },
+ projectDatasets: {
+ columns:
+ {url:'https://beta.openaire.eu/stats/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":"Research Data per project","subtitle":"","xaxistitle":"Project"}&w=90%&h=83%',
+ load:true},
+ pie:
+ {url:'https://beta.openaire.eu/stats/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":"Research Data project","subtitle":"","xaxistitle":"Project"}&w=90%&h=83%',
+ load:false},
+ table:{url:'https://beta.openaire.eu/stats/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":"Research Data per project","subtitle":"","xaxistitle":"Project"}&w=90%&h=83%',
+ load:false}
+ },
+ projectSoftware: {
+ columns:
+ {url:'https://beta.openaire.eu/stats/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":"Software per project","subtitle":"","xaxistitle":"Project"}&w=90%&h=83%',
+ load:true},
+ pie:
+ {url:'https://beta.openaire.eu/stats/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":"Software per project","subtitle":"","xaxistitle":"Project"}&w=90%&h=83%',
+ load:false},
+ table:{url:'https://beta.openaire.eu/stats/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":"Software per project","subtitle":"","xaxistitle":"Project"}&w=90%&h=83%',
+ load:false}
+ }
+
+
+ }
+ }
+
+}
diff --git a/src/app/statistics/statistics.module.ts b/src/app/statistics/statistics.module.ts
new file mode 100644
index 0000000..7e0c78e
--- /dev/null
+++ b/src/app/statistics/statistics.module.ts
@@ -0,0 +1,36 @@
+import { NgModule} from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+import { RouterModule } from '@angular/router';
+
+import{StatisticsRoutingModule} from './statistics-routing.module';
+import{StatisticsComponent} from './statistics.component';
+import { StatisticsService } from '../utils/services/statistics.service';
+import { CommunityService } from '../community/community.service';
+import { CommunitiesService } from '../communities/communities.service';
+import {IFrameModule} from '../openaireLibrary/utils/iframe.module';
+
+
+import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
+import {Meta} from '../openaireLibrary/sharedComponents/metaService';
+import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
+
+import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
+import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
+
+@NgModule({
+ imports: [
+ CommonModule, FormsModule, RouterModule,
+ StatisticsRoutingModule, IFrameModule
+ ],
+ declarations: [
+ StatisticsComponent
+ ],
+ providers:[
+ FreeGuard, PreviousRouteRecorder, ConfigurationService, Meta, PiwikService, CommunityService, CommunitiesService, StatisticsService
+ ],
+ exports: [
+ StatisticsComponent
+ ]
+})
+export class StatisticsModule { }
diff --git a/src/app/utils/services/statistics.service.ts b/src/app/utils/services/statistics.service.ts
new file mode 100644
index 0000000..411ea79
--- /dev/null
+++ b/src/app/utils/services/statistics.service.ts
@@ -0,0 +1,21 @@
+import { Injectable } from '@angular/core';
+import { Http, Response, Headers, RequestOptions } from '@angular/http';
+import { Observable } from 'rxjs/Rx';
+
+
+@Injectable()
+export class StatisticsService {
+
+
+ constructor(private http:Http) {
+ }
+
+ getCommunityStatistics(url: string, community) {
+ return this.http.get(url+community)
+ .map(res =>
res.json()).do(res => {console.log(res)}).map(res => res.statistics).do(res => {console.log(res)});
+ }
+
+
+
+
+}