add popUp to miniMap for better usability
This commit is contained in:
parent
82b8b8bd74
commit
7a80335860
@ -1,6 +1,6 @@
|
|||||||
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
||||||
<mat-toolbar class="mat-toolbar" color="primary">
|
<mat-toolbar class="mat-toolbar" color="primary">
|
||||||
<span>Bike Stations in London</span>
|
<span routerLink="/">Bike Stations in London</span>
|
||||||
<span class="toolbar-spacer"></span>
|
<span class="toolbar-spacer"></span>
|
||||||
<a class="button-wiki" color="primary"
|
<a class="button-wiki" color="primary"
|
||||||
href="https://gitlab.com/marcel.schwarz/geovisualisierung/-/wikis/Projektarbeit%203" mat-flat-button
|
href="https://gitlab.com/marcel.schwarz/geovisualisierung/-/wikis/Projektarbeit%203" mat-flat-button
|
||||||
@ -49,8 +49,6 @@
|
|||||||
<div class="chart-bikepoint-availability" fxFlex fxLayout="column">
|
<div class="chart-bikepoint-availability" fxFlex fxLayout="column">
|
||||||
<div id="chart">
|
<div id="chart">
|
||||||
<apx-chart
|
<apx-chart
|
||||||
[title]="bikePointChartOptions.title"
|
|
||||||
[subtitle]="bikePointChartOptions.subtitle"
|
|
||||||
[chart]="bikePointChartOptions.chart"
|
[chart]="bikePointChartOptions.chart"
|
||||||
[colors]="bikePointChartOptions.colors"
|
[colors]="bikePointChartOptions.colors"
|
||||||
[dataLabels]="bikePointChartOptions.dataLabels"
|
[dataLabels]="bikePointChartOptions.dataLabels"
|
||||||
@ -59,6 +57,8 @@
|
|||||||
[plotOptions]="bikePointChartOptions.plotOptions"
|
[plotOptions]="bikePointChartOptions.plotOptions"
|
||||||
[series]="bikePointChartOptions.series"
|
[series]="bikePointChartOptions.series"
|
||||||
[stroke]="bikePointChartOptions.stroke"
|
[stroke]="bikePointChartOptions.stroke"
|
||||||
|
[subtitle]="bikePointChartOptions.subtitle"
|
||||||
|
[title]="bikePointChartOptions.title"
|
||||||
[tooltip]="bikePointChartOptions.tooltip"
|
[tooltip]="bikePointChartOptions.tooltip"
|
||||||
[xaxis]="bikePointChartOptions.xaxis"
|
[xaxis]="bikePointChartOptions.xaxis"
|
||||||
[yaxis]="bikePointChartOptions.yaxis"
|
[yaxis]="bikePointChartOptions.yaxis"
|
||||||
@ -81,12 +81,12 @@
|
|||||||
<div class="dashboard-table-to" fxFlex>
|
<div class="dashboard-table-to" fxFlex>
|
||||||
<table [dataSource]="stationToSource" class="mat-elevation-z8" fxFill mat-table>
|
<table [dataSource]="stationToSource" class="mat-elevation-z8" fxFill mat-table>
|
||||||
<ng-container matColumnDef="select">
|
<ng-container matColumnDef="select">
|
||||||
<th mat-header-cell *matHeaderCellDef></th>
|
<th *matHeaderCellDef mat-header-cell></th>
|
||||||
<td mat-cell *matCellDef="let row">
|
<td *matCellDef="let row" mat-cell>
|
||||||
<mat-checkbox matTooltip="toggle to view marker on map" matTooltipPosition="above"
|
<mat-checkbox (change)="$event ? selectRow($event, row) : null" (click)="$event.stopPropagation()"
|
||||||
(click)="$event.stopPropagation()"
|
[checked]="selectionModel.isSelected(row)"
|
||||||
(change)="$event ? selectRow($event, row) : null"
|
matTooltip="toggle to view marker on map"
|
||||||
[checked]="selectionModel.isSelected(row)">
|
matTooltipPosition="above">
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
@ -118,12 +118,12 @@
|
|||||||
<div class="dashboard-table-from" fxFlex>
|
<div class="dashboard-table-from" fxFlex>
|
||||||
<table [dataSource]="stationFromSource" class="mat-elevation-z9" fxFill mat-table>
|
<table [dataSource]="stationFromSource" class="mat-elevation-z9" fxFill mat-table>
|
||||||
<ng-container matColumnDef="select">
|
<ng-container matColumnDef="select">
|
||||||
<th mat-header-cell *matHeaderCellDef></th>
|
<th *matHeaderCellDef mat-header-cell></th>
|
||||||
<td mat-cell *matCellDef="let row">
|
<td *matCellDef="let row" mat-cell>
|
||||||
<mat-checkbox matTooltip="toggle to view marker on map" matTooltipPosition="above"
|
<mat-checkbox (change)="$event ? selectRow($event, row) : null" (click)="$event.stopPropagation()"
|
||||||
(click)="$event.stopPropagation()"
|
[checked]="selectionModel.isSelected(row)"
|
||||||
(change)="$event ? selectRow($event, row) : null"
|
matTooltip="toggle to view marker on map"
|
||||||
[checked]="selectionModel.isSelected(row)">
|
matTooltipPosition="above">
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
@ -187,7 +187,7 @@
|
|||||||
<mat-card-header class="chart-header">
|
<mat-card-header class="chart-header">
|
||||||
<mat-card-title>Rental Time</mat-card-title>
|
<mat-card-title>Rental Time</mat-card-title>
|
||||||
<mat-card-subtitle>
|
<mat-card-subtitle>
|
||||||
This chart shows the workload of the currently selected Station in relation
|
This chart shows the workload of the currently selected station in relation
|
||||||
of the time of the day. It is visualized at which time of the day a journey begins or ends (blue).
|
of the time of the day. It is visualized at which time of the day a journey begins or ends (blue).
|
||||||
In addition, the average rental duration of the trips is displayed at the given time (green).
|
In addition, the average rental duration of the trips is displayed at the given time (green).
|
||||||
</mat-card-subtitle>
|
</mat-card-subtitle>
|
||||||
@ -199,10 +199,10 @@
|
|||||||
[chart]="timeChartOptions.chart"
|
[chart]="timeChartOptions.chart"
|
||||||
[colors]="timeChartOptions.colors"
|
[colors]="timeChartOptions.colors"
|
||||||
[dataLabels]="timeChartOptions.dataLabels"
|
[dataLabels]="timeChartOptions.dataLabels"
|
||||||
[tooltip]="timeChartOptions.tooltip"
|
|
||||||
[fill]="timeChartOptions.fill"
|
[fill]="timeChartOptions.fill"
|
||||||
[series]="timeChartOptions.series"
|
[series]="timeChartOptions.series"
|
||||||
[stroke]="timeChartOptions.stroke"
|
[stroke]="timeChartOptions.stroke"
|
||||||
|
[tooltip]="timeChartOptions.tooltip"
|
||||||
[xaxis]="timeChartOptions.xaxis"
|
[xaxis]="timeChartOptions.xaxis"
|
||||||
[yaxis]="timeChartOptions.yaxis"></apx-chart>
|
[yaxis]="timeChartOptions.yaxis"></apx-chart>
|
||||||
</div>
|
</div>
|
||||||
|
@ -148,8 +148,8 @@ export class DashboardComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
this.changeDetectorRefs.detectChanges();
|
this.changeDetectorRefs.detectChanges();
|
||||||
this.map.removeTableStationMarkerOnReload();
|
this.map.removeTableStationMarkerOnReload();
|
||||||
this.selectionModel.clear();
|
|
||||||
this.route.params.subscribe(params => {
|
this.route.params.subscribe(params => {
|
||||||
|
this.selectionModel.clear();
|
||||||
this.colors = ['black', 'gray', 'green', 'orange', 'purple', 'red'];
|
this.colors = ['black', 'gray', 'green', 'orange', 'purple', 'red'];
|
||||||
this.service.fetchDashboardInit(params.id).then(data => {
|
this.service.fetchDashboardInit(params.id).then(data => {
|
||||||
this.station = data;
|
this.station = data;
|
||||||
@ -393,7 +393,7 @@ export class DashboardComponent implements OnInit {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
this.map.initDashboardMap(this.station.lat, this.station.lon, 17);
|
this.map.initDashboardMap(this.station.lat, this.station.lon, 17);
|
||||||
this.map.drawDashboardStationMarker(this.station.lat, this.station.lon);
|
this.map.drawDashboardStationMarker(this.station);
|
||||||
}
|
}
|
||||||
|
|
||||||
async onSubmit(): Promise<any> {
|
async onSubmit(): Promise<any> {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<div class="myApp">
|
<div class="myApp">
|
||||||
<mat-toolbar class="mat-toolbar" color="primary">
|
<mat-toolbar class="mat-toolbar" color="primary">
|
||||||
<span>Bike Stations in London</span>
|
<span routerLink="/">Bike Stations in London</span>
|
||||||
<span class="toolbar-spacer"></span>
|
<span class="toolbar-spacer"></span>
|
||||||
<app-auto-refresh></app-auto-refresh>
|
<app-auto-refresh></app-auto-refresh>
|
||||||
<a class="button-wiki" color="primary"
|
<a class="button-wiki" color="primary"
|
||||||
|
@ -6,6 +6,8 @@ import {HttpClient} from '@angular/common/http';
|
|||||||
import {environment} from '../../environments/environment';
|
import {environment} from '../../environments/environment';
|
||||||
import {PopUpService} from './pop-up.service';
|
import {PopUpService} from './pop-up.service';
|
||||||
import {IMapBikePoint} from './domain/map-bike-point';
|
import {IMapBikePoint} from './domain/map-bike-point';
|
||||||
|
import {Router} from '@angular/router';
|
||||||
|
import {IDashboardCommonBikePoint} from './domain/dashboard-common-bike-point';
|
||||||
|
|
||||||
|
|
||||||
const createIcon = color => L.icon({
|
const createIcon = color => L.icon({
|
||||||
@ -32,6 +34,7 @@ export class MapService {
|
|||||||
constructor(
|
constructor(
|
||||||
private client: HttpClient,
|
private client: HttpClient,
|
||||||
private popUpService: PopUpService,
|
private popUpService: PopUpService,
|
||||||
|
private router: Router
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,8 +139,10 @@ export class MapService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public drawDashboardStationMarker(lat: number, lon: number): void {
|
public drawDashboardStationMarker(station: IDashboardCommonBikePoint): void {
|
||||||
this.dashBoardMarker = L.marker([lat, lon], {icon: createIcon('blue')}).addTo(this.miniMap);
|
this.dashBoardMarker = L.marker([station.lat, station.lon], {icon: createIcon('blue')}).addTo(this.miniMap);
|
||||||
|
this.dashBoardMarker.on('mouseover', e => e.target.bindPopup(`<p>${station.commonName}</p>`).openPopup());
|
||||||
|
this.dashBoardMarker.on('mouseout', e => e.target.closePopup());
|
||||||
}
|
}
|
||||||
|
|
||||||
public removeTableStationMarkerOnReload(): void {
|
public removeTableStationMarkerOnReload(): void {
|
||||||
@ -158,6 +163,8 @@ export class MapService {
|
|||||||
}
|
}
|
||||||
for (const point of bikePoints) {
|
for (const point of bikePoints) {
|
||||||
const marker = L.marker([point.stationLat, point.stationLon], {icon: createIcon(point.color)}).addTo(this.miniMap);
|
const marker = L.marker([point.stationLat, point.stationLon], {icon: createIcon(point.color)}).addTo(this.miniMap);
|
||||||
|
marker.on('mouseover', e => e.target.bindPopup(`<p>${point.stationName}</p>`).openPopup());
|
||||||
|
marker.on('mouseout', e => e.target.closePopup());
|
||||||
this.markerLayer.push(marker);
|
this.markerLayer.push(marker);
|
||||||
this.miniMap.fitBounds(L.featureGroup([...this.markerLayer, this.dashBoardMarker]).getBounds());
|
this.miniMap.fitBounds(L.featureGroup([...this.markerLayer, this.dashBoardMarker]).getBounds());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user