|
|
|
@ -138,6 +138,24 @@ export default class TbMapWidgetV2 { |
|
|
|
this.locationSettings.label = this.ctx.settings.label || "${entityName}"; |
|
|
|
this.locationSettings.color = this.ctx.settings.color ? tinycolor(this.ctx.settings.color).toHexString() : "#FE7569"; |
|
|
|
|
|
|
|
this.locationSettings.useLabelFunction = this.ctx.settings.useLabelFunction === true; |
|
|
|
if (angular.isDefined(this.ctx.settings.labelFunction) && this.ctx.settings.labelFunction.length > 0) { |
|
|
|
try { |
|
|
|
this.locationSettings.labelFunction = new Function('data, dsData, dsIndex', this.ctx.settings.labelFunction); |
|
|
|
} catch (e) { |
|
|
|
this.locationSettings.labelFunction = null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.locationSettings.useTooltipFunction = this.ctx.settings.useTooltipFunction === true; |
|
|
|
if (angular.isDefined(this.ctx.settings.tooltipFunction) && this.ctx.settings.tooltipFunction.length > 0) { |
|
|
|
try { |
|
|
|
this.locationSettings.tooltipFunction = new Function('data, dsData, dsIndex', this.ctx.settings.tooltipFunction); |
|
|
|
} catch (e) { |
|
|
|
this.locationSettings.tooltipFunction = null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.locationSettings.useColorFunction = this.ctx.settings.useColorFunction === true; |
|
|
|
if (angular.isDefined(this.ctx.settings.colorFunction) && this.ctx.settings.colorFunction.length > 0) { |
|
|
|
try { |
|
|
|
@ -383,11 +401,25 @@ export default class TbMapWidgetV2 { |
|
|
|
settings: angular.copy(tbMap.locationSettings) |
|
|
|
}; |
|
|
|
if (location.settings.showLabel) { |
|
|
|
if (location.settings.useLabelFunction && location.settings.labelFunction) { |
|
|
|
try { |
|
|
|
location.settings.label = location.settings.labelFunction(dataMap.dataMap, dataMap.dsDataMap, location.dsIndex); |
|
|
|
} catch (e) { |
|
|
|
location.settings.label = null; |
|
|
|
} |
|
|
|
} |
|
|
|
location.settings.label = tbMap.utils.createLabelFromDatasource(currentDatasource, location.settings.label); |
|
|
|
location.settings.labelReplaceInfo = processPattern(location.settings.label, datasources, currentDatasourceIndex); |
|
|
|
location.settings.labelText = location.settings.label; |
|
|
|
} |
|
|
|
if (location.settings.displayTooltip) { |
|
|
|
if (location.settings.useTooltipFunction && location.settings.tooltipFunction) { |
|
|
|
try { |
|
|
|
location.settings.tooltipPattern = location.settings.tooltipFunction(dataMap.dataMap, dataMap.dsDataMap, location.dsIndex); |
|
|
|
} catch (e) { |
|
|
|
location.settings.tooltipPattern = null; |
|
|
|
} |
|
|
|
} |
|
|
|
location.settings.tooltipPattern = tbMap.utils.createLabelFromDatasource(currentDatasource, location.settings.tooltipPattern); |
|
|
|
location.settings.tooltipReplaceInfo = processPattern(location.settings.tooltipPattern, datasources, currentDatasourceIndex); |
|
|
|
} |
|
|
|
@ -683,6 +715,15 @@ const commonMapSettingsSchema = |
|
|
|
"type":"string", |
|
|
|
"default":"${entityName}" |
|
|
|
}, |
|
|
|
"useLabelFunction": { |
|
|
|
"title":"Use label function", |
|
|
|
"type":"boolean", |
|
|
|
"default":false |
|
|
|
}, |
|
|
|
"labelFunction":{ |
|
|
|
"title":"Label function: f(data, dsData, dsIndex)", |
|
|
|
"type":"string" |
|
|
|
}, |
|
|
|
"showTooltip": { |
|
|
|
"title": "Show tooltip", |
|
|
|
"type":"boolean", |
|
|
|
@ -698,6 +739,15 @@ const commonMapSettingsSchema = |
|
|
|
"type":"string", |
|
|
|
"default":"<b>${entityName}</b><br/><br/><b>Latitude:</b> ${latitude:7}<br/><b>Longitude:</b> ${longitude:7}" |
|
|
|
}, |
|
|
|
"useTooltipFunction": { |
|
|
|
"title":"Use tooltip function", |
|
|
|
"type":"boolean", |
|
|
|
"default":false |
|
|
|
}, |
|
|
|
"tooltipFunction":{ |
|
|
|
"title":"Tooltip function: f(data, dsData, dsIndex)", |
|
|
|
"type":"string" |
|
|
|
}, |
|
|
|
"color":{ |
|
|
|
"title":"Color", |
|
|
|
"type":"string" |
|
|
|
@ -747,12 +797,22 @@ const commonMapSettingsSchema = |
|
|
|
"lngKeyName", |
|
|
|
"showLabel", |
|
|
|
"label", |
|
|
|
"useLabelFunction", |
|
|
|
{ |
|
|
|
"key":"labelFunction", |
|
|
|
"type":"javascript" |
|
|
|
}, |
|
|
|
"showTooltip", |
|
|
|
"autocloseTooltip", |
|
|
|
{ |
|
|
|
"key": "tooltipPattern", |
|
|
|
"type": "textarea" |
|
|
|
}, |
|
|
|
"useTooltipFunction", |
|
|
|
{ |
|
|
|
"key":"tooltipFunction", |
|
|
|
"type":"javascript" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"key":"color", |
|
|
|
"type":"color" |
|
|
|
@ -851,6 +911,15 @@ const imageMapSettingsSchema = |
|
|
|
"type":"string", |
|
|
|
"default":"${entityName}" |
|
|
|
}, |
|
|
|
"useLabelFunction": { |
|
|
|
"title":"Use label function", |
|
|
|
"type":"boolean", |
|
|
|
"default":false |
|
|
|
}, |
|
|
|
"labelFunction":{ |
|
|
|
"title":"Label function: f(data, dsData, dsIndex)", |
|
|
|
"type":"string" |
|
|
|
}, |
|
|
|
"showTooltip": { |
|
|
|
"title": "Show tooltip", |
|
|
|
"type":"boolean", |
|
|
|
@ -866,6 +935,15 @@ const imageMapSettingsSchema = |
|
|
|
"type":"string", |
|
|
|
"default":"<b>${entityName}</b><br/><br/><b>X Pos:</b> ${xPos:2}<br/><b>Y Pos:</b> ${yPos:2}" |
|
|
|
}, |
|
|
|
"useTooltipFunction": { |
|
|
|
"title":"Use tooltip function", |
|
|
|
"type":"boolean", |
|
|
|
"default":false |
|
|
|
}, |
|
|
|
"tooltipFunction":{ |
|
|
|
"title":"Tooltip function: f(data, dsData, dsIndex)", |
|
|
|
"type":"string" |
|
|
|
}, |
|
|
|
"color":{ |
|
|
|
"title":"Color", |
|
|
|
"type":"string" |
|
|
|
@ -934,12 +1012,22 @@ const imageMapSettingsSchema = |
|
|
|
"yPosKeyName", |
|
|
|
"showLabel", |
|
|
|
"label", |
|
|
|
"useLabelFunction", |
|
|
|
{ |
|
|
|
"key":"labelFunction", |
|
|
|
"type":"javascript" |
|
|
|
}, |
|
|
|
"showTooltip", |
|
|
|
"autocloseTooltip", |
|
|
|
{ |
|
|
|
"key": "tooltipPattern", |
|
|
|
"type": "textarea" |
|
|
|
}, |
|
|
|
"useTooltipFunction", |
|
|
|
{ |
|
|
|
"key":"tooltipFunction", |
|
|
|
"type":"javascript" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"key":"color", |
|
|
|
"type":"color" |
|
|
|
|