mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-09-22 05:50:48 +02:00
fix(map): get the bubble map back (thanks to @SUlbrichA) (#1655)
Closes #1576
This commit is contained in:
parent
bb9dccf2c8
commit
19f9d0ef0d
3 changed files with 20 additions and 5 deletions
|
@ -42,6 +42,7 @@
|
||||||
"../node_modules/tinymce/plugins/paste/plugin.min.js",
|
"../node_modules/tinymce/plugins/paste/plugin.min.js",
|
||||||
"../node_modules/tinymce/plugins/table/plugin.min.js",
|
"../node_modules/tinymce/plugins/table/plugin.min.js",
|
||||||
"../node_modules/echarts/dist/echarts.min.js",
|
"../node_modules/echarts/dist/echarts.min.js",
|
||||||
|
"../node_modules/echarts/dist/extension/bmap.min.js",
|
||||||
"../node_modules/chart.js/dist/Chart.min.js"
|
"../node_modules/chart.js/dist/Chart.min.js"
|
||||||
],
|
],
|
||||||
"environmentSource": "environments/environment.ts",
|
"environmentSource": "environments/environment.ts",
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
import { Component, OnDestroy } from '@angular/core';
|
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';
|
import { NbThemeService } from '@nebular/theme';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -23,12 +27,21 @@ export class BubbleMapComponent implements OnDestroy {
|
||||||
|
|
||||||
bubbleTheme: any;
|
bubbleTheme: any;
|
||||||
geoColors: any[];
|
geoColors: any[];
|
||||||
themeSubscription: any;
|
|
||||||
|
|
||||||
constructor(private theme: NbThemeService) {
|
private alive = true;
|
||||||
|
|
||||||
this.themeSubscription = this.theme.getJsTheme()
|
constructor(private theme: NbThemeService,
|
||||||
.subscribe(config => {
|
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;
|
const colors = config.variables;
|
||||||
this.bubbleTheme = config.variables.bubbleMap;
|
this.bubbleTheme = config.variables.bubbleMap;
|
||||||
|
@ -527,7 +540,7 @@ export class BubbleMapComponent implements OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.themeSubscription.unsubscribe();
|
this.alive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getRandomGeoColor() {
|
private getRandomGeoColor() {
|
||||||
|
|
1
src/assets/map/world.json
Normal file
1
src/assets/map/world.json
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue