Project

General

Profile

« Previous | Next » 

Revision 57668

First approach to the country map in the country dashboard

View differences:

modules/open-science-observatory-ui/trunk/src/app/pages/countrypage/country-page.component.html
1
<section class="section greySection uk-padding-top-remove uk-padding-bottom-remove" id="sect-country-page">
2
  <div class="uk-container uk-container-expand uk-container-center uk-scrollspy-init-inview uk-scrollspy-inview uk-animation-scale-up uk-padding-remove" data-uk-scrollspy="{cls:'uk-animation-scale-up uk-invisible',delay:300,topoffset:-100}">
3

  
4
    <div class="uk-grid uk-grid-small">
5

  
6
      <div class="uk-width-large-4-5 uk-width-medium-3-4">
7

  
8

  
9

  
10

  
11
      </div>
12

  
13
      <div class="uk-width-large-1-5 uk-width-medium-1-4">
14
        <div id="sidebar_main" class="md-card dark-blue-box infoBox uk-sticky" uk-height-viewport="offset-bottom: 0">
15
          <div class="md-card-content">
16
            <h3 class="uk-text-center">{{countryName | uppercase}}</h3>
17

  
18
            <div>
19
              <!--<app-map-overview></app-map-overview>-->
20
              <app-country-map [country]="countryName"></app-country-map>
21
            </div>
22

  
23
            <div>This tool allows you to:</div>
24
            <ul>
25
              <li>
26
                better understand the European Open Data landscape
27
              </li>
28
              <li>
29
                find data catalogues and datasets analyse and visualise available metadata
30
              </li>
31
              <li>
32
                find data catalogues and datasets analyse and visualise available metadata
33
              </li>
34
              <li>
35
                access the raw data
36
              </li>
37
            </ul>
38
            <div class="uk-text-center uk-margin-medium-top">
39
              <button class="md-btn md-btn-primary">Learn More</button>
40
            </div>
41
          </div>
42
        </div>
43
      </div>
44

  
45

  
46
      <!--<div class="uk-width-large-3-5 uk-container-center uk-text-center">-->
47
      <!--<h2 class="heading_b">-->
48
      <!--Our Team-->
49
      <!--<span class="sub-heading">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</span>-->
50
      <!--</h2>-->
51
      <!--</div>-->
52
    </div>
53

  
54
  </div>
55
</section>
modules/open-science-observatory-ui/trunk/src/app/pages/countrypage/country-map.component.html
1
<div class="">
2
  <highcharts-chart
3
    [Highcharts]="Highcharts"
4
    [constructorType]="'mapChart'"
5
    [options]="chartMapOptions"
6
    style="width: 100%; height: 200px; display: block;"
7
  ></highcharts-chart>
