1、在grid中得合适位置添加 切换指标元素控件。如:html中得列表列表控件
<script type="text/javascript"> function funSelectIndex() { var tar = new String(document.getElementById("selectIndex").value); var temp = new String(location.href); var targetURL = new String(); if(temp.indexOf("&startTime=") != -1 ){ targetURL = temp.substring(0, temp.indexOf("&startTime")); }else{ targetURL = temp; } targetURL += "&startTime=<VALUE-OF>params["startTime"].value</VALUE-OF>"; targetURL += "&endTime=<VALUE-OF>params["endTime"].value</VALUE-OF>"; targetURL += "¶Dep=<VALUE-OF>params["paraDep"].value</VALUE-OF>"; targetURL += "¶Termp=<VALUE-OF>params["paraTerm"].value</VALUE-OF>"; targetURL += "&dealerName=<VALUE-OF>params["dealerName"].value</VALUE-OF>"; targetURL += "&pSelectIndex=" + tar; alert(targetURL); location.replace(targetURL); } </script> <select id="selectIndex" onchange="funSelectIndex()"> <option value="amount" <VALUE-OF>if(params["pSelectIndex"].value=="amount"){selectted="selected"}</VALUE-OF>>实付金额</option> <option value="cost" <VALUE-OF>if(params["pSelectIndex"].value=="cost"){selectted="selected"}</VALUE-OF>>实收金额</option> <option value="orderNum" <VALUE-OF>if(params["pSelectIndex"].value=="orderNum"){selectted="selected"}</VALUE-OF>>订单数量</option> <option value="price" <VALUE-OF>if(params["pSelectIndex"].value=="price"){selectted="selected"}</VALUE-OF>>课单价</option> <option value="perforpercent" <VALUE-OF>if(params["pSelectIndex"].value=="perforpercent"){selectted="selected"}</VALUE-OF>>成单率</option> </select>
2、 设置器效果
3、在报表参数中定义选择参数项。如:selectIndex
4、点击饼图 在“扇面大小”中添加判断js脚本
if(params["pSelectIndex"].value=="amount") { row["paidamount"] }else if(params["pSelectIndex"].value=="cost") { row["costamount"] }else if(params["pSelectIndex"].value=="orderNum") { row["ordersNum"] }else if(params["pSelectIndex"].value=="price") { row["ordersNum"] }else { row["perforpercent"] }
目的是根据pSelectIndex选择的数值实现对 统计指标的切换
5、运行效果