diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 6c2faf1..402096d 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -23,6 +23,7 @@ import { MessageService } from "./services/message.service"; import { DatasetService } from "./services/dataset.service"; import { MapService } from '../common/components/services/map.service'; import { DiagramViewComponent } from './views/diagram-view/diagram-view.component'; +// import { MomentPipe } from "../common/core/time/MomentPipe"; // import { LocateService } 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 { InternalIdHandler } from '../common/components/services/internal-id-handler.service'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; +import { CoreModule } from "../common/core/core.module"; @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: [ BrowserModule, HttpClientModule, AppRoutingModule, ComponentsModule, GraphjsModule, BrowserAnimationsModule, MatDialogModule, MatListModule, MatBadgeModule, - FontAwesomeModule], + FontAwesomeModule, CoreModule], providers: [ MarkerService, PopupService, HttpService, DatasetApiService, StationService, MessageService, MapService,DatasetService, InternalIdHandler, TimeService diff --git a/src/app/components/legend-entry/legend-entry.component.html b/src/app/components/legend-entry/legend-entry.component.html index 0203326..2e6f442 100644 --- a/src/app/components/legend-entry/legend-entry.component.html +++ b/src/app/components/legend-entry/legend-entry.component.html @@ -32,41 +32,43 @@
-
+ - +
--> +
+
- - Erster Wert bei - {{ firstValue.timestamp }} - ({{ firstValue.value }} {{uom}}) + + + Erster Wert bei + {{ firstValue.timestamp | dateFormat: 'DD.MM.YYYY h:mm' }} + ({{ firstValue.value }} {{uom}}) +
-
- - Letzter Wert bei - {{lastValue.timestamp }} - ({{lastValue.value}} {{uom}}) + +
diff --git a/src/app/components/legend-entry/legend-entry.component.scss b/src/app/components/legend-entry/legend-entry.component.scss index 68e494f..c592b16 100644 --- a/src/app/components/legend-entry/legend-entry.component.scss +++ b/src/app/components/legend-entry/legend-entry.component.scss @@ -39,6 +39,8 @@ } } .additionalLegendEntry { + margin-top: 10px; + width: 100%; &:hover { cursor: pointer; } diff --git a/src/app/components/legend-entry/legend-entry.component.ts b/src/app/components/legend-entry/legend-entry.component.ts index 5213540..4cc1e5b 100644 --- a/src/app/components/legend-entry/legend-entry.component.ts +++ b/src/app/components/legend-entry/legend-entry.component.ts @@ -1,7 +1,7 @@ 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 { DatasetApiService } from '../../services/dataset-api.service'; import { InternalIdHandler, InternalDatasetId } from '../../../common/components/services/internal-id-handler.service'; @@ -144,7 +144,7 @@ export class LegendEntryComponent { // private checkDataInTimespan() { // if (this.timeInterval && this.dataset && this.dataset.firstValue && this.dataset.lastValue) { - // this.hasData = this.timeSrvc.overlaps( + // this.hasData = this.timeService.overlaps( // this.timeInterval, // this.dataset.firstValue.timestamp, // this.dataset.lastValue.timestamp diff --git a/src/app/services/dataset.service.ts b/src/app/services/dataset.service.ts index e3c3795..5a17389 100644 --- a/src/app/services/dataset.service.ts +++ b/src/app/services/dataset.service.ts @@ -98,8 +98,12 @@ export class DatasetService { private initTimespan() { if (!this._timespan) { - this._timespan = new Timespan(1323239694000, 1323844494000); - //this.timeService.createByDurationWithEnd(moment.duration(1, 'days'), new Date(2011, 9), 'day'); + // this._timespan = new Timespan(1323239694000, 1323844494000); + // //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); } } diff --git a/src/app/views/diagram-view/diagram-view.component.ts b/src/app/views/diagram-view/diagram-view.component.ts index dcb8ccc..642c800 100644 --- a/src/app/views/diagram-view/diagram-view.component.ts +++ b/src/app/views/diagram-view/diagram-view.component.ts @@ -19,7 +19,7 @@ export class DiagramViewComponent implements OnInit { public selectedIds: string[] = []; public datasetOptions: Map = new Map(); - public datasetArray: Array ; + public datasetArray: Array; public diagramLoading: boolean; public overviewLoading: boolean; @@ -37,9 +37,6 @@ export class DiagramViewComponent implements OnInit { private timeService: TimeService) { } ngOnInit(): void { - // this.createSvg(); - // this.drawBars(this.data); - this.setDatasets(); } @@ -59,15 +56,15 @@ export class DiagramViewComponent implements OnInit { public onSelectDataset(selected: boolean, internalId: string) { if (selected) { - this.selectedIds.push(internalId); + this.selectedIds.push(internalId); } else { - this.selectedIds.splice(this.selectedIds.findIndex(entry => entry === internalId), 1); + this.selectedIds.splice(this.selectedIds.findIndex(entry => entry === internalId), 1); } } public clearSelection() { this.selectedIds = []; - } + } public onUpdateOptions(datasetOption: DatasetOptions, internalId: string) { // this.datasetService.updateDatasetOptions(datasetOption, internalId); @@ -81,7 +78,7 @@ export class DiagramViewComponent implements OnInit { public jumpToDate(date: Date) { this.datasetService.timespan = this.timeService.centerTimespan(this.datasetService.timespan, date); - } - + } + } diff --git a/src/common/core/core.module.ts b/src/common/core/core.module.ts index b5b5929..e6c0181 100644 --- a/src/common/core/core.module.ts +++ b/src/common/core/core.module.ts @@ -1,7 +1,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; - +import { MomentPipe } from './time/moment-pipe'; import { DatasetApiService } from '../../app/services/dataset-api.service'; @@ -10,8 +10,10 @@ import { DatasetApiService } from '../../app/services/dataset-api.service'; CommonModule ], declarations: [ + MomentPipe ], exports: [ + MomentPipe ], providers: [ ] diff --git a/src/common/core/time/moment-pipe.ts b/src/common/core/time/moment-pipe.ts new file mode 100644 index 0000000..9ca20b8 --- /dev/null +++ b/src/common/core/time/moment-pipe.ts @@ -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); + } +} \ No newline at end of file diff --git a/src/common/graphjs/geomon-timeseries-chart/geomon-timeseries-chart.component.ts b/src/common/graphjs/geomon-timeseries-chart/geomon-timeseries-chart.component.ts index 09ab48b..95cfcb9 100644 --- a/src/common/graphjs/geomon-timeseries-chart/geomon-timeseries-chart.component.ts +++ b/src/common/graphjs/geomon-timeseries-chart/geomon-timeseries-chart.component.ts @@ -16,9 +16,9 @@ import * as moment from 'moment'; import { TimeValueTuple, Data } from '../../../shared/models/dataset'; 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 { DataEntry, InternalDataEntry } from '../../../shared/models/chart'; @@ -97,7 +97,7 @@ export class GeomonTimeseriesChartComponent implements AfterViewInit, DoCheck { // siehe https://www.concretepage.com/angular/angular-keyvaluediffers empDifferMap = new Map(); empMap = new Map(); - private arrayDiffer: any; + // private arrayDiffer: any; changeLogs: string[] = []; constructor( @@ -586,20 +586,20 @@ export class GeomonTimeseriesChartComponent implements AfterViewInit, DoCheck { responsive: true, maintainAspectRatio: false, plugins: { - zoom: { - pan: { - enabled: true - }, - // zoom: { - // wheel: { - // enabled: true, - // }, - // pinch: { - // enabled: true - // }, - // mode: 'xy', - // } - }, + // zoom: { + // pan: { + // enabled: true + // }, + // // zoom: { + // // wheel: { + // // enabled: true, + // // }, + // // pinch: { + // // enabled: true + // // }, + // // mode: 'xy', + // // } + // }, legend: { display: false } diff --git a/src/shared/models/timespan.ts b/src/shared/models/timespan.ts index 3ac7159..e77bf47 100644 --- a/src/shared/models/timespan.ts +++ b/src/shared/models/timespan.ts @@ -1,8 +1,10 @@ +import * as moment from "moment"; + export abstract class TimeInterval { } -export class Timespan extends TimeInterval{ +export class Timespan extends TimeInterval { public from: number; @@ -13,6 +15,14 @@ export class Timespan extends TimeInterval{ this.from = from instanceof Date ? from.valueOf() : 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 { diff --git a/src/styles.scss b/src/styles.scss index de33c18..9c6c943 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -140,6 +140,18 @@ ul { left: 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{ position: absolute;