Browse Source

Fixed after sort legend keys, is not correct dataKey index; Refactoring

pull/3415/head
Vladyslav_Prykhodko 6 years ago
parent
commit
47a7e3b31b
  1. 11
      ui-ngx/src/app/core/api/widget-subscription.ts

11
ui-ngx/src/app/core/api/widget-subscription.ts

@ -403,7 +403,7 @@ export class WidgetSubscription implements IWidgetSubscription {
configDatasource: datasource, configDatasource: datasource,
configDatasourceIndex: index, configDatasourceIndex: index,
dataLoaded: (pageData, data1, datasourceIndex, pageLink) => { dataLoaded: (pageData, data1, datasourceIndex, pageLink) => {
this.dataLoaded(pageData, data1, datasourceIndex, pageLink, true) this.dataLoaded(pageData, data1, datasourceIndex, pageLink, true);
}, },
initialPageDataChanged: this.initialPageDataChanged.bind(this), initialPageDataChanged: this.initialPageDataChanged.bind(this),
dataUpdated: this.dataUpdated.bind(this), dataUpdated: this.dataUpdated.bind(this),
@ -804,7 +804,7 @@ export class WidgetSubscription implements IWidgetSubscription {
configDatasourceIndex: datasourceIndex, configDatasourceIndex: datasourceIndex,
subscriptionTimewindow: this.subscriptionTimewindow, subscriptionTimewindow: this.subscriptionTimewindow,
dataLoaded: (pageData, data1, datasourceIndex1, pageLink1) => { dataLoaded: (pageData, data1, datasourceIndex1, pageLink1) => {
this.dataLoaded(pageData, data1, datasourceIndex1, pageLink1, true) this.dataLoaded(pageData, data1, datasourceIndex1, pageLink1, true);
}, },
dataUpdated: this.dataUpdated.bind(this), dataUpdated: this.dataUpdated.bind(this),
updateRealtimeSubscription: () => { updateRealtimeSubscription: () => {
@ -1149,7 +1149,7 @@ export class WidgetSubscription implements IWidgetSubscription {
this.onSubscriptionMessage({ this.onSubscriptionMessage({
severity: 'warn', severity: 'warn',
message message
}) });
} }
} }
if (isUpdate) { if (isUpdate) {
@ -1226,9 +1226,6 @@ export class WidgetSubscription implements IWidgetSubscription {
}); });
}); });
} }
if (this.displayLegend) {
this.legendData.keys = this.legendData.keys.sort((key1, key2) => key1.dataKey.label.localeCompare(key2.dataKey.label));
}
if (this.caulculateLegendData) { if (this.caulculateLegendData) {
this.data.forEach((dataSetHolder, keyIndex) => { this.data.forEach((dataSetHolder, keyIndex) => {
this.updateLegend(keyIndex, dataSetHolder.data, false); this.updateLegend(keyIndex, dataSetHolder.data, false);
@ -1274,7 +1271,7 @@ export class WidgetSubscription implements IWidgetSubscription {
const configuredDatasource = this.configuredDatasources[datasourceIndex]; const configuredDatasource = this.configuredDatasources[datasourceIndex];
const startIndex = configuredDatasource.dataKeyStartIndex; const startIndex = configuredDatasource.dataKeyStartIndex;
const dataKeysCount = configuredDatasource.dataKeys.length; const dataKeysCount = configuredDatasource.dataKeys.length;
const index = startIndex + dataIndex*dataKeysCount + dataKeyIndex; const index = startIndex + dataIndex * dataKeysCount + dataKeyIndex;
let update = true; let update = true;
let currentData: DataSetHolder; let currentData: DataSetHolder;
if (this.displayLegend && this.legendData.keys[index].dataKey.hidden) { if (this.displayLegend && this.legendData.keys[index].dataKey.hidden) {

Loading…
Cancel
Save