function Init(){$("#setzone.long").mouseover(function(){$(this).removeClass("long")}).mouseout(function(){within(this)||$(this).addClass("long")});$("#cblYs").sortable({items:">span",opacity:.7,handle:"label"});$("#ddlType").length>0&&(ddlXsChanged(),StatModeChanged())}function getDefaulted(){dispLoading();__doPostBack("btnBuild","defaulted")}function FirstChart(){dispLoading();__doPostBack("btnBuild","first")}function dispLoading(){myChart.clear();myChart.showLoading();isLoading=!0}function showMsg(n){var t={title:{subtext:n,x:"center",subtextStyle:{color:"#f40",fontSize:14},top:80}};myChart.hideLoading();myChart.clear();myChart.resize({width:$("#upSetting").width()});myChart.setOption(t);isLoading=!1}function updateChart(){var i=$("#upSetting").width(),r=i,u=0,f=chartData.ChartType,t,n,e;(f=="bar"||f=="line"||f=="scatter")&&(t=chartData.Keys.length,n=chartData.Values.length,u=t<=5?n==1?75:n==2?50:n<5?35:28:t<=8?n==1?64:n==2?45:n<5?32:23:t<=15?n==1?48:n==2?38:n<5?28:20:t<=50?n==1?30:n==2?24:n<5?20:18:18,r=u*t*n*1.02+70,i>r&&(r=i,u=(i-70)/1.02/t/n));myChart.hideLoading();myChart.clear();myChart.resize({width:r});e=getOptions(chartData,u);myChart.setOption(e);isLoading=!1}function ddlXsChanged(){var t=$("#ddlXs").val(),n=types[t];n?($("#seps").css("display",""),$("#ddlTimeSpan").css("display",n=="DateTime"&&$("#ddlGroupby").val()=="Auto"?"":"none"),n=="DateTime"?$("#SepValues").attr("title","输入作为横坐标上分组间隔的日期或时间值。如，输入“2018-1-1,2019-1-1”将会分为2018年及其之前和之后共三个组。若不设置，系统将自动分组。"):n=="Numeric"&&$("#SepValues").attr("title","输入作为横坐标上分组间隔的数值。如，输入“100,1000”将会分为100以下、100到1000、1000以上共三个组。若不设置，系统将自动分组。"),SetGroup()):$("#seps").css("display","none")}function modeChanged(){chartData&&(chartData.ChartType=$("#ddlType").val(),updateChart())}function SetGroup(){var n=$("#ddlGroupby").val();$("#ddlTimeSpan").css("display",types[$("#ddlXs").val()]=="DateTime"&&n=="Auto"?"":"none");$("#SepValues").css("display",n=="Specified"?"":"none")}function StatModeChanged(){$("#divys").css("display",$("#ddlStatMode").val()=="count"?"none":"")}function setDefault(){var n=getEventSrc(),t=$(n).closest("tr").attr("chartid");__doPostBack("btnManage","default_"+t)}function delChart(){var r=getEventSrc(),n=$(r).closest("tr"),t=n.find("td:first").text(),i;t==""&&(t=n.find(":text:first").val());confirm("确定要删除“"+t+"”吗？")&&(i=n.attr("chartid"),__doPostBack("btnManage","delete_"+i))}function rename(){var n=$(getEventSrc()),i=n.closest("tr"),t=i.find("td:first"),r;n.text()=="更名"?(r=t.text(),t.empty(),$("<input type='text' style='width:98%' value='"+r+"' title='回车提交' />").change(function(){var r=getEvent(),t,i;if(within(n,r))return!1;if(t=$.trim($(this).val()),i=$(this).closest("tr").attr("chartid"),t==""||t==DeBase64(i))return alert("请输入新的名称！"),!1;__doPostBack("btnManage",Base64(t)+"_"+i)}).keydown(function(n){return isEnterKey(n)?($(this).change(),!1):!0}).appendTo(t).select().focus(),n.text("取消")):(n.text("更名"),t.text(DeBase64(i.attr("chartid"))))}function showMenu(){var i=$("#btnManage"),r=$("#chartList"),n=i.offset(),t=n.top,u=r.outerHeight();return t+u>document.documentElement.clientHeight&&(t=n.top+i.height()-u+4),r.css({left:n.left,top:Math.max(1,t),display:"none"}).fadeIn("fast"),!1}function storeOrder(){var n="|";$("#cblYs span[v]").each(function(){n+=this.getAttribute("v")+"|"});$("#sorted").val(n)}function toBuild(){dispLoading();storeOrder()}function toSave(){return storeOrder(),__doPostBack("btnManage","save"),!1}function toSaveAs(){var n=$("#ddlXs option:selected").text();return n=n==""?"新建图表":"按"+n+"统计",toPrompt("输入名称：",function(n){return storeOrder(),__doPostBack("btnManage","saveas_"+$.trim(n)),!0},n)}function toManage(){return __doPostBack("btnManage","manage"),!1}function switchChart(n){return dispLoading(),__doPostBack("btnManage","switchChart_"+n),!1}function initRule(){AutoComplete("#rule_tbRoles");$("#rule_tbRoles").click(function(){$("#rule_cbRoles").prop("checked",!0)})}function editRule(n){return __doPostBack("btnManage","editRule_"+n),!1}function toAddRule(){return __doPostBack("m$aAddRule",""),!1}function switchChange(){__doPostBack("btnManage","SwitchChange")}function delRule(n){return confirm("确定删除该规则吗？")&&__doPostBack("btnManage","delRule_"+n),!1}var views="123456",chartData=null,isLoading=!1;$(function(){window.types||(window.types={});$(document).click(function(){$(getEventSrc()).is("#btnManage")||HideAllMenu()});$("#btnPrint").length==0&&(document.oncontextmenu=function(){return $(getEventSrc()).is(":input")?!0:CanelEvent()},document.documentElement.oncopy=function(){return $.browser.msie?$(getEventSrc()).is(":input,td,p"):getSelection().toString().indexOf(String.fromCharCode(9))==-1});var n=Sys.WebForms.PageRequestManager.getInstance();n.add_endRequest(function(n,t){if(isLoading){var i=t.get_error();i&&(showMsg(i.message.replace(/Sys\.WebForms\.\w+:\s*/,"")),t.set_errorHandled(!0))}})})