内置数据集的按钮无法直接获取参数,可以新建一个文本框组件,将参数传给文本框,然后从文本框中获取该值即可
假设按钮参数为type2,参考如下代码示例
------------
function(){ //获取文本值type2 var type2 = duchamp.getWidgetByName("文本参数").getValue();
// 构建动态mc文本 var mc = (type2 == 1) ? "成交宗数:" : (type2 == 2) ? "成交金额:" : (type2 == 3) ? "成交面积:" :
""; // 获取数据值 var perVal = FR.remoteEvaluate("value('区域热力-广州市',3,1,'"+this.name+"')"); var per = perVal ? Number(perVal).toFixed(2) : '0.00'; var accVal = FR.remoteEvaluate("value('区域热力-广州市',4,1,'"+this.name+"')"); var acc = accVal ? Number(accVal).toFixed(2) : '0.00'; // 构建完整提示 return this.name + "<br>"
+ mc + this.value + (type2==1 ? "宗" : type2==2 ? "万元" : "㎡") + "<br>"+"占比:"+acc+"%"+"<br>"+"同比:" + (per < 0
? "<span style='color:#16c153'>▼" + Math.abs(per) + "%"
: "<span style='color:#ea4431'>▲" + Math.abs(per) + "%");}