update method extractOldToolYTitle: add check if fieldsheaders is array

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@57773 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Argiro Kokogiannaki 2019-11-29 14:58:52 +00:00
parent 390a205580
commit f9cf6c3d24
5 changed files with 23 additions and 9 deletions

View File

@ -14,7 +14,7 @@
</a>
<div class="uk-margin-large-left uk-width-medium ng-star-inserted">
<div class="">
<form class="uk-search uk-search-default uk-width-1-1 ">
<!-- <form class="uk-search uk-search-default uk-width-1-1 ">
<a
class="uk-search-icon-flip uk-icon uk-search-icon" routerlinkactive="uk-link" uk-search-icon=""
>
@ -24,7 +24,8 @@
<path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path>
</svg>
</a><input aria-describedby="sizing-addon2" class="uk-search-input "
name="keyword" type="search" placeholder="Search for..."></form>
name="keyword" type="search" placeholder="Search for..."></form>-->
<div dashboard-input label="Search for..." [formInput]="keyword"></div>
</div>
</div>
</div>
@ -90,7 +91,7 @@
<button class="uk-button uk-button-primary" (click)="setIndicators()">Apply</button>
</div>-->
<h4 class="uk-margin uk-margin-top uk-text-bold">Indicators</h4>
<div class="uk-grid uk-grid-medium uk-margin-bottom" uk-height-match="target: div > h6">
<div class="uk-grid uk-grid-medium uk-margin-bottom" uk-height-match="target: div.md-card">
<ng-template ngFor [ngForOf]="activeSubCategory.numbers" let-number let-i="index">
<div *ngIf="number.isActive && number.isPublic"
[class.uk-width-1-3@m]="number.width === 'small'"
@ -99,7 +100,7 @@
<div class="md-card"
[attr.uk-tooltip]="number.description">
<div class="md-card-content">
<span class="uk-text-muted uk-margin-bottom">{{number.name}}</span>
<span class="uk-text-muted uk-margin-bottom uk-h5">{{number.name}}</span>
<h2 *ngIf="numberResults.get(i)" class="uk-margin-remove">
<span>{{numberResults.get(i) | number}}</span>
</h2>

View File

@ -17,6 +17,7 @@ import {Item, Sidebar} from "../utils/entities/sidebar";
import {IndicatorUtils, StakeholderUtils} from "../utils/indicator-utils";
import {StakeholderCreator} from "../utils/entities/stakeholderCreator";
import {LayoutService} from "../library/sharedComponents/sidebar/layout.service";
import {FormBuilder, FormControl} from "@angular/forms";
@Component({
selector: 'monitor',
@ -44,6 +45,8 @@ export class MonitorComponent implements OnInit, OnDestroy {
startYear;
endYear;
public keyword:FormControl;
constructor(
private route: ActivatedRoute,
private _router: Router,
@ -56,13 +59,18 @@ export class MonitorComponent implements OnInit, OnDestroy {
private layoutService: LayoutService,
private seoService: SEOService,
private cdr: ChangeDetectorRef,
private sanitizer: DomSanitizer) {
private sanitizer: DomSanitizer, private _fb: FormBuilder) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.status = this.errorCodes.LOADING;
}
public ngOnInit() {
this.keyword = this._fb.control('');
this.keyword.valueChanges.subscribe(value=>{
console.log("KEyword Changed!");
//TODO do a real action
});
this.layoutService.setHasSidebar(false);
this.layoutService.setHasHeader(false);
this.route.data

View File

@ -16,11 +16,12 @@ import {MonitorComponent} from "./monitor.component";
import {StatisticsService} from "../utils/services/statistics.service";
import {SideBarModule} from "../library/sharedComponents/sidebar/sideBar.module";
import {ModalModule} from "../openaireLibrary/utils/modal/modal.module";
import {InputModule} from "../library/sharedComponents/input/input.module";
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule, ErrorMessagesModule,
HelperModule, Schema2jsonldModule, SEOServiceModule, MonitorRoutingModule, SideBarModule, ModalModule
HelperModule, Schema2jsonldModule, SEOServiceModule, MonitorRoutingModule, SideBarModule, ModalModule, InputModule
],
declarations: [
MonitorComponent

View File

@ -275,7 +275,7 @@ export class Stakeholder {
defSub.charts.push(chart2);
let utils = new IndicatorUtils();
let url = "https://beta.openaire.eu/stats/chart.php?com=query&data={%22table%22:%22result%22,%22fields%22:[{%22fld%22:%22number%22,%22agg%22:%22count%22,%22type%22:%22bar%22,%22yaxis%22:1,%22c%22:false}],%22xaxis%22:{%22name%22:%22result_datasources-datasource-name%22,%22agg%22:%22avg%22},%22group%22:%22%22,%22color%22:%22%22,%22type%22:%22chart%22,%22size%22:%2220%22,%22sort%22:%22count-number%22,%22yaxisheaders%22:[%22%22],%22fieldsheaders%22:[%22publications%22],%22in%22:[],%22filters%22:[{%22name%22:%22result_projects-project-funding_lvl0%22,%22values%22:[%22H2020%22],%22to%22:%22-1%22},{%22name%22:%22type%22,%22values%22:[%22publication%22],%22to%22:%22-1%22},{%22name%22:%22result_datasources-datasource-type%22,%22exvalues%22:[%22Publication%20Catalogue%22]}],%22having%22:[],%22xStyle%22:{%22r%22:%22-%22,%22s%22:%22-%22,%22l%22:%22-%22,%22ft%22:%22-%22,%22wt%22:%22-%22},%22title%22:%22H2020%20Publications%20by%20datasource%20%28top%2020%29%22,%22subtitle%22:%22%22,%22xaxistitle%22:%22datasource%22,%22order%22:%22d%22}&w=90%";
// defSub.charts.push(new Indicator("Old tool graph", "", "chart", "large", true, true, [utils.generateIndicatorByChartUrl("old", url, "bar")]))
defSub.charts.push(new Indicator("Old tool graph", "", "chart", "large", true, true, [utils.generateIndicatorByChartUrl("old", url, "bar")]))
url = "http://88.197.53.71:8080/stats-api/chart?json=%7B%22library%22%3A%22HighCharts%22%2C%22chartDescription%22%3A%7B%22queries%22%3A%5B%7B%22name%22%3A%22Research%20data%22%2C%22type%22%3A%22column%22%2C%22query%22%3A%7B%22select%22%3A%5B%7B%22field%22%3A%22dataset%22%2C%22aggregate%22%3A%22count%22%7D%2C%7B%22field%22%3A%22dataset.year%22%2C%22aggregate%22%3Anull%7D%5D%2C%22filters%22%3A%5B%7B%22groupFilters%22%3A%5B%7B%22field%22%3A%22dataset.project.funder%22%2C%22type%22%3A%22%3D%22%2C%22values%22%3A%5B%22European%20Commission%22%5D%7D%5D%2C%22op%22%3A%22AND%22%7D%2C%7B%22groupFilters%22%3A%5B%7B%22field%22%3A%22dataset.year%22%2C%22type%22%3A%22%3E%3D%22%2C%22values%22%3A%5B%222008%22%5D%7D%2C%7B%22field%22%3A%22dataset.year%22%2C%22type%22%3A%22%3C%3D%22%2C%22values%22%3A%5B%222020%22%5D%7D%5D%2C%22op%22%3A%22AND%22%7D%5D%2C%22entity%22%3A%22dataset%22%2C%22profile%22%3A%22OpenAIRE%20All-inclusive%22%2C%22limit%22%3A%220%22%7D%7D%5D%2C%22chart%22%3A%7B%22backgroundColor%22%3A%22%23FFFFFFFF%22%2C%22borderColor%22%3A%22%23335cadff%22%2C%22borderRadius%22%3A0%2C%22borderWidth%22%3A0%2C%22plotBorderColor%22%3A%22%23ccccccff%22%2C%22plotBorderWidth%22%3A0%7D%2C%22title%22%3A%7B%22text%22%3A%22Research%20data%20timeline%22%7D%2C%22subtitle%22%3A%7B%7D%2C%22yAxis%22%3A%7B%22title%22%3A%7B%22text%22%3A%22Research%20data%22%7D%7D%2C%22xAxis%22%3A%7B%22title%22%3A%7B%22text%22%3A%22Year%22%7D%7D%2C%22lang%22%3A%7B%22noData%22%3A%22No%20Data%20available%20for%20the%20Query%22%7D%2C%22exporting%22%3A%7B%22enabled%22%3Atrue%7D%2C%22plotOptions%22%3A%7B%22series%22%3A%7B%22dataLabels%22%3A%7B%22enabled%22%3Afalse%7D%7D%7D%2C%22legend%22%3A%7B%22enabled%22%3Atrue%2C%22align%22%3A%22center%22%2C%22verticalAlign%22%3A%22bottom%22%2C%22layout%22%3A%22horizontal%22%7D%2C%22credits%22%3A%7B%22href%22%3Anull%2C%22enabled%22%3Atrue%2C%22text%22%3A%22Created%20by%20OpenAIRE%20via%20HighCharts%22%7D%7D%7D";
defSub.charts.push(new Indicator("", "", "chart", "large", true, true, [utils.generateIndicatorByChartUrl("stats-tool", url, "bar")]))
return topic;

View File

@ -346,8 +346,12 @@ export class IndicatorUtils {
private extractOldToolYTitle(obj, indicatorPath: IndicatorPath) {
let title = "";
if (obj["fieldsheaders"]) {
title = obj["fieldsheaders"];
title = Array.isArray(obj["fieldsheaders"])?obj["fieldsheaders"][0]:obj["fieldsheaders"];
if(Array.isArray(obj["fieldsheaders"])){
obj["fieldsheaders"][0] = ChartHelper.prefix + "yAxisTitle" + ChartHelper.suffix;
}else {
obj["fieldsheaders"] = ChartHelper.prefix + "yAxisTitle" + ChartHelper.suffix;
}
indicatorPath.parameters["yAxisTitle"] = title;
}
}