Project

General

Profile

1
import {
2
  ChartHelper,
3
  Indicator,
4
  IndicatorPath, IndicatorPathType,
5
  SourceType,
6
  Stakeholder,
7
  SubCategory,
8
  Topic
9
} from "./entities/stakeholder";
10
import {AbstractControl, ValidatorFn, Validators} from "@angular/forms";
11
import {Option} from "../openaireLibrary/dashboard/sharedComponents/input/input.component";
12

    
13
export class StakeholderUtils {
14
  defaultProfiles = {"funder":{
15
      index_id:"ec__________::EC",
16
  index_name:     "European Commission", index_shortName:"EC"}};
17
  types: Option[] = [
18
    {value: 'funder', label: 'Funder'}
19
  ];
20

    
21
  isPublic: Option[] = [
22
    {icon: 'public', value: true, label: 'Public'},
23
    {icon: 'lock', value: false, label: 'Private'},
24
  ];
25

    
26
  isActive: Option[] = [
27
    {icon: 'brightness_1', iconClass: '', value: true, label: 'Active'},
28
    {icon: 'brightness_1', value: false, label: 'Inactive'},
29
  ];
30

    
31
  isPublicIcon: Map<boolean, string> = new Map([
32
    [true, 'public'],
33
    [false, 'lock']
34
  ]);
35

    
36
  isActiveIcon: string = 'brightness_1';
37

    
38
  public createFunderFromDefaultProfile(funder: Stakeholder, defaultTopics: Topic[]): Stakeholder {
39
    funder.topics = defaultTopics;
40
    for (let topic of funder.topics) {
41
      // console.log('id:' + topic._id);
42
      topic.defaultId = topic._id;
43
      topic._id = null;
44
      // console.log('defaultId:' + topic.defaultId);
45
      for (let category of topic.categories) {
46
        category.defaultId = category._id;
47
        category._id = null;
48
        let subTokeep: SubCategory[] = [];
49
        for (let subCategory of category.subCategories) {
50
          subCategory.defaultId = subCategory._id;
51
          subCategory._id = null;
52
          if (!subCategory.recommendedFor || subCategory.recommendedFor.length == 0 || subCategory.recommendedFor.indexOf(funder.index_id) != -1) {
53
            subTokeep.push(subCategory);
54
          }
55
          for (let section of subCategory.charts) {
56
            let chartsTokeep: Indicator[] = [];
57
            section.defaultId = section._id;
58
            section.stakeholderAlias = funder.alias;
59
            section._id = null;
60
            for (let indicator of section.indicators) {
61
              indicator.defaultId = indicator._id;
62
              indicator._id = null;
63
              if (!indicator.recommendedFor || indicator.recommendedFor.length == 0 || indicator.recommendedFor.indexOf(funder.index_id) != -1) {
64
                chartsTokeep.push(indicator);
65
              }
66
              for (let indicatorPath of indicator.indicatorPaths) {
67
                if (indicatorPath.parameters) {
68
                  Object.keys(indicatorPath.parameters).forEach(key => {
69
                    //TODO check before delete
70
                    /*if (indicatorPath.parameters[key].indexOf("_funder_name_") != -1) {
71
                      indicatorPath.parameters[key] = indicatorPath.parameters[key].replace("_funder_name_", funder.index_name);
72
                    } else if (indicatorPath.parameters[key].indexOf("_funder_id_") != -1) {
73
                      indicatorPath.parameters[key] = indicatorPath.parameters[key].replace("_funder_id_", funder.index_id);
74
                    } else if (indicatorPath.parameters[key].indexOf("_fsn_") != -1) {
75
                      indicatorPath.parameters[key] = indicatorPath.parameters[key].toString().replace("_fsn_", funder.index_shortName.toLowerCase());
76
                    }*/
77
                    if (key == "index_name") {
78
                      indicatorPath.parameters[key] = funder.index_name;
79
                    } else if (key == "index_id" ) {
80
                      indicatorPath.parameters[key] = funder.index_id;
81
                    }  else if (key == "index_shortName" ) {
82
                      indicatorPath.parameters[key] =  funder.index_shortName.toLowerCase();
83
                    }
84
                  });
85
                }
86
              }
87
            }
88
            section.indicators = chartsTokeep;
89
          }
90
          for (let section of subCategory.numbers) {
91
            section.defaultId = section._id;
92
            section.stakeholderAlias = funder.alias;
93
            section._id = null;
94
            for(let indicator of section.indicators) {
95
              indicator.defaultId = indicator._id;
96
              indicator._id = null;
97
              for (let indicatorPath of indicator.indicatorPaths) {
98
                indicatorPath.url = indicatorPath.url.replace("index_id", encodeURIComponent(funder.index_id));
99
                indicatorPath.url = indicatorPath.url.replace("index_name",  encodeURIComponent(funder.index_name));
100
                indicatorPath.url = indicatorPath.url.replace("index_shortName", encodeURIComponent(funder.index_shortName));
101
                // if(indicatorPath.parameters) {
102
                //   indicatorPath.parameters.forEach((value: string, key: string) => {
103
                //     if (value.indexOf("_funder_name_")!=-1) {
104
                //       indicatorPath.parameters.set(key,value.toString().replace("_funder_name_", funder.index_name));
105
                //     }else if (value.indexOf("_fsn_")!=-1) {
106
                //       indicatorPath.parameters.set(key,value.toString().replace("_fsn_", funder.index_shortName.toLowerCase()));
107
                //     }
108
                //   });
109
                // }
110
              }
111
            }
112
          }
113

    
114
        }
115
        category.subCategories = subTokeep;
116
      }
117
    }
118
    console.log (funder)
119
    return funder;
120
  }
121

    
122
  aliasValidator(elements: any[]): ValidatorFn {
123
    return (control: AbstractControl): { [key: string]: boolean } | null => {
124
      if (control.value && elements.find(element =>
125
        element.alias === control.value
126
      )) {
127
        return {'alias': true};
128
      }
129
      return null;
130
    }
131
  }
132

    
133
  // TODO need to be fixed
134
  generateAlias(name: string): string {
135
    let alias = name.toLowerCase();
136
    while (alias.includes(' / ') || alias.includes(' ')) {
137
      alias = alias.replace(' / ', '-');
138
      alias = alias.replace(' ', '-');
139
    }
140
    return alias;
141
  }
142
}
143

    
144
export class IndicatorUtils {
145

    
146
  chartTypes: Option[] = [
147
    {value: 'pie', label: 'Pie'},
148
    {value: 'table', label: 'Table'},
149
    {value: 'line', label: 'Line'},
150
    {value: 'column', label: 'Column'},
151
    {value: 'bar', label: 'Bar'},
152
    {value: 'other', label: 'Other'}
153
  ];
154

    
155
  chartSizes: Option[] = [
156
    {value: 'small', label: 'Small'},
157
    {value: 'medium', label: 'Medium'},
158
    {value: 'large', label: 'Large'}
159
  ];
160

    
161
  isPublic: Option[] = [
162
    {icon: 'public', value: true, label: 'Public'},
163
    {icon: 'lock', value: false, label: 'Private'},
164
  ];
165

    
166
  isActive: Option[] = [
167
    {icon: 'brightness_1', iconClass: '', value: true, label: 'Active'},
168
    {icon: 'brightness_1', value: false, label: 'Inactive'},
169
  ];
170

    
171
  chartTypesIcons: Map<string, string> = new Map([
172
    ['pie', 'pie_chart'],
173
    ['table', 'table_chart'],
174
    ['line', 'show_chart'],
175
    ['column', 'bar_chart'],
176
    ['bar', 'notes'],
177
    ['other', 'perm_media']
178
  ]);
179

    
180
  isPublicIcon: Map<boolean, string> = new Map([
181
    [true, 'public'],
182
    [false, 'lock']
183
  ]);
184

    
185
  isActiveIcon: string = 'brightness_1';
186

    
187
  ignoredParameters = ['index_name','index_id','index_shortName'];
188

    
189
  parametersValidators: Map<string, any> = new Map<string, any>([
190
    ['start_year', [Validators.required, Validators.pattern('^\\d+$')]],
191
    ['end_year', [Validators.required, Validators.pattern('^\\d+$')]]
192
  ]);
193

    
194
  public getFullUrl(indicatorPath: IndicatorPath, fundingL0: string = null, startDate: string = null, endDate: string = null): string {
195

    
196
    let replacedUrl = indicatorPath.chartObject;
197
    if (indicatorPath.parameters) {
198
      Object.keys(indicatorPath.parameters).forEach(key => {
199
        let replacedValue = indicatorPath.parameters[key];
200
        if (startDate && key == "start_year" && indicatorPath.filters["start_year"]) {
201
          replacedValue = (replacedValue < startDate) ? startDate : replacedValue;
202
        }
203
        if (endDate && key == "end_year" && indicatorPath.filters["end_year"]) {
204
          replacedValue = (replacedValue > endDate) ? endDate : replacedValue;
205
        }
206
        replacedUrl = replacedUrl.split(ChartHelper.prefix + key + ChartHelper.suffix).join(replacedValue)
207
      });
208
    }
209
    if (indicatorPath.chartObject) {
210
      if (fundingL0 && indicatorPath.filters["fundingL0"]) {
211
        let newJsonObject = JSON.parse(replacedUrl);
212
        for (let queries of newJsonObject["chartDescription"]["queries"]) {
213
          if (!queries["query"]["filters"] || queries["query"]["filters"].length == 0) {
214
            queries["query"]["filters"] = [];
215
          }
216
          //TODO check how it works if the query already has a filter
217
          queries["query"]["filters"].push(JSON.parse(indicatorPath.filters["fundingL0"].replace(ChartHelper.prefix + "fundingL0" + ChartHelper.suffix, fundingL0)));
218
        }
219
        replacedUrl = JSON.stringify(newJsonObject);
220
      }
221
    }
222
    return indicatorPath.url + encodeURIComponent(replacedUrl);
223
  }
224

    
225
  generateIndicatorByForm(form: any, indicatorPaths: IndicatorPath[]): Indicator {
226
    let indicator: Indicator = new Indicator(form.name, form.description, 'chart',
227
      form.width, form.isActive, form.isPublic, indicatorPaths);
228
    indicator._id = form.id;
229
    form.indicatorPaths.forEach((indicatorPath, index) => {
230
      indicatorPath.parameters.forEach(parameter => {
231
        indicator.indicatorPaths[index].parameters[parameter.key] = parameter.value;
232
        if (parameter.key === 'type') {
233
          indicator.indicatorPaths[index].type = parameter.value;
234
        }
235
      });
236
    });
237
    return indicator;
238
  }
239

    
240
  generateIndicatorByChartUrl(source: SourceType, url: string, type: IndicatorPathType = null, stakeholder:Stakeholder): IndicatorPath {
241
    let indicatorPath = new IndicatorPath('other', source, "", "", []);
242
    if (source === 'stats-tool') {
243
      indicatorPath.url = url.split("json=")[0] + "json=";
244
      indicatorPath.url = indicatorPath.url.split("/")[indicatorPath.url.split("/").length - 1];
245
      indicatorPath.chartObject = decodeURIComponent(url.split("json=")[1]);
246
      let chart = JSON.parse(indicatorPath.chartObject);
247
      indicatorPath.type = this.extractType(chart, indicatorPath);
248
      this.parameterizeDefaultQuery(chart, indicatorPath, stakeholder);
249
      this.extractTitle(chart, indicatorPath);
250
      this.extractSubTitle(chart, indicatorPath);
251
      this.extractXTitle(chart, indicatorPath);
252
      this.extractYTitle(chart, indicatorPath);
253
      this.extractFunder(chart, indicatorPath, stakeholder);
254
      this.extractStartYear(chart, indicatorPath);
255
      this.extractEndYear(chart, indicatorPath);
256
      indicatorPath.chartObject = JSON.stringify(chart);
257
      this.addResultFilters(chart, indicatorPath);
258
    } else if (source === 'old') {
259
      indicatorPath.url = url.split("data=")[0].split("/stats/")[1] + "data=";
260
      indicatorPath.chartObject = decodeURIComponent(url.split("data=")[1].split("&")[0]);
261
      indicatorPath.type = type;
262
      let chart = JSON.parse(indicatorPath.chartObject);
263
      this.extractOldToolTitle(chart, indicatorPath);
264
      this.extractOldToolXTitle(chart, indicatorPath);
265
      this.extractOldToolYTitle(chart, indicatorPath);
266
      indicatorPath.chartObject = JSON.stringify(chart);
267
    } else {
268
      indicatorPath.url = url;
269
      indicatorPath.type = type;
270
    }
271
    return indicatorPath;
272
  }
273

    
274
  private extractType(obj, indicatorPath: IndicatorPath): IndicatorPathType {
275
    let defaultTypes = ["column", "bar", "pie"];
276
    let type = obj["chartDescription"]["queries"][0]["type"];
277
    if (defaultTypes.indexOf(type) == -1) {
278
      type = defaultTypes [0];
279
    } else {
280
      obj["chartDescription"]["queries"][0]["type"] = ChartHelper.prefix + "type" + ChartHelper.suffix;
281
      indicatorPath.parameters['type'] = type;
282
    }
283
    return type;
284
  }
285

    
286
  private extractFunder(obj, indicatorPath: IndicatorPath, stakeholder:Stakeholder) {
287
    let funderName;
288
    for (let query of obj["chartDescription"]["queries"]) {
289
      if (!query["query"]["filters"]) {
290
        return;
291
      }
292
      for (let filter of query["query"]["filters"]) {
293
        if (filter["groupFilters"][0]["field"].indexOf(".funder") != -1) {
294
          funderName = filter["groupFilters"][0]["values"][0];
295
          filter["groupFilters"][0]["values"][0] = ChartHelper.prefix + "index_name" + ChartHelper.suffix;
296
          indicatorPath.parameters["index_name"] = stakeholder.index_name;
297
        }
298
      }
299
    }
300
  }
301

    
302
  private extractStartYear(obj, indicatorPath: IndicatorPath) {
303
    let start_year;
304
    for (let query of obj["chartDescription"]["queries"]) {
305
      if (!query["query"]["filters"]) {
306
        return;
307
      }
308
      for (let filter of query["query"]["filters"]) {
309
        for (let gfilter of filter["groupFilters"]) {
310
          if (gfilter["field"].indexOf(".year") != -1 && gfilter["type"].indexOf(">") != -1) {
311
            start_year = gfilter["values"][0];
312
            gfilter["values"][0] = ChartHelper.prefix + "start_year" + ChartHelper.suffix;
313
            indicatorPath.parameters["start_year"] = start_year;
314
          }
315
        }
316
      }
317
    }
318
  }
319

    
320
  private extractEndYear(obj, indicatorPath: IndicatorPath) {
321
    let end_year;
322
    for (let query of obj["chartDescription"]["queries"]) {
323
      if (!query["query"]["filters"]) {
324
        return;
325
      }
326
      for (let filter of query["query"]["filters"]) {
327
        for (let gfilter of filter["groupFilters"]) {
328
          if (gfilter["field"].indexOf(".year") != -1 && gfilter["type"].indexOf("<") != -1) {
329
            end_year = gfilter["values"][0];
330
            gfilter["values"][0] = ChartHelper.prefix + "end_year" + ChartHelper.suffix;
331
            indicatorPath.parameters["end_year"] = end_year;
332
          }
333
        }
334
      }
335
    }
336
  }
337

    
338
  private parameterizeDefaultQuery(obj, indicatorPath: IndicatorPath, stakeholder:Stakeholder) {
339
    let name = "";
340
    for (let query of obj["chartDescription"]["queries"]) {
341
      if (query["query"]["name"]) {
342
        name = query["query"]["name"];
343
        let stakeholderSN = name.split('.')[1];
344
        query["query"]["name"] = name.split('.' + stakeholderSN + ".")[0] + "." + ChartHelper.prefix + "index_shortName" + ChartHelper.suffix +"." + name.split('.' + stakeholderSN + ".")[1];
345
        indicatorPath.parameters["index_shortName"] = stakeholder.index_shortName.toLowerCase();
346
      }
347
    }
348
  }
349

    
350
  private extractTitle(obj, indicatorPath: IndicatorPath) {
351
    let title = "";
352
    if (obj["chartDescription"]["title"]) {
353
      title = obj["chartDescription"]["title"]["text"];
354
      obj["chartDescription"]["title"]["text"] = ChartHelper.prefix + "title" + ChartHelper.suffix;
355
      indicatorPath.parameters["title"] = title ? title : "";
356

    
357
    }
358
  }
359

    
360
  private extractSubTitle(obj, indicatorPath: IndicatorPath) {
361
    let subtitle = "";
362
    if (obj["chartDescription"]["subtitle"]) {
363
      subtitle = obj["chartDescription"]["subtitle"]["text"];
364
      obj["chartDescription"]["subtitle"]["text"] = ChartHelper.prefix + "subtitle" + ChartHelper.suffix;
365
      indicatorPath.parameters["subtitle"] = subtitle ? subtitle : "";
366
    }
367
  }
368

    
369
  private extractXTitle(obj, indicatorPath: IndicatorPath) {
370
    let title = "";
371
    if (obj["chartDescription"]["xAxis"]["title"]) {
372
      title = obj["chartDescription"]["xAxis"]["title"]["text"];
373
      obj["chartDescription"]["xAxis"]["title"]["text"] = ChartHelper.prefix + "xAxisTitle" + ChartHelper.suffix;
374
      indicatorPath.parameters["xAxisTitle"] = title ? title : ""
375
    }
376
  }
377

    
378
  private extractYTitle(obj, indicatorPath: IndicatorPath) {
379
    let title = "";
380
    if (obj["chartDescription"]["yAxis"]["title"]) {
381
      title = obj["chartDescription"]["yAxis"]["title"]["text"];
382
      obj["chartDescription"]["yAxis"]["title"]["text"] = ChartHelper.prefix + "yAxisTitle" + ChartHelper.suffix;
383
      indicatorPath.parameters["yAxisTitle"] = title ? title : ""
384
    }
385
  }
386

    
387
  private addResultFilters(obj, indicatorPath: IndicatorPath) {
388
    let resultTypes = ["publication", "software", "dataset", "other"];
389
    let index = -1;
390
    for (let query of obj["chartDescription"]["queries"]) {
391
      if (!query["query"]["select"]) {
392
        return;
393
      }
394
      for (let select of query["query"]["select"]) {
395
        for (var i = 0; i < resultTypes.length; i++) {
396
          if (select.field.startsWith(resultTypes[i])) {
397
            index = i;
398
          }
399
        }
400
      }
401

    
402
    }
403
    if (index != -1) {
404
      indicatorPath.filters = IndicatorPath.createResultFilters(resultTypes[index]);
405
    }
406
  }
407

    
408

    
409
  private extractOldToolTitle(obj, indicatorPath: IndicatorPath) {
410
    let title = "";
411
    if (obj["title"]) {
412
      title = obj["title"];
413
      obj["title"] = ChartHelper.prefix + "title" + ChartHelper.suffix;
414
      indicatorPath.parameters["title"] = title;
415

    
416
    }
417
  }
418

    
419
  private extractOldToolXTitle(obj, indicatorPath: IndicatorPath) {
420
    let title = "";
421
    if (obj["xaxistitle"]) {
422
      title = obj["xaxistitle"];
423
      obj["xaxistitle"] = ChartHelper.prefix + "xAxisTitle" + ChartHelper.suffix;
424
      indicatorPath.parameters["xAxisTitle"] = title;
425
    }
426
  }
427

    
428
  private extractOldToolYTitle(obj, indicatorPath: IndicatorPath) {
429
    let title = "";
430
    if (obj["fieldsheaders"]) {
431
      title = Array.isArray(obj["fieldsheaders"]) ? obj["fieldsheaders"][0] : obj["fieldsheaders"];
432
      if (Array.isArray(obj["fieldsheaders"])) {
433
        obj["fieldsheaders"][0] = ChartHelper.prefix + "yAxisTitle" + ChartHelper.suffix;
434
      } else {
435
        obj["fieldsheaders"] = ChartHelper.prefix + "yAxisTitle" + ChartHelper.suffix;
436
      }
437
      indicatorPath.parameters["yAxisTitle"] = title;
438
    }
439
  }
440

    
441
}
442

    
443
/*
444
custom query
445
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%22Publications%22%2C%22type%22%3A%22bar%22%2C%22query%22%3A%7B%22name%22%3A%22monitor.ec.publications.datasources%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%22Publication%20content%20provider%22%7D%2C%22subtitle%22%3A%7B%7D%2C%22yAxis%22%3A%7B%22title%22%3A%7B%22text%22%3A%22Publications%22%7D%7D%2C%22xAxis%22%3A%7B%22title%22%3A%7B%22text%22%3A%22Content%20provider%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
446

    
447
query with year filters:
448
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%22Publications%22%2C%22type%22%3A%22column%22%2C%22query%22%3A%7B%22select%22%3A%5B%7B%22field%22%3A%22publication%22%2C%22aggregate%22%3A%22count%22%7D%2C%7B%22field%22%3A%22publication.year%22%2C%22aggregate%22%3Anull%7D%5D%2C%22filters%22%3A%5B%7B%22groupFilters%22%3A%5B%7B%22field%22%3A%22publication.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%22publication.year%22%2C%22type%22%3A%22%3E%3D%22%2C%22values%22%3A%5B%222008%22%5D%7D%2C%7B%22field%22%3A%22publication.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%22publication%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%22Publications%20timeline%22%7D%2C%22subtitle%22%3A%7B%7D%2C%22yAxis%22%3A%7B%22title%22%3A%7B%22text%22%3A%22Publications%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
449

    
450
double query
451
http://88.197.53.71:8080/stats-api/chart?json=%7B%22library%22%3A%22HighCharts%22%2C%22chartDescription%22%3A%7B%22colors%22%3A%5B%22%2342a5f5%22%2C%22%2326a69a%22%2C%22%2390ed7d%22%2C%22%23607d8b%22%2C%22%2300838f%22%2C%22%23689f38%22%2C%22%23e4d354%22%2C%22%232b908f%22%2C%22%23546e7a%22%2C%22%2301579%22%5D%2C%22queries%22%3A%5B%7B%22name%22%3A%22Gold%22%2C%22color%22%3A%22%23f8b500%22%2C%22type%22%3A%22column%22%2C%22query%22%3A%7B%22select%22%3A%5B%7B%22field%22%3A%22result%22%2C%22aggregate%22%3A%22count%22%7D%2C%7B%22field%22%3A%22result.year%22%2C%22aggregate%22%3Anull%7D%5D%2C%22filters%22%3A%5B%7B%22groupFilters%22%3A%5B%7B%22field%22%3A%22result.project.funder%22%2C%22type%22%3A%22%3D%22%2C%22values%22%3A%5B%22European%20Commission%22%5D%7D%2C%7B%22field%22%3A%22result.project.funding%20level%200%22%2C%22type%22%3A%22%3D%22%2C%22values%22%3A%5B%22H2020%22%5D%7D%2C%7B%22field%22%3A%22result.type%22%2C%22type%22%3A%22%3D%22%2C%22values%22%3A%5B%22publication%22%5D%7D%2C%7B%22field%22%3A%22result.year%22%2C%22type%22%3A%22%3E%3D%22%2C%22values%22%3A%5B%222014%22%5D%7D%2C%7B%22field%22%3A%22result.year%22%2C%22type%22%3A%22%3C%3D%22%2C%22values%22%3A%5B%222019%22%5D%7D%2C%7B%22field%22%3A%22result.access%20mode%22%2C%22type%22%3A%22%3D%22%2C%22values%22%3A%5B%22Open%20Access%22%5D%7D%5D%2C%22op%22%3A%22AND%22%7D%2C%7B%22groupFilters%22%3A%5B%7B%22field%22%3A%22result.datasource.type%22%2C%22type%22%3A%22%3D%22%2C%22values%22%3A%5B%22Journal%22%5D%7D%2C%7B%22field%22%3A%22result.datasource.type%22%2C%22type%22%3A%22%3D%22%2C%22values%22%3A%5B%22Journal%20Aggregator%2FPublisher%22%5D%7D%5D%2C%22op%22%3A%22OR%22%7D%5D%2C%22entity%22%3A%22result%22%2C%22profile%22%3A%22OpenAIRE%20original%22%2C%22limit%22%3A%220%22%7D%7D%2C%7B%22name%22%3A%22Green%22%2C%22color%22%3A%22%23239d60%22%2C%22type%22%3A%22column%22%2C%22query%22%3A%7B%22select%22%3A%5B%7B%22field%22%3A%22result%22%2C%22aggregate%22%3A%22count%22%7D%2C%7B%22field%22%3A%22result.year%22%2C%22aggregate%22%3Anull%7D%5D%2C%22filters%22%3A%5B%7B%22groupFilters%22%3A%5B%7B%22field%22%3A%22result.project.funder%22%2C%22type%22%3A%22%3D%22%2C%22values%22%3A%5B%22European%20Commission%22%5D%7D%2C%7B%22field%22%3A%22result.project.funding%20level%200%22%2C%22type%22%3A%22%3D%22%2C%22values%22%3A%5B%22H2020%22%5D%7D%2C%7B%22field%22%3A%22result.type%22%2C%22type%22%3A%22%3D%22%2C%22values%22%3A%5B%22publication%22%5D%7D%2C%7B%22field%22%3A%22result.year%22%2C%22type%22%3A%22%3E%3D%22%2C%22values%22%3A%5B%222014%22%5D%7D%2C%7B%22field%22%3A%22result.year%22%2C%22type%22%3A%22%3C%3D%22%2C%22values%22%3A%5B%222019%22%5D%7D%2C%7B%22field%22%3A%22result.access%20mode%22%2C%22type%22%3A%22%3D%22%2C%22values%22%3A%5B%22Open%20Access%22%5D%7D%5D%2C%22op%22%3A%22AND%22%7D%2C%7B%22groupFilters%22%3A%5B%7B%22field%22%3A%22result.datasource.type%22%2C%22type%22%3A%22%3D%22%2C%22values%22%3A%5B%22Institutional%20Repository%22%5D%7D%2C%7B%22field%22%3A%22result.datasource.type%22%2C%22type%22%3A%22%3D%22%2C%22values%22%3A%5B%22Thematic%20Repository%22%5D%7D%5D%2C%22op%22%3A%22OR%22%7D%5D%2C%22entity%22%3A%22result%22%2C%22profile%22%3A%22OpenAIRE%20original%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%22H2020%20green%20and%20gold%20publications%22%7D%2C%22subtitle%22%3A%7B%22text%22%3A%22over%20time%22%7D%2C%22yAxis%22%3A%7B%22title%22%3A%7B%22text%22%3A%22Publications%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%3Afalse%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
452

    
453

    
454
//old tool
455
https://www.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%
456
 */
(1-1/2)