Project

General

Profile

« Previous | Next » 

Revision 57821

[Monitor-Dashboard|Trunk]

add more charts about Open science.

Get full url: replace parameters more than once
add subtitle in indicator parameters/form

View differences:

modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/indicator-utils.ts
148 148
        if (endDate && key == "end_year" && indicatorPath.filters["end_year"]) {
149 149
          replacedValue = (replacedValue > endDate) ? endDate : replacedValue;
150 150
        }
151
        replacedUrl = replacedUrl.replace(ChartHelper.prefix + key + ChartHelper.suffix, replacedValue);
151
        replacedUrl = replacedUrl.split(ChartHelper.prefix + key + ChartHelper.suffix).join(replacedValue)
152 152
      });
153 153
    }
154
    console.info("replacedUrl:"+replacedUrl)
154 155
    if (indicatorPath.chartObject) {
155 156
      if (fundingL0 && indicatorPath.filters["fundingL0"]) {
156 157
        let newJsonObject = JSON.parse(replacedUrl);
......
191 192
      let chart = JSON.parse(indicatorPath.chartObject);
192 193
      indicatorPath.type = this.extractType(chart, indicatorPath);
193 194
      this.extractTitle(chart, indicatorPath);
195
      this.extractSubTitle(chart,indicatorPath);
194 196
      this.extractXTitle(chart, indicatorPath);
195 197
      this.extractYTitle(chart, indicatorPath);
196 198
      this.extractFunder(chart, indicatorPath);
......
283 285
    if (obj["chartDescription"]["title"]) {
284 286
      title = obj["chartDescription"]["title"]["text"];
285 287
      obj["chartDescription"]["title"]["text"] = ChartHelper.prefix + "title" + ChartHelper.suffix;
286
      indicatorPath.parameters["title"] = title;
288
      indicatorPath.parameters["title"] = title?title:"";
287 289

  
288 290
    }
289 291
  }
292
  private extractSubTitle(obj, indicatorPath: IndicatorPath) {
293
    let subtitle = "";
294
    if (obj["chartDescription"]["subtitle"]) {
295
      subtitle = obj["chartDescription"]["subtitle"]["text"];
296
      obj["chartDescription"]["subtitle"]["text"]= ChartHelper.prefix + "subtitle" + ChartHelper.suffix;
297
      indicatorPath.parameters["subtitle"] = subtitle?subtitle:"";
298
    }
299
  }
290 300

  
291 301
  private extractXTitle(obj, indicatorPath: IndicatorPath) {
292 302
    let title = "";
293 303
    if (obj["chartDescription"]["xAxis"]["title"]) {
294 304
      title = obj["chartDescription"]["xAxis"]["title"]["text"];
295 305
      obj["chartDescription"]["xAxis"]["title"]["text"] = ChartHelper.prefix + "xAxisTitle" + ChartHelper.suffix;
296
      indicatorPath.parameters["xAxisTitle"] = title;
306
      indicatorPath.parameters["xAxisTitle"] = title?title:""
297 307
    }
298 308
  }
299 309

  
......
302 312
    if (obj["chartDescription"]["yAxis"]["title"]) {
303 313
      title = obj["chartDescription"]["yAxis"]["title"]["text"];
304 314
      obj["chartDescription"]["yAxis"]["title"]["text"] = ChartHelper.prefix + "yAxisTitle" + ChartHelper.suffix;
305
      indicatorPath.parameters["yAxisTitle"] = title;
315
      indicatorPath.parameters["yAxisTitle"] = title?title:""
306 316
    }
307 317
  }
308 318

  
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/entities/stakeholderCreator.ts
1 1
import {Stakeholder,Topic,Category,SubCategory,Indicator, IndicatorPath, ChartHelper} from "./stakeholder";
2
import {IndicatorUtils} from "../indicator-utils";
2 3

  
3 4
export class StakeholderCreator {
4 5

  
......
189 190
  }
190 191
  static createOASub(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural ):SubCategory {
191 192
    let sub:SubCategory =  new SubCategory(typePlural, null, dbTypePlural, true, true);
193
    // sub.charts = sub.charts.concat( this.createOAPerType(stakeholder,typePlural, typeSingl, dbType, dbTypePlural, 0 ));
194
    // sub.charts = sub.charts.concat( this.createOAPerType(stakeholder,typePlural, typeSingl, dbType, dbTypePlural, 1 ));
195
    // sub.charts = sub.charts.concat( this.createOAPerType(stakeholder,typePlural, typeSingl, dbType, dbTypePlural, 2 ));
192 196
    return sub;
193 197
  }
