Commit 4aa10db7a30cfadfc2be04247b4e08214db845e6

Authored by Artem Halushko
2 parents 690784c0 0408dd16

Merge branch 'map/3.0' of https://github.com/ArtemHalushko/thingsboard into map/3.0

... ... @@ -63,9 +63,7 @@ export class TripAnimationComponent implements OnInit, AfterViewInit {
63 63 activeTrip: FormattedData;
64 64 label;
65 65 minTime: number;
66   - minTimeFormat: string;
67 66 maxTime: number;
68   - maxTimeFormat: string;
69 67 anchors: number[] = [];
70 68 useAnchors: boolean;
71 69 currentTime: number;
... ... @@ -97,14 +95,13 @@ export class TripAnimationComponent implements OnInit, AfterViewInit {
97 95 this.settings = { ...settings, ...this.ctx.settings };
98 96 this.useAnchors = this.settings.showPoints && this.settings.usePointAsAnchor;
99 97 this.settings.pointAsAnchorFunction = parseFunction(this.settings.pointAsAnchorFunction, ['data', 'dsData', 'dsIndex']);
100   - this.settings.fitMapBounds = true;
  98 + this.settings.tooltipFunction = parseFunction(this.settings.tooltipFunction, ['data', 'dsData', 'dsIndex']);
  99 + this.settings.labelFunction = parseFunction(this.settings.labelFunction, ['data', 'dsData', 'dsIndex']);
101 100 this.normalizationStep = this.settings.normalizationStep;
102 101 const subscription = this.ctx.subscriptions[Object.keys(this.ctx.subscriptions)[0]];
103 102 if (subscription) subscription.callbacks.onDataUpdated = () => {
104 103 this.historicalData = parseArray(this.ctx.data).filter(arr => arr.length);
105 104 if (this.historicalData.length) {
106   - if (!this.activeTrip)
107   - this.activeTrip = this.historicalData[0][0];
108 105 this.calculateIntervals();
109 106 this.timeUpdated(this.currentTime ? this.currentTime : this.minTime);
110 107 }
... ... @@ -167,6 +164,9 @@ export class TripAnimationComponent implements OnInit, AfterViewInit {
167 164 const maxTimeFormat = this.maxTime !== -Infinity ? moment(this.maxTime).format('YYYY-MM-DD HH:mm:ss') : '';
168 165 this.interpolatedTimeData[index] = this.interpolateArray(dataSource, minTimeFormat, maxTimeFormat);
169 166 });
  167 + if(!this.activeTrip){
  168 + this.activeTrip = this.interpolatedTimeData.map(dataSource => dataSource[this.minTime]).filter(ds => ds)[0];
  169 + }
170 170 if (this.useAnchors) {
171 171 const anchorDate = Object.entries(_.union(this.interpolatedTimeData)[0]);
172 172 this.anchors = anchorDate
... ...