- add "moment": "^2.29.1" and "chartjs-adapter-moment": "^1.0.0",
- add core module for time.service.ts - add interfaces for timespan.ts an dataset.ts
This commit is contained in:
parent
5f657dc9e4
commit
4241bd2cb9
15 changed files with 706 additions and 57 deletions
|
@ -93,4 +93,54 @@ export interface RenderingHints {
|
|||
properties: {
|
||||
color: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface DataConst extends GeomonTimeseries {
|
||||
data?: Data<TimeValueTuple>;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// export class TimeseriesData {
|
||||
// public id: string;
|
||||
// public url: string;
|
||||
// public data: FirstLastValue[];
|
||||
// }
|
||||
|
||||
export interface IDataEntry { }
|
||||
|
||||
export interface Data<T extends IDataEntry> {
|
||||
values: T[];
|
||||
referenceValues: ReferenceValues<T>;
|
||||
valueBeforeTimespan?: T;
|
||||
valueAfterTimespan?: T;
|
||||
}
|
||||
|
||||
export class ReferenceValues<T extends IDataEntry> {
|
||||
[key: string]: {
|
||||
values: T[];
|
||||
valueBeforeTimespan?: T;
|
||||
valueAfterTimespan?: T;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export type TimeValueTuple = [number, number];
|
||||
export interface GeomonData { }
|
||||
export class GeomonTimeseriesData implements GeomonData {
|
||||
|
||||
referenceValues: ReferenceValues<TimeValueTuple> = {};
|
||||
valueBeforeTimespan: TimeValueTuple;
|
||||
valueAfterTimespan: TimeValueTuple;
|
||||
|
||||
constructor(
|
||||
public values: TimeValueTuple[],
|
||||
) { }
|
||||
}
|
||||
|
||||
export interface HelgolandDataFilter {
|
||||
expanded?: boolean;
|
||||
generalize?: boolean;
|
||||
}
|
30
src/shared/models/timespan.ts
Normal file
30
src/shared/models/timespan.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
export abstract class TimeInterval {
|
||||
|
||||
}
|
||||
|
||||
export class Timespan extends TimeInterval{
|
||||
|
||||
public from: number;
|
||||
|
||||
public to: number;
|
||||
|
||||
constructor(from: number | Date, to?: number | Date) {
|
||||
super();
|
||||
this.from = from instanceof Date ? from.valueOf() : from;
|
||||
this.to = to ? (to instanceof Date ? to.valueOf() : to) : this.from;
|
||||
}
|
||||
}
|
||||
|
||||
export class BufferedTime extends TimeInterval {
|
||||
public timestamp: Date;
|
||||
public bufferInterval: number;
|
||||
|
||||
constructor(
|
||||
timestamp: Date,
|
||||
bufferInterval: number
|
||||
) {
|
||||
super();
|
||||
this.timestamp = timestamp;
|
||||
this.bufferInterval = bufferInterval;
|
||||
}
|
||||
}
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue