Projekt

Obecné

Profil

« Předchozí | Další » 

Revize c4f90f7b

Přidáno uživatelem Štěpán Červenka před více než 3 roky(ů)

Re #8914 - Opravit zobrazení grafů pro endpoint analytics

  • analytics working for sensor charts
  • analytics for unit charts trigger dummy multiline analytics chart

Zobrazit rozdíly:

src/app/unit/components/unit.component.ts
12 12
import {ObservationService} from '../../shared/api/endpoints/services/observation.service';
13 13

  
14 14

  
15
declare var require: any
16

  
15 17
@Component({
16 18
  selector: 'app-unit',
17 19
  templateUrl: './unit.component.html',
......
101 103
  }
102 104

  
103 105
  getAnalytics(range: Date[], changedDate: boolean, changedSensor: string) {
106

  
107
    GraphLoader.getGraphWithInterval(this.getDummySensorList(), this.getDummyGraph(), this.getDummyInterval(), this.getDummyLegend(), this.getDummyContainer(), "true");
108
    return;
109

  
110

  
104 111
    const groupId = changedSensor.toString().slice(0, 5);
105 112
    if (changedDate) {
106 113
      this.selectedSensors.forEach(selectSens => {
......
129 136
                if (this.selectedSensors.some(sens => sens.toString() === key)) {
130 137
                  // GraphLoader.getAnalyticsGraph(key, data[key].data, data[key].interval, view);
131 138
                  // GraphLoader.getGraph(this.selectedSensors, this.filteredAnalyticsData(groupId), view, true);
139
                  GraphLoader.getGraph(this.filteredSelectedSensors(groupId),  this.filteredAnalyticsData(groupId),
140
                    this.filteredSensorsInfos(groupId), view, true);
132 141
                } else {
133 142
                  GraphLoader.getGraph(null, null, null, view, null);
134 143
                }
......
160 169
              const view = '#vega_container_' + key.slice(0, 5);
161 170
              if (this.selectedSensors.some(sens => sens.toString() === key)) {
162 171
               // GraphLoader.getAnalyticsGraph(key, data[key].data, data[key].interval, view);
163
                GraphLoader.getGraph(this.selectedSensors, this.analyticsData, this.filteredSensorsInfos(groupId), view, true);
172
                GraphLoader.getGraph(this.filteredSelectedSensors(groupId),  this.filteredAnalyticsData(groupId),
173
                  this.filteredSensorsInfos(groupId), view, true);
164 174
              } else {
165 175
                // GraphLoader.getAnalyticsGraph(null, null, null, view);
166 176
                GraphLoader.getGraph(null, null, null, view, null);
......
189 199
          if (this.analyticsData.some(sens => sens.sensorId === sensorId)) { // if already data for selected sensor in memory
190 200
            // GraphLoader.getAnalyticsGraph(sensorId, this.analyticsData.find(sens => sens.sensorId === sensorId).data,
191 201
            // this.analyticsData.find((sens => sens.sensorId === sensorId).interval, sensorGroupElement);
192
            GraphLoader.getGraph(this.selectedSensors, this.analyticsData, this.filteredSensorsInfos(groupId), sensorGroupElement, true);
202
            GraphLoader.getGraph(this.filteredSelectedSensors(groupId),  this.filteredAnalyticsData(groupId),
203
              this.filteredSensorsInfos(groupId), sensorGroupElement, true);
193 204

  
194 205
          } else { // get data from server for added sensor and show graph for selected sensors
195 206
            this.showGraph(false, sensorId);
......
313 324
        }, err => this.toastService.showError(err.error.message));
314 325
    }
315 326
  }
327

  
328

  
329
  getDummyLegend() {
330
    return require('/src/app/sensor/components/dummysensor.json');
331
  }
332

  
333
  getDummyGraph() {
334
    return require('/src/app/sensor/components/dummymultilinechart.json');
335
  }
336

  
337
  getDummySensorList() {
338
    return [340414062,340414062,340414064];
339
  }
340

  
341
  getDummyContainer() {
342
    return "#vega_container_34041";
343
  }
344

  
345
  getDummyInterval() {
346
    return  24 * 3600 * 1000;
347
  }
348

  
349

  
316 350
}

Také k dispozici: Unified diff