Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 11efc186

Přidáno uživatelem Jakub Hlaváč před téměř 4 roky(ů)

Re #8792 - Sensor page - tweak

+ form and to input fields
  • show aggregation input for analytics endpoint

Zobrazit rozdíly:

src/app/auth/interceptors/auth.interceptor.ts
28 28
      return of(null);
29 29
    }
30 30

  
31
    if (request.url.includes('DataService') || request.url.includes('GroupService')){
31
    if (request.url.includes('DataService') || request.url.includes('GroupService') || request.url.includes('SensorService')){
32 32
      request = request.clone({
33 33
        setParams: {
34 34
          user: localStorage.getItem(GlobalVariable.USER_NAME)
src/app/sensor/components/sensor.component.html
5 5
Unit ID {{unitId}}
6 6
<br>
7 7

  
8
<div class="row">
9
  <div class="col">
10
    <p-calendar [style]="{'width':'100%'}" [inputStyle]="{'width':'100%'}" [(ngModel)]="rangeDates" selectionMode="range" [showTime]="true" [numberOfMonths]="3" (onSelect)="showGraph()"></p-calendar>
8
<div class="col">
9
  <div class="input-group form-group">
10
    <div class="input-group-prepend">
11
      <span class="input-group-text">From</span>
12
    </div>
13
    <p-calendar [style]="{'width':'100%'}" [inputStyle]="{'width':'100%'}" [(ngModel)]="from" [showTime]="true" (onSelect)="showGraph()" [maxDate]="today"></p-calendar>
11 14
  </div>
12
  <div class="col">
13
    <p-listbox [options]="aggregationFunction" [(ngModel)]="selectedAggregationFunction" optionLabel="name" optionValue="code" (onClick)="showGraph()"></p-listbox>
15
</div>
16
<div class="col">
17
  <div class="input-group form-group">
18
    <div class="input-group-prepend">
19
      <span class="input-group-text">To</span>
20
    </div>
21
    <p-calendar [style]="{'width':'100%'}" [inputStyle]="{'width':'100%'}" [(ngModel)]="to" [showTime]="true" (onSelect)="showGraph()" [maxDate]="today"></p-calendar>
22
  </div>
23
</div>
24
<div *ngIf="showAggregation" class="col">
25
  <div class="input-group form-group">
26
    <div class="input-group-prepend">
27
      <span class="input-group-text">Aggregation</span>
28
    </div>
29
    <p-listbox [options]="aggregationFunction" [(ngModel)]="selectedAggregationFunction" optionLabel="name" optionValue="code" (onClick)="showGraph()" ></p-listbox>
14 30
  </div>
15 31
</div>
16 32

  
17 33
<div id="view"></div>
18

  
19
<div *ngFor="let observation of observations">
20
  {{ observation | json}}
21
  <br>
22
</div>
src/app/sensor/components/sensor.component.ts
1
import { Component, OnInit } from '@angular/core';
1
import {Component, OnInit} from '@angular/core';
2 2
import {ActivatedRoute} from '@angular/router';
3 3
import {Observation} from '../../shared/api/endpoints/models/observation';
4 4
import * as moment from 'moment-timezone';
5 5
import {AnalyticsService} from '../../shared/api/endpoints/services/analytics.service';
6 6
import {AggreationModel} from '../../shared/models/aggreation.model';
7
import {GraphLoader} from "../../shared/graph-loading/graphloader";
7
import {GraphLoader} from '../../shared/graph-loading/graphloader';
8
import {ObservationService} from '../../shared/api/endpoints/services/observation.service';
8 9

  
9
declare var require: any
10
declare var require: any;
10 11

  
11 12
@Component({
12 13
  selector: 'app-sensor',
......
20 21
  observations: Observation[];
21 22
  data = [];
22 23
  time = [];
23
  rangeDates: Date[];
24
  from: Date;
25
  to: Date;
26
  today: Date;
27
  showAggregation = false;
24 28
  aggregationFunction: AggreationModel[];
25
  selectedAggregationFunction: string;
29
  selectedAggregationFunction = 'HOUR';
26 30

  
27 31
  constructor(
28 32
    private activatedRoute: ActivatedRoute,
29
    private analyticsService: AnalyticsService
33
    private analyticsService: AnalyticsService,
34
    private observationService: ObservationService
30 35
  ) {
31 36
    this.sensorId = parseInt(this.activatedRoute.snapshot.paramMap.get('sensorId'), 10);
32 37
    this.unitId = parseInt(this.activatedRoute.snapshot.paramMap.get('unitId'), 10);
......
36 41
      {name: 'Month', code: 'MONTH'},
37 42
      {name: 'Year', code: 'YEAR'}
38 43
    ];
44
    this.today = moment().toDate();
39 45
  }
40 46

  
41 47
  ngOnInit(): void {
42 48
    this.showGraph();
43 49
  }
44 50

  
51
  showGraph() {
52
    let agg = 'HOUR';
53
    const range: Date[] = [moment().subtract(7, 'days').toDate(), moment().toDate()];
45 54

  
46
  /*getGraph(sensorId, data, interval) {
47
    let spec = this.getGraphType(sensorId);
48
    const vega = require('vega');
49
    const vegaTooltip = require('vega-tooltip');
50
    const config = require('/src/vega/config.json');
51

  
52
    spec.data[0].values = data;
53
    spec.signals[0].value = interval;
54

  
55

  
56
    const handler = new vegaTooltip.Handler();
57

  
58
    const loc = vega.locale({
59
      decimal: ',',
60
      thousands: '\u00a0',
61
      grouping: [3],
62
      currency: ['', '\u00a0Kč']
63
    },{
64
      dateTime: '%A,%e.%B %Y, %X',
65
      date: '%-d.%-m.%Y',
66
      time: '%H:%M:%S',
67
      periods: ['AM', 'PM'],
68
      days: ['neděle', 'pondělí', 'úterý', 'středa', 'čvrtek', 'pátek', 'sobota'],
69
      shortDays: ['ne.', 'po.', 'út.', 'st.', 'čt.', 'pá.', 'so.'],
70
      months: ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'],
71
      shortMonths: ['led', 'úno', 'břez', 'dub', 'kvě', 'čer', 'červ', 'srp', 'zář', 'říj', 'list', 'pros']
72
    });
73

  
74
    let view = new vega.View(vega.parse(spec, config))
75
      .tooltip(handler.call)
76
      .initialize('#view')
77
      .hover()
78
      .locale(loc)
79
      .runAsync();
80

  
81

  
82

  
83
  }
84

  
85
  getGraphType(sensorId) {
86
    const lodash = require('lodash/object');
87

  
88
    if(sensorId >= 480000000 && sensorId < 490000000) {
89

  
90
      let base = require('/src/vega/base/default.json');
91
      let chart = require('/src/vega/body/barchart.json');
92
      let tooltip = require('/src/vega/tooltip/samm-tooltip.json')
93
      return lodash.merge(base, chart, tooltip);
94

  
95
    } else if((sensorId >= 470020000 && sensorId <  470030000) || (sensorId >=470060000 && sensorId < 470090000) ||
96
      (sensorId >= 470130000 && sensorId < 470140000) || (sensorId >=470180000 && sensorId < 470190000)) {
97

  
98
      let base = require('/src/vega/base/default.json');
99
      let chart = require('/src/vega/body/windchart.json');
100
      let tooltip = require('/src/vega/tooltip/samm-tooltip.json')
101
      return lodash.merge(base, chart, tooltip);
102

  
103
    } else {
104

  
105
      let base = require('/src/vega/base/default.json');
106
      let chart = require('/src/vega/body/linechart.json');
107
      let tooltip = require('/src/vega/tooltip/samm-tooltip.json')
108
      return lodash.merge(base, chart, tooltip);
55
    if (this.from && this.to) {
56
      range[0] = this.from;
57
      range[1] = this.to;
109 58

  
59
      if (moment(this.to).diff(moment(this.from), 'days') > 7) {
60
        this.showAggregation = true;
61
      }
110 62
    }
111 63

  
112

  
113
  }*/
114

  
115
  showGraph() {
116
    let agg = 'HOUR';
117
    let range: Date[] = [moment().subtract(9, 'months').toDate(), moment().toDate()];
118
   // const vega = require('vega');
119
   // const spec = require('/src/vega/data.json');
120 64
/*    this.observationService.getObservation({
121 65
      unit_id: this.unitId,
122 66
      sensor_id: this.sensorId,
123
      from: '2020-01-01 00:00:00+02',
124
      to: '2021-01-01 00:00:00+02'
67
      from: moment(range[0]).format('yyyy-MM-DD HH:mm:ssZ').slice(0, -3),
68
      to: moment(range[1]).format('yyyy-MM-DD HH:mm:ssZ').slice(0, -3)
125 69
    }).subscribe(
126 70
      observations => {
127
        spec.data[0].values = observations;
128

  
129
        const view = new vega.View(vega.parse(spec), {
130
          renderer: 'canvas',
131
          container: '#view',
132
          hover: 'true'}).runAsync();
133

  
134
      }*/
71
        if (observations) {
72
          // this.getGraph(this.sensorId, observations, 1800);
73
        }
74
      });*/
135 75

  
136 76
    if (this.selectedAggregationFunction) {
137 77
      agg = this.selectedAggregationFunction;
138 78
    }
139 79

  
140
    if (this.rangeDates) {
141
      range = this.rangeDates;
142
    }
143

  
144
    this.analyticsService.getAnalytics({unit_id: this.unitId, sensor_id: this.sensorId,
80
    this.analyticsService.getAnalytics({
81
      unit_id: this.unitId, sensor_id: this.sensorId,
145 82
      from: moment(range[0]).format('yyyy-MM-DD HH:mm:ssZ').slice(0, -3),
146
      to: moment(range[1]).format('yyyy-MM-DD HH:mm:ssZ').slice(0, -3), interval: agg}).subscribe(
83
      to: moment(range[1]).format('yyyy-MM-DD HH:mm:ssZ').slice(0, -3), interval: agg
84
    }).subscribe(
147 85
      observations => {
148
        if (observations){
149
          GraphLoader.getGraph(this.sensorId, observations[this.sensorId].data, observations[this.sensorId].interval, "view");
86
        if (observations) {
87
          GraphLoader.getGraph(this.sensorId, observations[this.sensorId].data, observations[this.sensorId].interval, '#view');
150 88
        } else {
151
          // TODO observace null
89
          GraphLoader.getGraph(null, null, null, null);
152 90
        }
153

  
154

  
155 91
      }
156
    )
157

  
92
    );
158 93

  
159 94
  }
160 95
}
src/app/shared/api/endpoints/api.module.ts
6 6

  
7 7
import { LoginService } from './services/login.service';
8 8
import { AdministrationService } from './services/administration.service';
9
import { ObservationService } from './services/observation.service';
9 10
import { GroupService } from './services/group.service';
10 11
import { DataService } from './services/data.service';
11 12
import { AnalyticsService } from './services/analytics.service';
......
22 23
  providers: [
23 24
    LoginService,
24 25
    AdministrationService,
26
    ObservationService,
25 27
    GroupService,
26 28
    DataService,
27 29
    AnalyticsService,
src/app/shared/api/endpoints/models.ts
19 19
export { Data } from './models/data';
20 20
export { Observation } from './models/observation';
21 21
export { Statistics } from './models/statistics';
22
export { OldObservation } from './models/old-observation';
src/app/shared/api/endpoints/models/old-observation.ts
1
/* tslint:disable */
2
/* eslint-disable */
3
export interface OldObservation {
4
  gid?: number;
5
  time?: string;
6
  value?: number;
7
}
src/app/shared/api/endpoints/services.ts
1 1
export { LoginService } from './services/login.service';
2 2
export { AdministrationService } from './services/administration.service';
3
export { ObservationService } from './services/observation.service';
3 4
export { GroupService } from './services/group.service';
4 5
export { DataService } from './services/data.service';
5 6
export { AnalyticsService } from './services/analytics.service';
src/app/shared/api/endpoints/services/observation.service.ts
1
/* tslint:disable */
2
/* eslint-disable */
3
import { Injectable } from '@angular/core';
4
import { HttpClient, HttpResponse } from '@angular/common/http';
5
import { BaseService } from '../base-service';
6
import { ApiConfiguration } from '../api-configuration';
7
import { StrictHttpResponse } from '../strict-http-response';
8
import { RequestBuilder } from '../request-builder';
9
import { Observable } from 'rxjs';
10
import { map, filter } from 'rxjs/operators';
11

  
12
import { OldObservation } from '../models/old-observation';
13

  
14

  
15
/**
16
 * Observations endpoints
17
 */
18
@Injectable({
19
  providedIn: 'root',
20
})
21
export class ObservationService extends BaseService {
22
  constructor(
23
    config: ApiConfiguration,
24
    http: HttpClient
25
  ) {
26
    super(config, http);
27
  }
28

  
29
  /**
30
   * Path part for operation getObservation
31
   */
32
  static readonly GetObservationPath = '/senslog1/SensorService?Operation=GetObservations';
33

  
34
  /**
35
   * Get observation.
36
   *
37
   *
38
   *
39
   * This method provides access to the full `HttpResponse`, allowing access to response headers.
40
   * To access only the response body, use `getObservation()` instead.
41
   *
42
   * This method doesn't expect any request body.
43
   */
44
  getObservation$Response(params: {
45
    unit_id: number;
46
    sensor_id: number;
47
    from?: string;
48
    to?: string;
49
  }): Observable<StrictHttpResponse<Array<OldObservation>>> {
50

  
51
    const rb = new RequestBuilder(this.rootUrl, ObservationService.GetObservationPath, 'get');
52
    if (params) {
53
      rb.query('unit_id', params.unit_id, {});
54
      rb.query('sensor_id', params.sensor_id, {});
55
      rb.query('from', params.from, {});
56
      rb.query('to', params.to, {});
57
    }
58

  
59
    return this.http.request(rb.build({
60
      responseType: 'json',
61
      accept: 'application/json'
62
    })).pipe(
63
      filter((r: any) => r instanceof HttpResponse),
64
      map((r: HttpResponse<any>) => {
65
        return r as StrictHttpResponse<Array<OldObservation>>;
66
      })
67
    );
68
  }
69

  
70
  /**
71
   * Get observation.
72
   *
73
   *
74
   *
75
   * This method provides access to only to the response body.
76
   * To access the full response (for headers, for example), `getObservation$Response()` instead.
77
   *
78
   * This method doesn't expect any request body.
79
   */
80
  getObservation(params: {
81
    unit_id: number;
82
    sensor_id: number;
83
    from?: string;
84
    to?: string;
85
  }): Observable<Array<OldObservation>> {
86

  
87
    return this.getObservation$Response(params).pipe(
88
      map((r: StrictHttpResponse<Array<OldObservation>>) => r.body as Array<OldObservation>)
89
    );
90
  }
91

  
92
}
src/app/shared/api/openapi.yaml
82 82
            schema:
83 83
              $ref: '#/components/schemas/UserInfo'
84 84

  
85
  /senslog1/SensorService?Operation=GetObservations:
86
    get:
87
      tags:
88
        - observation
89
      summary: Get observation
90
      operationId: getObservation
91
      parameters:
92
        - in: query
93
          name: unit_id
94
          required: true
95
          schema:
96
            type: integer
97
        - in: query
98
          name: sensor_id
99
          required: true
100
          schema:
101
            type: integer
102
        - in: query
103
          name: from
104
          schema:
105
            type: string
106
        - in: query
107
          name: to
108
          schema:
109
            type: string
110
      responses:
111
        200:
112
          description: Get observation for unitId and sensorId
113
          content:
114
            application/json:
115
              schema:
116
                type: array
117
                items:
118
                  $ref: '#/components/schemas/OldObservation'
119

  
85 120
  /senslog1/GroupService:
86 121
    get:
87 122
      tags:
......
557 592
        sum:
558 593
          type: number
559 594

  
560

  
595
    OldObservation:
596
      type: object
597
      properties:
598
        gid:
599
          type: integer
600
        time:
601
          type: string
602
          format: date-time
603
        value:
604
          type: number
561 605

  
562 606

  
563 607

  
src/app/shared/graph-loading/graphloader.ts
8 8

  
9 9
    if (sensorId >= 480000000 && sensorId < 490000000) {
10 10

  
11
      let rvalue: any = {};
12
      let base = require('/src/vega/base/default.json');
13
      let chart = require('/src/vega/body/barchart.json');
14
      let tooltip = require('/src/vega/tooltip/samm-tooltip.json')
11
      const rvalue: any = {};
12
      const base = require('/src/vega/base/default.json');
13
      const chart = require('/src/vega/body/barchart.json');
14
      const tooltip = require('/src/vega/tooltip/samm-tooltip.json')
15 15
      lodash.merge(rvalue, base, chart, tooltip);
16 16
      return rvalue;
17 17

  
18 18
    } else if ((sensorId >= 470020000 && sensorId < 470030000) || (sensorId >= 470060000 && sensorId < 470090000) ||
19 19
      (sensorId >= 470130000 && sensorId < 470140000) || (sensorId >= 470180000 && sensorId < 470190000)) {
20 20

  
21
      let rvalue: any = {};
22
      let base = require('/src/vega/base/default.json');
23
      let chart = require('/src/vega/body/windchart.json');
24
      let tooltip = require('/src/vega/tooltip/samm-tooltip.json')
21
      const rvalue: any = {};
22
      const base = require('/src/vega/base/default.json');
23
      const chart = require('/src/vega/body/windchart.json');
24
      const tooltip = require('/src/vega/tooltip/samm-tooltip.json')
25 25
      lodash.merge(rvalue, base, chart, tooltip);
26 26
      return rvalue;
27 27

  
28 28
    } else {
29 29

  
30
      let rvalue: any = {};
31
      let base = require('/src/vega/base/default.json');
32
      let chart = require('/src/vega/body/linechart.json');
33
      let tooltip = require('/src/vega/tooltip/samm-tooltip.json')
30
      const rvalue: any = {};
31
      const base = require('/src/vega/base/default.json');
32
      const chart = require('/src/vega/body/linechart.json');
33
      const tooltip = require('/src/vega/tooltip/samm-tooltip.json')
34 34
      lodash.merge(rvalue, base, chart, tooltip);
35 35
      return rvalue;
36 36

  
......
38 38
  }
39 39

  
40 40
  static getGraph(sensorId, data, interval, element) {
41
    let spec = this.getGraphType(sensorId);
41
    const spec = this.getGraphType(sensorId);
42 42
    const vega = require('vega');
43 43
    const vegaTooltip = require('vega-tooltip');
44 44
    const config = require('/src/vega/config.json');
......
47 47
    spec.signals[0].value = interval;
48 48

  
49 49

  
50
    let handler = new vegaTooltip.Handler();
50
    const handler = new vegaTooltip.Handler();
51 51

  
52 52
    const loc = vega.locale({
53
      "decimal": ",",
54
      "thousands": "\u00a0",
55
      "grouping": [3],
56
      "currency": ["", "\u00a0Kč"]
53
      decimal: ',',
54
      thousands: '\u00a0',
55
      grouping: [3],
56
      currency: ['', '\u00a0Kč']
57 57
    },{
58
      "dateTime": "%A,%e.%B %Y, %X",
59
      "date": "%-d.%-m.%Y",
60
      "time": "%H:%M:%S",
61
      "periods": ["AM", "PM"],
62
      "days": ["neděle", "pondělí", "úterý", "středa", "čvrtek", "pátek", "sobota"],
63
      "shortDays": ["ne.", "po.", "út.", "st.", "čt.", "pá.", "so."],
64
      "months": ["leden", "únor", "březen", "duben", "květen", "červen", "červenec", "srpen", "září", "říjen", "listopad", "prosinec"],
65
      "shortMonths": ["led", "úno", "břez", "dub", "kvě", "čer", "červ", "srp", "zář", "říj", "list", "pros"]
58
      dateTime: '%A,%e.%B %Y, %X',
59
      date: '%-d.%-m.%Y',
60
      time: '%H:%M:%S',
61
      periods: ['AM', 'PM'],
62
      days: ['neděle', 'pondělí', 'úterý', 'středa', 'čvrtek', 'pátek', 'sobota'],
63
      shortDays: ['ne.', 'po.', 'út.', 'st.', 'čt.', 'pá.', 'so.'],
64
      months: ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'],
65
      shortMonths: ['led', 'úno', 'břez', 'dub', 'kvě', 'čer', 'červ', 'srp', 'zář', 'říj', 'list', 'pros']
66 66
    });
67 67

  
68
    let view = new vega.View(vega.parse(spec, config))
68
    const view = new vega.View(vega.parse(spec, config))
69 69
      .tooltip(handler.call)
70 70
      .initialize(element)
71 71
      .hover()
src/app/unit/components/unit.component.html
14 14
  </div>
15 15
</div>
16 16

  
17

  
18
<div id="vega_container"></div>
17
<div *ngFor="let group of sensorGroups">
18
  <div id="vega_container_{{group}}"></div>
19
</div>
19 20

  
20 21
  {{ data | json}}
src/app/unit/components/unit.component.ts
5 5
import {Sensors} from '../../shared/api/endpoints/models/sensors';
6 6
import {AggreationModel} from '../../shared/models/aggreation.model';
7 7
import * as moment from 'moment-timezone';
8
import {GraphLoader} from "../../shared/graph-loading/graphloader";
8
import {GraphLoader} from '../../shared/graph-loading/graphloader';
9 9

  
10 10
declare var require: any
11 11

  
......
20 20
  unitId: number;
21 21
  viewCount = 0;
22 22
  data;
23
  sensorGroups = [];
23 24
  rangeDates: Date[];
24 25
  aggregationFunction: AggreationModel[];
25 26
  selectedAggregationFunction: string;
......
63 64
      from: moment(range[0]).format('yyyy-MM-DD HH:mm:ssZ').slice(0, -3),
64 65
      to: moment(range[1]).format('yyyy-MM-DD HH:mm:ssZ').slice(0, -3), interval: agg}).pipe(
65 66
      tap(data => {
66
        //this.data = Object.entries(data);
67
        //console.log(this.data);
67
        // this.data = Object.entries(data);
68
        // console.log(this.data);
68 69

  
69
        //for (const [key, value] of Object.entries(data)) {
70
        // for (const [key, value] of Object.entries(data)) {
70 71
        //  console.log(key, Object.entries(value));
71
        //}
72
        // }
72 73

  
73 74
        var objectKeys = Object.keys(data);
74 75
        for(const key of objectKeys ) {
75 76
          let element = this.createView();
76 77
          GraphLoader.getGraph(key, data[key]["data"], data[key]["interval"], element);
77

  
78 78
        }
79 79
      })
80 80
    ).subscribe();
81 81
  }
82 82

  
83
 /* getGraph(sensorId, data, interval) {
84
    let spec = this.getGraphType(sensorId);
85
    let elementName = this.createView();
86
    const vega = require('vega');
87
    const config = require('/src/vega/config.json');
88
    const vegaTooltip = require('vega-tooltip');
89

  
90
    spec.data[0].values = data;
91
    spec.signals[0].value = interval;
92

  
93

  
94
    let handler = new vegaTooltip.Handler();
95

  
96

  
97
    const loc = vega.locale({
98
      "decimal": ",",
99
      "thousands": "\u00a0",
100
      "grouping": [3],
101
      "currency": ["", "\u00a0Kč"]
102
    },{
103
      "dateTime": "%A,%e.%B %Y, %X",
104
      "date": "%-d.%-m.%Y",
105
      "time": "%H:%M:%S",
106
      "periods": ["AM", "PM"],
107
      "days": ["neděle", "pondělí", "úterý", "středa", "čvrtek", "pátek", "sobota"],
108
      "shortDays": ["ne.", "po.", "út.", "st.", "čt.", "pá.", "so."],
109
      "months": ["leden", "únor", "březen", "duben", "květen", "červen", "červenec", "srpen", "září", "říjen", "listopad", "prosinec"],
110
      "shortMonths": ["led", "úno", "břez", "dub", "kvě", "čer", "červ", "srp", "zář", "říj", "list", "pros"]
111
    });
112

  
113
    let view = new vega.View(vega.parse(spec, config))
114
      .tooltip(handler.call)
115
      .initialize(elementName)
116
      .hover()
117
      .locale(loc)
118
      .runAsync();
119

  
120

  
121

  
122
  }
123

  
124
  getGraphType(sensorId) {
125
    const lodash = require('lodash/object');
126

  
127
    if(sensorId >= 480000000 && sensorId < 490000000) {
128

  
129
      let rvalue: any = {};
130
      let base = require('/src/vega/base/default.json');
131
      let chart = require('/src/vega/body/barchart.json');
132
      let tooltip = require('/src/vega/tooltip/samm-tooltip.json')
133
      lodash.merge(rvalue, base, chart, tooltip);
134
      return rvalue;
135

  
136
    } else if((sensorId >= 470020000 && sensorId <  470030000) || (sensorId >=470060000 && sensorId < 470090000) ||
137
      (sensorId >= 470130000 && sensorId < 470140000) || (sensorId >=470180000 && sensorId < 470190000)) {
138

  
139
      let rvalue: any = {};
140
      let base = require('/src/vega/base/default.json');
141
      let chart = require('/src/vega/body/windchart.json');
142
      let tooltip = require('/src/vega/tooltip/samm-tooltip.json')
143
      lodash.merge(rvalue, base, chart, tooltip);
144
      return rvalue;
145

  
146
    } else {
147

  
148
      let rvalue: any = {};
149
      let base = require('/src/vega/base/default.json');
150
      let chart = require('/src/vega/body/linechart.json');
151
      let tooltip = require('/src/vega/tooltip/samm-tooltip.json')
152
      lodash.merge(rvalue, base, chart, tooltip);
153
      return rvalue;
154

  
155
    }
156

  
157

  
158
  }*/
159

  
160 83
  createView() {
161 84
    let div = document.createElement("div");
162 85
    let name = "view" + this.viewCount;
......
167 90
    container.appendChild(div);
168 91

  
169 92
    return '#' + name;
170

  
171 93
  }
172 94
}
src/vega/base/default.json
22 22
        },
23 23
        {
24 24
          "type": "formula",
25
          "expr": "toDate(datum[\"timestamp\"])",
25
          "expr": "utcParse(datum[\"timestamp\"], '%Y-%m-%d %H:%M:%S.%f%Z')",
26 26
          "as": "dateTime"
27 27
        }
28 28
      ]

Také k dispozici: Unified diff