2016-05-11 17:38:01 +03:00
|
|
|
import {Component, ViewEncapsulation} from '@angular/core';
|
2016-05-04 11:49:36 +03:00
|
|
|
import {BaCard} from '../../../../theme/components';
|
2016-05-02 19:49:37 +03:00
|
|
|
|
2016-05-03 10:51:59 +03:00
|
|
|
import {layoutPaths} from "../../../../theme/theme.constants";
|
2016-05-02 19:49:37 +03:00
|
|
|
import {BubbleMapsService} from "./bubbleMaps.service";
|
|
|
|
|
|
|
|
|
|
require('ammap3');
|
|
|
|
|
require('ammap3/ammap/maps/js/worldLow');
|
2016-05-13 22:21:17 +03:00
|
|
|
// TODO: use baAmChart instead of this
|
2016-05-02 19:49:37 +03:00
|
|
|
@Component({
|
|
|
|
|
selector: 'bubble-maps',
|
|
|
|
|
pipes: [],
|
|
|
|
|
providers: [BubbleMapsService],
|
|
|
|
|
// otherwise maps won't work
|
|
|
|
|
encapsulation: ViewEncapsulation.None,
|
|
|
|
|
styles: [require('ammap3/ammap/ammap.css'), require('./bubbleMaps.scss')],
|
|
|
|
|
directives: [BaCard],
|
|
|
|
|
template: require('./bubbleMaps.html'),
|
|
|
|
|
})
|
|
|
|
|
export class BubbleMaps {
|
|
|
|
|
|
|
|
|
|
constructor(private _bubbleMapsService:BubbleMapsService) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngAfterViewInit() {
|
|
|
|
|
AmCharts.theme = this._bubbleMapsService.getTheme();
|
|
|
|
|
|
|
|
|
|
let map = new AmCharts.AmMap();
|
|
|
|
|
|
|
|
|
|
map.addTitle('Population of the World in 2011', 14);
|
|
|
|
|
map.addTitle('source: Gapminder', 11);
|
|
|
|
|
map.areasSettings = {
|
|
|
|
|
unlistedAreasColor: '#000000',
|
|
|
|
|
unlistedAreasAlpha: 0.1
|
|
|
|
|
};
|
|
|
|
|
map.imagesSettings.balloonText = '<span style="font-size:14px;"><b>[[title]]</b>: [[value]]</span>';
|
|
|
|
|
map.pathToImages = layoutPaths.images.amMap;
|
|
|
|
|
|
|
|
|
|
let dataProvider = {
|
|
|
|
|
mapVar: AmCharts.maps.worldLow,
|
|
|
|
|
images: []
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
map.dataProvider = this._bubbleMapsService.getDataProvider(dataProvider);
|
|
|
|
|
map.export = {
|
|
|
|
|
enabled: true
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
map.write('map-bubbles');
|
|
|
|
|
}
|
|
|
|
|
}
|