在处理数据透视表如何在数据显示为百分比,修改小数位数的问题上;
看到朋友们分享的都是把answer切换到高级编辑xml中,找到minDigits和maxDigits参数,修改后面带的数字参数来实现。
现在我来跟大家分享一个全局性修改的方法:
1. 进入环境中找到analytics.war包,路径为analytics.war\res\b_mozilla\views\pivot\pivotvieweditor.js参数文件;
2. 找到pivotvieweditor.js文件,编辑查找到目标函数function PTCreatePercentOf并,按下面代码修改保存;
原代码内容为:
function PTCreatePercentOf(d,a,k,g,l){var e=d.selectSingleNode("saw:showAs");
...(忽略部分代码)...
if(!l){c.setAttribute("xsi:type","saw:percent");
c.setAttribute("minDigits","1");c.setAttribute("maxDigits","1");c.setAttribute("scale","2")}
else{c.setAttribute("xsi:type","saw:number");c.setAttribute("minDigits","2");c.setAttribute("maxDigits","2");
c.removeAttribute("scale")}}
修改后代码为:
function PTCreatePercentOf(d,a,k,g,l){var e=d.selectSingleNode("saw:showAs");
...(忽略部分代码)...
if(!l){c.setAttribute("xsi:type","saw:percent");
c.setAttribute("minDigits","2");c.setAttribute("maxDigits","2");c.setAttribute("scale","2")}
else{c.setAttribute("xsi:type","saw:number");c.setAttribute("minDigits","2");c.setAttribute("maxDigits","2");
c.removeAttribute("scale")}}
3. 修改后的analytics.war包需要重新发布即可生效,以下是DEV测试效果图,请知悉;
如有错漏之处,请指正,谢谢