198
  static createOAPerType(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural, index:number):Indicator[] {
199

  
200
    let fundingFilter = ['', ',{"groupFilters":[{"field":"' + dbType + '.project.funding level 0","type":"=","values":["FP7"]}],"op":"AND"}',
201
      ',{"groupFilters":[{"field":"' + dbType + '.project.funding level 0","type":"=","values":["H2020"]}],"op":"AND"}'];
202
    let categoryTitle = ["Overview", "FP7", "H2020"];
203
    let chartTitle = ["", "FP7 ", "H2020 "];
204
    let indicators:Indicator[]=[];
205
    let utils = new IndicatorUtils();
206

  
207
    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"}}}');
208
      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"}}}');
209
    let open_non_ind:Indicator = new Indicator(categoryTitle[index], "", "column", "small", true, true, [utils.generateIndicatorByChartUrl("stats-tool", open_non_url, "pie")])
210
    open_non_ind.indicatorPaths[0].parameters["id"] =  stakeholder.index_shortName.toLowerCase();
211
    indicators.push(open_non_ind);
212

  
213
    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"}}}');
214
    let gold_vs_green_ind:Indicator = (new Indicator("", "", "column", "small", true, true, [utils.generateIndicatorByChartUrl("stats-tool", gold_vs_green_url, "pie")]));
215
    gold_vs_green_ind.indicatorPaths[0].parameters["id"] =  stakeholder.index_shortName.toLowerCase();
216
    indicators.push(gold_vs_green_ind);
217

  
218
    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"}}}');
219
    let gold_vs_green_time_ind:Indicator = (new Indicator("", "", "column", "small", true, true, [utils.generateIndicatorByChartUrl("stats-tool", gold_vs_green_time_url, "column")]));
220
    gold_vs_green_time_ind.indicatorPaths[0].parameters["id"] =  stakeholder.index_shortName.toLowerCase();
221
    indicators.push(gold_vs_green_time_ind);
222

  
223
    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"}}}');
224
    let top_project_ind:Indicator = (new Indicator("", "", "column", "medium", true, true, [utils.generateIndicatorByChartUrl("stats-tool", top_project_url, "column")]));
225
    top_project_ind.indicatorPaths[0].parameters["id"] =  stakeholder.index_shortName.toLowerCase();
226
    indicators.push(top_project_ind);
227
    if(index == 0) {
228
      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"}}}');
229
      let top_datasources_ind: Indicator = (new Indicator("By Content Providers", "", "column", "large", true, true, [utils.generateIndicatorByChartUrl("stats-tool", top_datasources_url, "column")]));
230
      top_datasources_ind.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
231
      indicators.push(top_datasources_ind);
232
    }
233
    return indicators;
234
  }
194 235
  static createOSTopic(stakeholder:Stakeholder):Topic{
195 236
    let topic = new Topic("Open Science","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","open-science",true,true);
196 237
    topic.categories.push(this.createOpenAccessTopic(stakeholder));
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/topic/indicators.component.html
243 243
                 [formInput]="getParameter(i, 'title').get('value')"
244 244
                 label="Chart Title"></div>
245 245
          </div>
246
          <div *ngIf="getParameter(i, 'subtitle')" class="uk-form-row">
247
            <div dashboard-input
248
                 [formInput]="getParameter(i, 'subtitle').get('value')"
249
                 label="Chart Subtitle"></div>
250
          </div>
246 251
          <div class="uk-grid-medium uk-form-row" uk-grid>
247 252
            <div *ngIf="getParameter(i, 'type')" class="uk-width-1-3@s">
248 253
              <div dashboard-input [formInput]="getParameter(i, 'type').get('value')"
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/topic/indicators.component.ts
285 285
    this.addUrl();
286 286
    this.editIndicatorModal.alertTitle = 'Create a new chart Indicator';
287 287
    this.editIndicatorModal.cancelButtonText = 'Cancel';
288
    this.editIndicatorModal.okButtonText = 'Create';
288
    this.editIndicatorModal.okButtonText = 'Next';
289 289
    this.editIndicatorModal.okButtonLeft = false;
290 290
    this.editIndicatorModal.alertMessage = false;
291 291
    this.editIndicatorModal.stayOpen = true;
......
318 318
    this.indicator.indicatorPaths.forEach(indicatorPath => {
319 319
      let parameters = this.fb.array([]);
320 320
      if (indicatorPath.parameters) {
321
        console.info(indicatorPath.parameters);
321 322
        Object.keys(indicatorPath.parameters).forEach(key => {
322 323
          if (this.indicatorUtils.ignoredParameters.indexOf(key) === -1) {
323 324
            if (this.indicatorUtils.parametersValidators.has(key)) {
......
328 329
            } else {
329 330
              parameters.push(this.fb.group({
330 331
                key: this.fb.control(key),
331
                value: this.fb.control(indicatorPath.parameters[key], Validators.required)
332
                value: this.fb.control(indicatorPath.parameters[key])
332 333
              }));
333 334
            }
334 335
          }

Also available in: Unified diff