Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 6842a0b0

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

Re #8928 - Oprava chyb vzniklých v průběhu iterace

  • change graphloader calling
  • fix tooltip for negative values

Zobrazit rozdíly:

src/app/unit/components/unit.component.ts
137 137
  getAnalytics(range: Date[], changedDate: boolean, changedSensorId: string) {
138 138
    if (changedDate) { // if changed date we need new data for all sensors
139 139
      this.selectedSensors.forEach(selectSens => {
140
        this.analyticsData = []; //empty analytics data
140 141
        this.analyticsEndpointRequest(selectSens, range);
141 142
      });
142 143
    } else  { // add data for selected sensor
......
165 166
      })
166 167
    ).subscribe(data => {
167 168
      if (data) {
168
        this.analyticsData.push({sensorId, data: data[sensorId].data, interval: data[sensorId].interval});
169
        this.analyticsData.push({sensorId, data: data[sensorId].data, interval: data[sensorId].interval,
170
          sensor: this.sensors.find(sens => sens.sensorId.toString() === sensorId.toString())});
169 171
        if (data[sensorId].data) {
170 172
          const groupId = sensorId.slice(0, 5);
171 173
          const view = '#vega_container_' + groupId;
172 174
          if (this.selectedSensors.some(sens => sens.toString() === sensorId)) {
173 175
            // GraphLoader.getAnalyticsGraph(key, data[key].data, data[key].interval, view);
174
            GraphLoader.getGraph(this.selectedSensors, this.analyticsData, this.filteredSensorsInfos(groupId), view, true);
176
            GraphLoader.getGraphWithInterval(this.filteredSelectedSensors(groupId), this.filteredAnalyticsData(groupId), this.filteredAnalyticsData(groupId)[0]['interval'] * 1000, this.filteredSensorsInfos(groupId)[0], view, true);
175 177
          } else {
176 178
            // GraphLoader.getAnalyticsGraph(null, null, null, view);
177 179
            GraphLoader.getGraph(null, null, null, view, null);
......
198 200
          if (this.analyticsData.some(sens => sens.sensorId === sensorId)) { // if already data for selected sensor in memory
199 201
            // GraphLoader.getAnalyticsGraph(sensorId, this.analyticsData.find(sens => sens.sensorId === sensorId).data,
200 202
            // this.analyticsData.find((sens => sens.sensorId === sensorId).interval, sensorGroupElement);
201
            GraphLoader.getGraph(this.selectedSensors, this.analyticsData, this.filteredSensorsInfos(groupId), sensorGroupElement, true);
203
            //GraphLoader.getGraph(this.selectedSensors, this.analyticsData, this.filteredSensorsInfos(groupId), sensorGroupElement, true);
204
            GraphLoader.getGraphWithInterval(this.filteredSelectedSensors(groupId), this.filteredAnalyticsData(groupId), this.filteredAnalyticsData(groupId)[0]['interval'] * 1000, this.filteredSensorsInfos(groupId)[0], sensorGroupElement, true);
202 205

  
203 206
          } else { // get data from server for added sensor and show graph for selected sensors
204 207
            this.showGraph(false, sensorId);
......
206 209
        } else { // remove sensor from graph
207 210
          // GraphLoader.getAnalyticsGraph(sensorId, this.analyticsData.find(sens => sens.sensorId === sensorId).data,
208 211
          // this.analyticsData.find(sens => sens.sensorId === sensorId).interval, sensorGroupElement);
209
          GraphLoader.getGraph(this.selectedSensors, this.analyticsData, this.filteredSensorsInfos(groupId), sensorGroupElement, true);
212
          GraphLoader.getGraphWithInterval(this.filteredSelectedSensors(groupId), this.filteredAnalyticsData(groupId), this.filteredAnalyticsData(groupId)[0]['interval'] * 1000, this.filteredSensorsInfos(groupId)[0], sensorGroupElement, true);
210 213

  
211 214
        }
212 215
      } else { // use observations data

Také k dispozici: Unified diff