[Monitor-Dashboard|Trunk]
add more charts about Open science. Get full url: replace parameters more than once add subtitle in indicator parameters/form git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@57821 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
e852d4302c
commit
529c9ce933
|
@ -243,6 +243,11 @@
|
||||||
[formInput]="getParameter(i, 'title').get('value')"
|
[formInput]="getParameter(i, 'title').get('value')"
|
||||||
label="Chart Title"></div>
|
label="Chart Title"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div *ngIf="getParameter(i, 'subtitle')" class="uk-form-row">
|
||||||
|
<div dashboard-input
|
||||||
|
[formInput]="getParameter(i, 'subtitle').get('value')"
|
||||||
|
label="Chart Subtitle"></div>
|
||||||
|
</div>
|
||||||
<div class="uk-grid-medium uk-form-row" uk-grid>
|
<div class="uk-grid-medium uk-form-row" uk-grid>
|
||||||
<div *ngIf="getParameter(i, 'type')" class="uk-width-1-3@s">
|
<div *ngIf="getParameter(i, 'type')" class="uk-width-1-3@s">
|
||||||
<div dashboard-input [formInput]="getParameter(i, 'type').get('value')"
|
<div dashboard-input [formInput]="getParameter(i, 'type').get('value')"
|
||||||
|
|
|
@ -285,7 +285,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
this.addUrl();
|
this.addUrl();
|
||||||
this.editIndicatorModal.alertTitle = 'Create a new chart Indicator';
|
this.editIndicatorModal.alertTitle = 'Create a new chart Indicator';
|
||||||
this.editIndicatorModal.cancelButtonText = 'Cancel';
|
this.editIndicatorModal.cancelButtonText = 'Cancel';
|
||||||
this.editIndicatorModal.okButtonText = 'Create';
|
this.editIndicatorModal.okButtonText = 'Next';
|
||||||
this.editIndicatorModal.okButtonLeft = false;
|
this.editIndicatorModal.okButtonLeft = false;
|
||||||
this.editIndicatorModal.alertMessage = false;
|
this.editIndicatorModal.alertMessage = false;
|
||||||
this.editIndicatorModal.stayOpen = true;
|
this.editIndicatorModal.stayOpen = true;
|
||||||
|
@ -318,6 +318,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
this.indicator.indicatorPaths.forEach(indicatorPath => {
|
this.indicator.indicatorPaths.forEach(indicatorPath => {
|
||||||
let parameters = this.fb.array([]);
|
let parameters = this.fb.array([]);
|
||||||
if (indicatorPath.parameters) {
|
if (indicatorPath.parameters) {
|
||||||
|
console.info(indicatorPath.parameters);
|
||||||
Object.keys(indicatorPath.parameters).forEach(key => {
|
Object.keys(indicatorPath.parameters).forEach(key => {
|
||||||
if (this.indicatorUtils.ignoredParameters.indexOf(key) === -1) {
|
if (this.indicatorUtils.ignoredParameters.indexOf(key) === -1) {
|
||||||
if (this.indicatorUtils.parametersValidators.has(key)) {
|
if (this.indicatorUtils.parametersValidators.has(key)) {
|
||||||
|
@ -328,7 +329,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
} else {
|
} else {
|
||||||
parameters.push(this.fb.group({
|
parameters.push(this.fb.group({
|
||||||
key: this.fb.control(key),
|
key: this.fb.control(key),
|
||||||
value: this.fb.control(indicatorPath.parameters[key], Validators.required)
|
value: this.fb.control(indicatorPath.parameters[key])
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import {Stakeholder,Topic,Category,SubCategory,Indicator, IndicatorPath, ChartHelper} from "./stakeholder";
|
import {Stakeholder,Topic,Category,SubCategory,Indicator, IndicatorPath, ChartHelper} from "./stakeholder";
|
||||||
|
import {IndicatorUtils} from "../indicator-utils";
|
||||||
|
|
||||||
export class StakeholderCreator {
|
export class StakeholderCreator {
|
||||||
|
|
||||||
|
@ -189,8 +190,48 @@ export class StakeholderCreator {
|
||||||
}
|
}
|
||||||
static createOASub(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural ):SubCategory {
|
static createOASub(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural ):SubCategory {
|
||||||
let sub:SubCategory = new SubCategory(typePlural, null, dbTypePlural, true, true);
|
let sub:SubCategory = new SubCategory(typePlural, null, dbTypePlural, true, true);
|
||||||
|
// sub.charts = sub.charts.concat( this.createOAPerType(stakeholder,typePlural, typeSingl, dbType, dbTypePlural, 0 ));
|
||||||
|
// sub.charts = sub.charts.concat( this.createOAPerType(stakeholder,typePlural, typeSingl, dbType, dbTypePlural, 1 ));
|
||||||
|
// sub.charts = sub.charts.concat( this.createOAPerType(stakeholder,typePlural, typeSingl, dbType, dbTypePlural, 2 ));
|
||||||
return sub;
|
return sub;
|
||||||
}
|
}
|
||||||
|
static createOAPerType(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural, index:number):Indicator[] {
|
||||||
|
|
||||||
|
let fundingFilter = ['', ',{"groupFilters":[{"field":"' + dbType + '.project.funding level 0","type":"=","values":["FP7"]}],"op":"AND"}',
|
||||||
|
',{"groupFilters":[{"field":"' + dbType + '.project.funding level 0","type":"=","values":["H2020"]}],"op":"AND"}'];
|
||||||
|
let categoryTitle = ["Overview", "FP7", "H2020"];
|
||||||
|
let chartTitle = ["", "FP7 ", "H2020 "];
|
||||||
|
let indicators:Indicator[]=[];
|
||||||
|
let utils = new IndicatorUtils();
|
||||||
|
|
||||||
|
let open_non_url = "http://88.197.53.71:8080/stats-api/chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Data","type":"pie","color":"#e62020ee","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix +(index==2?".h2020":(index==1?".fp7":""))+ '.' + dbTypePlural+'.oavsnonoa"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"'+chartTitle[index]+' Open Access vs Non Open Access"},"subtitle":{},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
|
||||||
|
encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Data","type":"pie","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix +(index==2?".h2020":(index==1?".fp7":""))+ '.' + dbTypePlural+'.greenvsgold"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{},"subtitle":{},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
|
||||||
|
let open_non_ind:Indicator = new Indicator(categoryTitle[index], "", "column", "small", true, true, [utils.generateIndicatorByChartUrl("stats-tool", open_non_url, "pie")])
|
||||||
|
open_non_ind.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
|
||||||
|
indicators.push(open_non_ind);
|
||||||
|
|
||||||
|
let gold_vs_green_url = "http://88.197.53.71:8080/stats-api/chart?json="+ encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Data","type":"pie","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix +(index==2?".h2020":(index==1?".fp7":""))+ '.' + dbTypePlural+'.greenvsgold"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{},"subtitle":{},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
|
||||||
|
let gold_vs_green_ind:Indicator = (new Indicator("", "", "column", "small", true, true, [utils.generateIndicatorByChartUrl("stats-tool", gold_vs_green_url, "pie")]));
|
||||||
|
gold_vs_green_ind.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
|
||||||
|
indicators.push(gold_vs_green_ind);
|
||||||
|
|
||||||
|
let gold_vs_green_time_url = "http://88.197.53.71:8080/stats-api/chart?json="+ encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Gold OA","type":"column","color":"#F8B500","query":{"name":"monitor.'+ ChartHelper.prefix + 'id' + ChartHelper.suffix +(index==2?".h2020":(index==1?".fp7":""))+ '.' + dbTypePlural+'.gold.year"}},{"name":"Green OA","type":"column","color":"#239D60","query":{"name":"monitor.'+ ChartHelper.prefix + 'id' + ChartHelper.suffix +(index==2?".h2020":(index==1?".fp7":""))+ '.' + dbTypePlural+'.green.year"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Green vs Gold Open Access"},"subtitle":{"text":"by year"},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
|
||||||
|
let gold_vs_green_time_ind:Indicator = (new Indicator("", "", "column", "small", true, true, [utils.generateIndicatorByChartUrl("stats-tool", gold_vs_green_time_url, "column")]));
|
||||||
|
gold_vs_green_time_ind.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
|
||||||
|
indicators.push(gold_vs_green_time_ind);
|
||||||
|
|
||||||
|
let top_project_url = "http://88.197.53.71:8080/stats-api/chart?json="+ encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Data","type":"bar","query":{"name":"monitor.'+ ChartHelper.prefix + 'id' + ChartHelper.suffix +(index==2?".h2020":(index==1?".fp7":""))+ '.' + dbTypePlural+'.top10projects"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Top 15 projects"},"subtitle":{"text":"by publications"},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
|
||||||
|
let top_project_ind:Indicator = (new Indicator("", "", "column", "medium", true, true, [utils.generateIndicatorByChartUrl("stats-tool", top_project_url, "column")]));
|
||||||
|
top_project_ind.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
|
||||||
|
indicators.push(top_project_ind);
|
||||||
|
if(index == 0) {
|
||||||
|
let top_datasources_url = "http://88.197.53.71:8080/stats-api/chart?json=" + encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Data","type":"bar","color":"#e62020ee","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix + '.' + dbTypePlural + '.top10datasources"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Top 10 Datasources"},"subtitle":{},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
|
||||||
|
let top_datasources_ind: Indicator = (new Indicator("By Content Providers", "", "column", "large", true, true, [utils.generateIndicatorByChartUrl("stats-tool", top_datasources_url, "column")]));
|
||||||
|
top_datasources_ind.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
|
||||||
|
indicators.push(top_datasources_ind);
|
||||||
|
}
|
||||||
|
return indicators;
|
||||||
|
}
|
||||||
static createOSTopic(stakeholder:Stakeholder):Topic{
|
static createOSTopic(stakeholder:Stakeholder):Topic{
|
||||||
let topic = new Topic("Open Science","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","open-science",true,true);
|
let topic = new Topic("Open Science","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","open-science",true,true);
|
||||||
topic.categories.push(this.createOpenAccessTopic(stakeholder));
|
topic.categories.push(this.createOpenAccessTopic(stakeholder));
|
||||||
|
|
|
@ -148,9 +148,10 @@ export class IndicatorUtils {
|
||||||
if (endDate && key == "end_year" && indicatorPath.filters["end_year"]) {
|
if (endDate && key == "end_year" && indicatorPath.filters["end_year"]) {
|
||||||
replacedValue = (replacedValue > endDate) ? endDate : replacedValue;
|
replacedValue = (replacedValue > endDate) ? endDate : replacedValue;
|
||||||
}
|
}
|
||||||
replacedUrl = replacedUrl.replace(ChartHelper.prefix + key + ChartHelper.suffix, replacedValue);
|
replacedUrl = replacedUrl.split(ChartHelper.prefix + key + ChartHelper.suffix).join(replacedValue)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
console.info("replacedUrl:"+replacedUrl)
|
||||||
if (indicatorPath.chartObject) {
|
if (indicatorPath.chartObject) {
|
||||||
if (fundingL0 && indicatorPath.filters["fundingL0"]) {
|
if (fundingL0 && indicatorPath.filters["fundingL0"]) {
|
||||||
let newJsonObject = JSON.parse(replacedUrl);
|
let newJsonObject = JSON.parse(replacedUrl);
|
||||||
|
@ -191,6 +192,7 @@ export class IndicatorUtils {
|
||||||
let chart = JSON.parse(indicatorPath.chartObject);
|
let chart = JSON.parse(indicatorPath.chartObject);
|
||||||
indicatorPath.type = this.extractType(chart, indicatorPath);
|
indicatorPath.type = this.extractType(chart, indicatorPath);
|
||||||
this.extractTitle(chart, indicatorPath);
|
this.extractTitle(chart, indicatorPath);
|
||||||
|
this.extractSubTitle(chart,indicatorPath);
|
||||||
this.extractXTitle(chart, indicatorPath);
|
this.extractXTitle(chart, indicatorPath);
|
||||||
this.extractYTitle(chart, indicatorPath);
|
this.extractYTitle(chart, indicatorPath);
|
||||||
this.extractFunder(chart, indicatorPath);
|
this.extractFunder(chart, indicatorPath);
|
||||||
|
@ -283,17 +285,25 @@ export class IndicatorUtils {
|
||||||
if (obj["chartDescription"]["title"]) {
|
if (obj["chartDescription"]["title"]) {
|
||||||
title = obj["chartDescription"]["title"]["text"];
|
title = obj["chartDescription"]["title"]["text"];
|
||||||
obj["chartDescription"]["title"]["text"] = ChartHelper.prefix + "title" + ChartHelper.suffix;
|
obj["chartDescription"]["title"]["text"] = ChartHelper.prefix + "title" + ChartHelper.suffix;
|
||||||
indicatorPath.parameters["title"] = title;
|
indicatorPath.parameters["title"] = title?title:"";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private extractSubTitle(obj, indicatorPath: IndicatorPath) {
|
||||||
|
let subtitle = "";
|
||||||
|
if (obj["chartDescription"]["subtitle"]) {
|
||||||
|
subtitle = obj["chartDescription"]["subtitle"]["text"];
|
||||||
|
obj["chartDescription"]["subtitle"]["text"]= ChartHelper.prefix + "subtitle" + ChartHelper.suffix;
|
||||||
|
indicatorPath.parameters["subtitle"] = subtitle?subtitle:"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private extractXTitle(obj, indicatorPath: IndicatorPath) {
|
private extractXTitle(obj, indicatorPath: IndicatorPath) {
|
||||||
let title = "";
|
let title = "";
|
||||||
if (obj["chartDescription"]["xAxis"]["title"]) {
|
if (obj["chartDescription"]["xAxis"]["title"]) {
|
||||||
title = obj["chartDescription"]["xAxis"]["title"]["text"];
|
title = obj["chartDescription"]["xAxis"]["title"]["text"];
|
||||||
obj["chartDescription"]["xAxis"]["title"]["text"] = ChartHelper.prefix + "xAxisTitle" + ChartHelper.suffix;
|
obj["chartDescription"]["xAxis"]["title"]["text"] = ChartHelper.prefix + "xAxisTitle" + ChartHelper.suffix;
|
||||||
indicatorPath.parameters["xAxisTitle"] = title;
|
indicatorPath.parameters["xAxisTitle"] = title?title:""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,7 +312,7 @@ export class IndicatorUtils {
|
||||||
if (obj["chartDescription"]["yAxis"]["title"]) {
|
if (obj["chartDescription"]["yAxis"]["title"]) {
|
||||||
title = obj["chartDescription"]["yAxis"]["title"]["text"];
|
title = obj["chartDescription"]["yAxis"]["title"]["text"];
|
||||||
obj["chartDescription"]["yAxis"]["title"]["text"] = ChartHelper.prefix + "yAxisTitle" + ChartHelper.suffix;
|
obj["chartDescription"]["yAxis"]["title"]["text"] = ChartHelper.prefix + "yAxisTitle" + ChartHelper.suffix;
|
||||||
indicatorPath.parameters["yAxisTitle"] = title;
|
indicatorPath.parameters["yAxisTitle"] = title?title:""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue