fix(map): get the bubble map back (thanks to @SUlbrichA) (#1655)

Closes #1576
This commit is contained in:
Dmitry Nehaychik 2018-04-26 13:35:41 +03:00 committed by GitHub
parent bb9dccf2c8
commit 19f9d0ef0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 5 deletions

View file

@ -1,4 +1,8 @@
import { Component, OnDestroy } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { combineLatest } from 'rxjs/observable/combineLatest';
import { takeWhile } from 'rxjs/operators/takeWhile';
import { NgxEchartsService } from 'ngx-echarts';
import { NbThemeService } from '@nebular/theme';
@Component({
@ -23,12 +27,21 @@ export class BubbleMapComponent implements OnDestroy {
bubbleTheme: any;
geoColors: any[];
themeSubscription: any;
constructor(private theme: NbThemeService) {
private alive = true;
this.themeSubscription = this.theme.getJsTheme()
.subscribe(config => {
constructor(private theme: NbThemeService,
private http: HttpClient,
private es: NgxEchartsService) {
combineLatest([
this.http.get('assets/map/world.json'),
this.theme.getJsTheme(),
])
.pipe(takeWhile(() => this.alive))
.subscribe(([map, config]: [any, any]) => {
this.es.registerMap('world', map);
const colors = config.variables;
this.bubbleTheme = config.variables.bubbleMap;
@ -527,7 +540,7 @@ export class BubbleMapComponent implements OnDestroy {
}
ngOnDestroy() {
this.themeSubscription.unsubscribe();
this.alive = false;
}
private getRandomGeoColor() {

File diff suppressed because one or more lines are too long