8
</div>
9

  
modules/open-science-observatory-ui/trunk/src/app/pages/countrypage/country-map.component.ts
1
import { MapCountryData } from '../../domain/map-country-data';
2

  
3
declare var require: any;
4

  
5
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
6

  
7
import * as Highcharts from 'highcharts';
8
import MapModule from 'highcharts/modules/map';
9
import {CountryOverview} from '../../domain/overview-data';
10

  
11
const mapWorld = require('@highcharts/map-collection/custom/world.geo.json');
12
const mapEurope = require('@highcharts/map-collection/custom/europe.geo.json');
13

  
14
MapModule(Highcharts);
15

  
16
@Component({
17
  selector: 'app-country-map',
18
  templateUrl: './country-map.component.html',
19
  encapsulation: ViewEncapsulation.None
20
})
21

  
22
export class CountryMapComponent implements OnInit {
23

  
24
  @Input() country: string;
25

  
26
  Highcharts: typeof Highcharts = Highcharts;
27

  
28
  chartMapOptions: Highcharts.Options;
29

  
30
  mapCountryData: MapCountryData[] = [];
31
  seriesColor: string = '#ff9800';
32
  seriesName: string = 'OA publications';
33

  
34
  europe: string[] = [];
35
  countryNames: string[] = [];
36

  
37
  constructor() {}
38

  
39
  ngOnInit(): void {
40
    this.countryNames.push(this.country);
41
    console.log('this.country', this.country);
42
    console.log('this.countryNames', this.countryNames);
43
    this.mapCountryData.push(this.overviewToMapData());
44
    this.loadMap(this.mapCountryData, this.seriesColor, this.seriesName, this.country);
45
  }
46

  
47
  overviewToMapData(): MapCountryData {
48
    this.seriesColor = '#A26C0A';
49
    this.seriesName = 'OA policies';
50
    return {
51
      id: this.country,
52
      country: this.country,
53
      z: 5
54
    };
55
  }
56

  
57
  loadMap(mapCountryData: MapCountryData[], seriesColor: string, seriesName: string, countryName: string) {
58
    this.chartMapOptions = {
59
      chart: {
60
        map: mapWorld,
61
        events: {
62
          load: function() {
63
            // this.series[0].data = this.series[0].data.map((el) => {
64
            //   if (countryCodes.includes(el['hc-key'])) {
65
            //     el.color = 'rgba(139,151,167,0.6)';
66
            //     return el;
67
            //   }
68
            //   return el;
69
            // });
70
            // this.update({
71
            //   series: [{
72
            //     data: this.series[0].data as Highcharts.SeriesMapbubbleDataOptions,
73
            //   } as Highcharts.SeriesMapbubbleOptions]
74
            // });
75
            // // this.mapZoom(0.24, 4518.24, -8188.36);
76
            // this.mapZoom(0.2, this.get('Germany')['x'], this.get('Germany')['y']);
77
          },
78
          // click: event => {
79
          //   if (event.target.hasOwnProperty('point')) {
80
          //     console.log(event.target['point']['name']);
81
          //     // this.countrySelected(event.target['point']['name']);
82
          //   }
83
          // }
84
        }
85
      },
86
      title: {
87
        text: 'Highmaps basic demo'
88
      },
89
      // subtitle: {
90
      //   text: 'Source map: <a href="http://code.highcharts.com/mapdata/custom/world.js">World, Miller projection, medium resolution</a>'
91
      // },
92
      // mapNavigation: {
93
      //   enabled: true,
94
      //   buttonOptions: {
95
      //     alignTo: 'spacingBox'
96
      //   }
97
      // },
98
      legend: {
99
        enabled: false
100
      },
101
      colorAxis: {
102
        min: 0
103
      },
104
      series: [{
105
        name: 'Countries',
106
        borderColor: '#fff',
107
        negativeColor: 'rgba(139,151,167,0.2)',
108
        enableMouseTracking: false,
109
        type: 'map'
110
        }, {
111
        name: 'Random data',
112
        type: 'map',
113
        joinBy: ['name', 'country'],
114
        data : mapCountryData,
115
        // data: [
116
        //   ['is', 1],
117
        //   ['no', 1],
118
        //   ['se', 1],
119
        //   ['dk', 1],
120
        //   ['fi', 1]
121
        // ],
122
        // states: {
123
        //   hover: {
124
        //     color: '#BADA55'
125
        //   }
126
        // },
127
        // dataLabels: {
128
        //   enabled: true,
129
        //   format: '{point.name}'
130
        // },
131
        // allAreas: false,
132
        // joinBy: ['name', 'country'],
133
        // data : mapCountryData
134
      } as Highcharts.SeriesMapOptions]
135
    };
136

  
137
  }
138
}
modules/open-science-observatory-ui/trunk/src/app/pages/home/data-view.component.html
42 42
  </li>
43 43
</ul>
44 44
<div class="actionButtons uk-text-right">
45
  <button class="md-btn md-btn-secondary" (click)="printOverviewData('table-absolute')"><i class="fas fa-print uk-margin-small-right"></i>Print report in PDF</button>
45
  <button class="md-btn md-btn-secondary" (click)="printOverviewData('switcher-content-a-fade')"><i class="fas fa-print uk-margin-small-right"></i>Print report in PDF</button>
46 46
  <button class="md-btn md-btn-secondary uk-margin-left"><i class="fas fa-download uk-margin-small-right"></i>Download report</button>
47 47
</div>
48 48

  
49 49
<hr>
50 50

  
51
<ul id="switcher-content-a-fade" class="uk-switcher uk-margin">
51
<ul id="switcher-content-a-fade" class="uk-switcher uk-margin" >
52 52
  <li aria-hidden="false" class="uk-active" style="animation-duration: 200ms;">
53 53
    <!--<div class="dataContent">-->
54 54
      <!--<div class="actionButtons uk-text-right">-->
modules/open-science-observatory-ui/trunk/src/app/pages/home/home.component.html
69 69
            </div>
70 70
            <hr class="greyBoldDivider uk-margin-medium-top uk-margin-medium-bottom">
71 71
            <div class="uk-text-center uk-margin-medium-top">
72
              <button class="md-btn md-btn-primary">Visit Country Page <i class="fas fa-arrow-right uk-margin-small-left"></i></button>
72
              <button class="md-btn md-btn-primary" [routerLink]="['/countryDashboard/' + countrySelectedName]">Visit Country Page <i class="fas fa-arrow-right uk-margin-small-left"></i></button>
73 73
            </div>
74 74
          </div>
75 75
        </div>
modules/open-science-observatory-ui/trunk/src/app/app.module.ts
11 11
import { HighchartsChartModule } from 'highcharts-angular';
12 12
import { CountriesMapOverviewComponent } from './pages/home/countries-map-overview.component';
13 13
import { CountryPageComponent } from './pages/countrypage/country-page.component';
14
import { CountryMapComponent } from './pages/countrypage/country-map.component';
14 15

  
15 16
@NgModule({
16 17
  declarations: [
......
19 20
    CountriesTableComponent,
20 21
    DataViewComponent,
21 22
    CountriesMapOverviewComponent,
22
    CountryPageComponent
23
    CountryPageComponent,
24
    CountryMapComponent
23 25
  ],
24 26
  imports: [
25 27
    BrowserModule,

Also available in: Unified diff