perf: 增加chart预览{{name}}映射、修改提示语

This commit is contained in:
chenjinsong
2021-03-08 16:37:43 +08:00
parent 477ea5c595
commit 05ae057172
3 changed files with 4 additions and 4 deletions

View File

@@ -596,7 +596,7 @@
if(this.mapping&&!this.mapping.color){ if(this.mapping&&!this.mapping.color){
this.mapping.color={bac:'#fff',text:'#000'} this.mapping.color={bac:'#fff',text:'#000'}
} }
this.serieSingleStat = mapping?mapping.text.replace('{{value}}', singleStatTmp):chartDataFormat.getUnit(chartItem.unit?chartItem.unit:2).compute(singleStatTmp,null,2); this.serieSingleStat = mapping?mapping.text.replace('{{value}}', singleStatTmp).replace('{{name}}', chartItem.elements[0].legend):chartDataFormat.getUnit(chartItem.unit?chartItem.unit:2).compute(singleStatTmp,null,2);
}else{ }else{
this.serieSingleStat = chartDataFormat.getUnit(chartItem.unit?chartItem.unit:2).compute(singleStatTmp,null,2); this.serieSingleStat = chartDataFormat.getUnit(chartItem.unit?chartItem.unit:2).compute(singleStatTmp,null,2);
} }
@@ -1198,7 +1198,7 @@
} }
this.mapping=mapping; this.mapping=mapping;
item.mapping=mapping; item.mapping=mapping;
item.value = mapping?mapping.text.replace('{{value}}', item.value):this.unit.compute(value,null,2); item.value = mapping?mapping.text.replace('{{value}}', item.value).replace('{{name}}', item.element.alias):this.unit.compute(value,null,2);
} }
return item; return item;
}) })

View File

@@ -189,7 +189,7 @@ const cn = {
unit: "单位", unit: "单位",
legend: "图例", legend: "图例",
legendTip: "使用名称或表达式控制时间序列的名称。例如{{hostname}将替换为标签主机名的标签值。", legendTip: "使用名称或表达式控制时间序列的名称。例如{{hostname}将替换为标签主机名的标签值。",
valueMappingTip: '使用{{value}}可以显示原值\n'+ valueMappingTip: '使用{{name}}和{{value}}显示原名和原值\n'+
'例如total alive: {{value}}\n'+ '例如total alive: {{value}}\n'+
'结果为total alive: 100', '结果为total alive: 100',
option: "操作", option: "操作",

View File

@@ -147,7 +147,7 @@ const en = {
legend:'Legend', legend:'Legend',
statistics:'Statistics', statistics:'Statistics',
legendTip:'Controls the name of the time series, using name or pattern. For example {{hostname}} will be replaced with label value for the label hostname.', legendTip:'Controls the name of the time series, using name or pattern. For example {{hostname}} will be replaced with label value for the label hostname.',
valueMappingTip: 'Use {{value}} to display the original value\n'+ valueMappingTip: 'Use {{name}} and {{value}} to display the original name and value\n'+
'For example: Total Alive: {{value}}\n'+ 'For example: Total Alive: {{value}}\n'+
'The result is: Total Alive: 100', 'The result is: Total Alive: 100',
sync: 'Sync to assets', sync: 'Sync to assets',