Merge pull request #3935 from vvlladd28/bugs/map-chart

[3.x] Fixed bugs in chart and map widgets
This commit is contained in:
Igor Kulikov 2021-01-13 16:34:56 +02:00 committed by GitHub
commit b83811eb3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View File

@ -388,7 +388,7 @@ export class TbFlot {
item.settings = {};
});
subscription.datasources.forEach((item) => {
let datasource: Datasource = {
const datasource: Datasource = {
type: item.type,
entityType: item.entityType,
entityId: item.entityId,
@ -829,7 +829,7 @@ export class TbFlot {
useDashboardTimewindow: false,
type: widgetType.latest,
callbacks: {
onDataUpdated: (subscription) => {this.thresholdsSourcesDataUpdated(subscription.data)}
onDataUpdated: (subscription) => this.thresholdsSourcesDataUpdated(subscription.data)
}
};
this.ctx.subscriptionApi.createSubscription(thresholdsSourcesSubscriptionOptions, true).subscribe(
@ -896,7 +896,7 @@ export class TbFlot {
type: widgetType.latest,
callbacks: {
onDataUpdated: (subscription) => {
this.labelPatternsParamsDataUpdated(subscription.data)
this.labelPatternsParamsDataUpdated(subscription.data);
}
}
};
@ -918,22 +918,22 @@ export class TbFlot {
}
private substituteLabelPatterns(series: TbFlotSeries, seriesIndex: number) {
let seriesLabelPatternsSourcesData = this.labelPatternsSourcesData.filter((item) => {
const seriesLabelPatternsSourcesData = this.labelPatternsSourcesData.filter((item) => {
return item.datasource.entityId === series.datasource.entityId;
});
let label = createLabelFromDatasource(series.datasource, series.dataKey.pattern);
for (let i = 0; i < seriesLabelPatternsSourcesData.length; i++) {
let keyData = seriesLabelPatternsSourcesData[i];
const keyData = seriesLabelPatternsSourcesData[i];
if (keyData && keyData.data && keyData.data[0]) {
let attrValue = keyData.data[0][1];
let attrName = keyData.dataKey.name;
const attrValue = keyData.data[0][1];
const attrName = keyData.dataKey.name;
if (isDefined(attrValue) && (attrValue !== null)) {
label = insertVariable(label, attrName, attrValue);
}
}
}
if (isDefined(this.subscription.legendData)) {
let targetLegendKeyIndex = this.subscription.legendData.keys.findIndex((key) => {
const targetLegendKeyIndex = this.subscription.legendData.keys.findIndex((key) => {
return key.dataIndex === seriesIndex;
});
if (targetLegendKeyIndex !== -1) {
@ -1098,7 +1098,7 @@ export class TbFlot {
flex: '1'
});
let columnContent = '';
for (let i = c*maxRows; i < (c+1)*maxRows; i++) {
for (let i = c * maxRows; i < (c + 1) * maxRows; i++) {
if (i >= hoverData.seriesHover.length) {
break;
}
@ -1287,7 +1287,7 @@ export class TbFlot {
let minTimeHistorical: any;
let hoverData: TbFlotSeriesHoverInfo;
let value: any;
let lastValue: any;
let lastValue = 0;
let minDistanceHistorical: number;
const results: TbFlotHoverInfo[] = [{
seriesHover: []

View File

@ -581,10 +581,10 @@ export default abstract class LeafletMap {
const marker: Marker = this.markers.get(key);
const location = this.convertPosition(data);
marker.updateMarkerPosition(location);
marker.setDataSources(data, dataSources);
if (settings.showTooltip) {
marker.updateMarkerTooltip(data);
}
marker.setDataSources(data, dataSources);
marker.updateMarkerIcon(settings);
return marker;
}