- legen-entry.component: any action via buttons
- Moment.Pipe insider core/time module - dataset.service.ts: init initial timespan with current week timestamps
This commit is contained in:
parent
d6abaa0d6d
commit
799d08bd0b
11 changed files with 97 additions and 51 deletions
|
@ -23,6 +23,7 @@ import { MessageService } from "./services/message.service";
|
||||||
import { DatasetService } from "./services/dataset.service";
|
import { DatasetService } from "./services/dataset.service";
|
||||||
import { MapService } from '../common/components/services/map.service';
|
import { MapService } from '../common/components/services/map.service';
|
||||||
import { DiagramViewComponent } from './views/diagram-view/diagram-view.component';
|
import { DiagramViewComponent } from './views/diagram-view/diagram-view.component';
|
||||||
|
// import { MomentPipe } from "../common/core/time/MomentPipe";
|
||||||
// import { LocateService } from '@helgoland/map';
|
// import { LocateService } from '@helgoland/map';
|
||||||
// import { MapCache } from '@helgoland/map';
|
// import { MapCache } from '@helgoland/map';
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@ import {MatBadgeModule} from '@angular/material/badge';
|
||||||
import { TimeService } from '../common/core/time/time.service';
|
import { TimeService } from '../common/core/time/time.service';
|
||||||
import { InternalIdHandler } from '../common/components/services/internal-id-handler.service';
|
import { InternalIdHandler } from '../common/components/services/internal-id-handler.service';
|
||||||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||||
|
import { CoreModule } from "../common/core/core.module";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
// declarations: The components, directives, and pipes that belong to this NgModule.
|
// declarations: The components, directives, and pipes that belong to this NgModule.
|
||||||
|
@ -47,7 +49,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||||
// imports: Other modules whose exported classes are needed by component templates declared in this NgModule.
|
// imports: Other modules whose exported classes are needed by component templates declared in this NgModule.
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule, HttpClientModule, AppRoutingModule, ComponentsModule, GraphjsModule, BrowserAnimationsModule, MatDialogModule, MatListModule, MatBadgeModule,
|
BrowserModule, HttpClientModule, AppRoutingModule, ComponentsModule, GraphjsModule, BrowserAnimationsModule, MatDialogModule, MatListModule, MatBadgeModule,
|
||||||
FontAwesomeModule],
|
FontAwesomeModule, CoreModule],
|
||||||
providers: [
|
providers: [
|
||||||
MarkerService, PopupService, HttpService, DatasetApiService, StationService, MessageService, MapService,DatasetService, InternalIdHandler, TimeService
|
MarkerService, PopupService, HttpService, DatasetApiService, StationService, MessageService, MapService,DatasetService, InternalIdHandler, TimeService
|
||||||
|
|
||||||
|
|
|
@ -32,41 +32,43 @@
|
||||||
<div class="small-label">
|
<div class="small-label">
|
||||||
<label>Sensor: {{procedureLabel}}</label>
|
<label>Sensor: {{procedureLabel}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="small-label" *ngIf="categoryLabel != phenomenonLabel">
|
<!-- <div class="small-label" *ngIf="categoryLabel != phenomenonLabel">
|
||||||
<label>{{categoryLabel}}</label>
|
<label>{{categoryLabel}}</label>
|
||||||
</div>
|
</div> -->
|
||||||
<div class="legendicons">
|
<div class="legendicons">
|
||||||
<!-- <span class="fa" [ngClass]="{'fa-eye-slash': datasetOption?.visible, 'fa-eye': !datasetOption?.visible}" (click)="toggleVisibility(); $event.stopPropagation();"></span> -->
|
|
||||||
<!-- <fa-icon [icon]="datasetOption?.visible ? faEye : faEyeSlash"
|
|
||||||
(click)="toggleVisibility(); $event.stopPropagation();"></fa-icon> -->
|
|
||||||
|
|
||||||
<label class="is-checkbox is-small is-info" (click)="$event.stopPropagation();">
|
<label class="is-checkbox is-small is-info" (click)="$event.stopPropagation();">
|
||||||
<input type="checkbox" [checked]="datasetOption.visible" (change)="toggleVisibility(); $event.stopPropagation();">
|
<input type="checkbox" [checked]="datasetOption.visible" (change)="toggleVisibility(); $event.stopPropagation();">
|
||||||
<span>Visibility</span>
|
<span>Visibility</span>
|
||||||
|
|
||||||
<span class="icon checkmark">
|
<span class="icon checkmark">
|
||||||
<!-- <fa-icon [icon]="faCheck"></fa-icon> -->
|
|
||||||
<fa-icon [icon]="datasetOption?.visible ? faCheck : faTimes"></fa-icon>
|
<fa-icon [icon]="datasetOption?.visible ? faCheck : faTimes"></fa-icon>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="collapseLegendEntry small-label">
|
<div class="collapseLegendEntry small-label">
|
||||||
|
|
||||||
<div class="firstLastEntry additionalLegendEntry" *ngIf="firstValue"
|
<div class="firstLastEntry additionalLegendEntry" *ngIf="firstValue"
|
||||||
(click)="jumpToFirstTimeStamp(); $event.stopPropagation();">
|
(click)="jumpToFirstTimeStamp(); $event.stopPropagation();">
|
||||||
<fa-icon [icon]="faChevronRight"></fa-icon>
|
<a href="#" class="button is-small is-light" (click)="$event.preventDefault();jumpToFirstTimeStamp(); $event.stopPropagation();">
|
||||||
<span>Erster Wert bei </span>
|
<fa-icon [icon]="faChevronRight"></fa-icon>
|
||||||
<span>{{ firstValue.timestamp }}</span>
|
<span>Erster Wert bei </span>
|
||||||
<span class="hidden-medium">({{ firstValue.value }} {{uom}})</span>
|
<span>{{ firstValue.timestamp | dateFormat: 'DD.MM.YYYY h:mm' }}</span>
|
||||||
|
<span class="hidden-medium">({{ firstValue.value }} {{uom}})</span>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="firstLastEntry additionalLegendEntry" *ngIf="lastValue"
|
<div class="firstLastEntry additionalLegendEntry" *ngIf="lastValue">
|
||||||
(click)="jumpToLastTimeStamp(); $event.stopPropagation();">
|
<a href="#" class="button is-small is-light" (click)="$event.preventDefault();jumpToLastTimeStamp(); $event.stopPropagation();">
|
||||||
<fa-icon [icon]="faChevronRight"></fa-icon>
|
<fa-icon [icon]="faChevronRight"></fa-icon>
|
||||||
<span>Letzter Wert bei</span>
|
<span>Letzter Wert bei </span>
|
||||||
<span>{{lastValue.timestamp }}</span>
|
<span>{{lastValue.timestamp | dateFormat: 'DD.MM.YYYY h:mm' }}</span>
|
||||||
<span class="hidden-medium">({{lastValue.value}} {{uom}})</span>
|
<span class="hidden-medium">({{lastValue.value}} {{uom}})</span>
|
||||||
|
</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.additionalLegendEntry {
|
.additionalLegendEntry {
|
||||||
|
margin-top: 10px;
|
||||||
|
width: 100%;
|
||||||
&:hover {
|
&:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
||||||
|
|
||||||
|
|
||||||
import { GeomonTimeseries, DatasetFilter, DatasetType } from '../../../shared/models/dataset';
|
import { GeomonTimeseries, DatasetFilter } from '../../../shared/models/dataset';
|
||||||
import { TimeInterval } from '../../../shared/models/timespan';
|
import { TimeInterval } from '../../../shared/models/timespan';
|
||||||
import { DatasetApiService } from '../../services/dataset-api.service';
|
import { DatasetApiService } from '../../services/dataset-api.service';
|
||||||
import { InternalIdHandler, InternalDatasetId } from '../../../common/components/services/internal-id-handler.service';
|
import { InternalIdHandler, InternalDatasetId } from '../../../common/components/services/internal-id-handler.service';
|
||||||
|
@ -144,7 +144,7 @@ export class LegendEntryComponent {
|
||||||
|
|
||||||
// private checkDataInTimespan() {
|
// private checkDataInTimespan() {
|
||||||
// if (this.timeInterval && this.dataset && this.dataset.firstValue && this.dataset.lastValue) {
|
// if (this.timeInterval && this.dataset && this.dataset.firstValue && this.dataset.lastValue) {
|
||||||
// this.hasData = this.timeSrvc.overlaps(
|
// this.hasData = this.timeService.overlaps(
|
||||||
// this.timeInterval,
|
// this.timeInterval,
|
||||||
// this.dataset.firstValue.timestamp,
|
// this.dataset.firstValue.timestamp,
|
||||||
// this.dataset.lastValue.timestamp
|
// this.dataset.lastValue.timestamp
|
||||||
|
|
|
@ -98,8 +98,12 @@ export class DatasetService<T extends DatasetOptions> {
|
||||||
|
|
||||||
private initTimespan() {
|
private initTimespan() {
|
||||||
if (!this._timespan) {
|
if (!this._timespan) {
|
||||||
this._timespan = new Timespan(1323239694000, 1323844494000);
|
// this._timespan = new Timespan(1323239694000, 1323844494000);
|
||||||
//this.timeService.createByDurationWithEnd(moment.duration(1, 'days'), new Date(2011, 9), 'day');
|
// //this.timeService.createByDurationWithEnd(moment.duration(1, 'days'), new Date(2011, 9), 'day');
|
||||||
|
const today = moment();
|
||||||
|
const from_date = today.startOf('isoWeek').toDate();
|
||||||
|
const to_date = today.endOf('isoWeek').toDate();
|
||||||
|
this._timespan = new Timespan(from_date, to_date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ export class DiagramViewComponent implements OnInit {
|
||||||
public selectedIds: string[] = [];
|
public selectedIds: string[] = [];
|
||||||
|
|
||||||
public datasetOptions: Map<string, DatasetOptions> = new Map();
|
public datasetOptions: Map<string, DatasetOptions> = new Map();
|
||||||
public datasetArray: Array <DatasetOptions>;
|
public datasetArray: Array<DatasetOptions>;
|
||||||
|
|
||||||
public diagramLoading: boolean;
|
public diagramLoading: boolean;
|
||||||
public overviewLoading: boolean;
|
public overviewLoading: boolean;
|
||||||
|
@ -37,9 +37,6 @@ export class DiagramViewComponent implements OnInit {
|
||||||
private timeService: TimeService) { }
|
private timeService: TimeService) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
// this.createSvg();
|
|
||||||
// this.drawBars(this.data);
|
|
||||||
|
|
||||||
this.setDatasets();
|
this.setDatasets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,15 +56,15 @@ export class DiagramViewComponent implements OnInit {
|
||||||
|
|
||||||
public onSelectDataset(selected: boolean, internalId: string) {
|
public onSelectDataset(selected: boolean, internalId: string) {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
this.selectedIds.push(internalId);
|
this.selectedIds.push(internalId);
|
||||||
} else {
|
} else {
|
||||||
this.selectedIds.splice(this.selectedIds.findIndex(entry => entry === internalId), 1);
|
this.selectedIds.splice(this.selectedIds.findIndex(entry => entry === internalId), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public clearSelection() {
|
public clearSelection() {
|
||||||
this.selectedIds = [];
|
this.selectedIds = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public onUpdateOptions(datasetOption: DatasetOptions, internalId: string) {
|
public onUpdateOptions(datasetOption: DatasetOptions, internalId: string) {
|
||||||
// this.datasetService.updateDatasetOptions(datasetOption, internalId);
|
// this.datasetService.updateDatasetOptions(datasetOption, internalId);
|
||||||
|
@ -81,7 +78,7 @@ export class DiagramViewComponent implements OnInit {
|
||||||
|
|
||||||
public jumpToDate(date: Date) {
|
public jumpToDate(date: Date) {
|
||||||
this.datasetService.timespan = this.timeService.centerTimespan(this.datasetService.timespan, date);
|
this.datasetService.timespan = this.timeService.centerTimespan(this.datasetService.timespan, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import { MomentPipe } from './time/moment-pipe';
|
||||||
import { DatasetApiService } from '../../app/services/dataset-api.service';
|
import { DatasetApiService } from '../../app/services/dataset-api.service';
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,8 +10,10 @@ import { DatasetApiService } from '../../app/services/dataset-api.service';
|
||||||
CommonModule
|
CommonModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
|
MomentPipe
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
|
MomentPipe
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
]
|
]
|
||||||
|
|
15
src/common/core/time/moment-pipe.ts
Normal file
15
src/common/core/time/moment-pipe.ts
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import { Pipe, PipeTransform } from '@angular/core';
|
||||||
|
import * as moment from 'moment';
|
||||||
|
|
||||||
|
@Pipe({ name: 'dateFormat' })
|
||||||
|
export class MomentPipe implements PipeTransform {
|
||||||
|
|
||||||
|
transform(date: Date | moment.Moment | number | string, dateFormat: string): any {
|
||||||
|
if (typeof (date) === 'number') { date = moment(date); }
|
||||||
|
if (typeof (date) === 'string') { date = moment(date); }
|
||||||
|
if (date instanceof Date) { date = moment(date); }
|
||||||
|
|
||||||
|
if (!dateFormat) { dateFormat = 'L LT z'; }
|
||||||
|
return moment(date).format(dateFormat);
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,9 +16,9 @@ import * as moment from 'moment';
|
||||||
import { TimeValueTuple, Data } from '../../../shared/models/dataset';
|
import { TimeValueTuple, Data } from '../../../shared/models/dataset';
|
||||||
import 'chartjs-adapter-moment';
|
import 'chartjs-adapter-moment';
|
||||||
|
|
||||||
import zoomPlugin from 'chartjs-plugin-zoom';
|
// import zoomPlugin from 'chartjs-plugin-zoom';
|
||||||
|
// Chart.register(zoomPlugin);
|
||||||
|
|
||||||
Chart.register(zoomPlugin);
|
|
||||||
import { InternalIdHandler, InternalDatasetId } from '../../../common/components/services/internal-id-handler.service';
|
import { InternalIdHandler, InternalDatasetId } from '../../../common/components/services/internal-id-handler.service';
|
||||||
|
|
||||||
import { DataEntry, InternalDataEntry } from '../../../shared/models/chart';
|
import { DataEntry, InternalDataEntry } from '../../../shared/models/chart';
|
||||||
|
@ -97,7 +97,7 @@ export class GeomonTimeseriesChartComponent implements AfterViewInit, DoCheck {
|
||||||
// siehe https://www.concretepage.com/angular/angular-keyvaluediffers
|
// siehe https://www.concretepage.com/angular/angular-keyvaluediffers
|
||||||
empDifferMap = new Map<string, any>();
|
empDifferMap = new Map<string, any>();
|
||||||
empMap = new Map<string, DatasetOptions>();
|
empMap = new Map<string, DatasetOptions>();
|
||||||
private arrayDiffer: any;
|
// private arrayDiffer: any;
|
||||||
changeLogs: string[] = [];
|
changeLogs: string[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -586,20 +586,20 @@ export class GeomonTimeseriesChartComponent implements AfterViewInit, DoCheck {
|
||||||
responsive: true,
|
responsive: true,
|
||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
plugins: {
|
plugins: {
|
||||||
zoom: {
|
// zoom: {
|
||||||
pan: {
|
// pan: {
|
||||||
enabled: true
|
// enabled: true
|
||||||
},
|
// },
|
||||||
// zoom: {
|
// // zoom: {
|
||||||
// wheel: {
|
// // wheel: {
|
||||||
// enabled: true,
|
// // enabled: true,
|
||||||
// },
|
// // },
|
||||||
// pinch: {
|
// // pinch: {
|
||||||
// enabled: true
|
// // enabled: true
|
||||||
// },
|
// // },
|
||||||
// mode: 'xy',
|
// // mode: 'xy',
|
||||||
// }
|
// // }
|
||||||
},
|
// },
|
||||||
legend: {
|
legend: {
|
||||||
display: false
|
display: false
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
|
import * as moment from "moment";
|
||||||
|
|
||||||
export abstract class TimeInterval {
|
export abstract class TimeInterval {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Timespan extends TimeInterval{
|
export class Timespan extends TimeInterval {
|
||||||
|
|
||||||
public from: number;
|
public from: number;
|
||||||
|
|
||||||
|
@ -13,6 +15,14 @@ export class Timespan extends TimeInterval{
|
||||||
this.from = from instanceof Date ? from.valueOf() : from;
|
this.from = from instanceof Date ? from.valueOf() : from;
|
||||||
this.to = to ? (to instanceof Date ? to.valueOf() : to) : this.from;
|
this.to = to ? (to instanceof Date ? to.valueOf() : to) : this.from;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get fromDate(): string {
|
||||||
|
return moment(this.from).format('DD.MM.YYYY h:mm');
|
||||||
|
}
|
||||||
|
|
||||||
|
get toDate(): string {
|
||||||
|
return moment(this.to).format('DD.MM.YYYY h:mm');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BufferedTime extends TimeInterval {
|
export class BufferedTime extends TimeInterval {
|
||||||
|
|
|
@ -140,6 +140,18 @@ ul {
|
||||||
left: 30px;
|
left: 30px;
|
||||||
right: 30px;
|
right: 30px;
|
||||||
}
|
}
|
||||||
|
@media only screen and (max-width:768px) {
|
||||||
|
.mapDesktop {
|
||||||
|
bottom: 0px;
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
right: 0px;
|
||||||
|
}
|
||||||
|
.canvas-area.column {
|
||||||
|
padding: 0%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.locate-control button{
|
.locate-control button{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
Loading…
Add table
Reference in a new issue