⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cakystat.htc

📁 HTC,demo WEB用于。 超大型
💻 HTC
📖 第 1 页 / 共 2 页
字号:
<!--///////////////////////////////////////////////////////////////////////
    // 标题:cakyStat组件 ///////////////////////////////////////////////////
    // 时间:2004-10-25 ///////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////-->

<public:component name="cakyStat" urn="cakyStat">
<public:property name="xmlSource" put="putXMLSource"/>
<public:property name="top"  put="putTop" get="getTop"/>
<public:property name="left" put="putLeft" get="getLeft"/>
<public:property name="width" put="putWidth" get="getWidth"/>
<public:property name="height" put="putHeight" get="getHeight"/>
<public:property name="caption" put="putCaption"/>
<public:property name="tagID" put="putTagID"/>
<public:property name="hasLegend" put="putHasLegend" />
<public:property name="backColor" put="putBackColor"/>
<public:property name="hasBorder" put="putHasBorder"/>
<public:property name="borderColor" put="putBorderColor"/>
<public:property name="borderWeight" put="putBorderWeight"/>
<public:property name="blackDistance" put="putBlackDistance"/>
<public:property name="init" put="initialize"/>
<public:method name="refreshData" />
<public:method name="createVMLForWord" />

<!--组件封装 language:javascript-->
<script language="JavaScript">
<!--
var objXMLDoc;
var objContainerDiv;
var objContextMenuContainersDiv;
var objVMLGroup;
var patientTotal = 0;
var vLeft;
var vTop;
var vWidth;
var vHeight;
var vCaption;
var vBackColor = "#ffffff";
var vHasBorder = true;
var booleanHasLegend = true;
var vBorderColor = "#000000";
var vBorderWeight = 1;
var vTagID = "";
var objCurShape = null;
var strCurFillcolor;
var strCurStrokecolor;
var intBlankDistance = 5;

var objCakyColorArray = new Array('#CC0000','#66CC00','#990033','#009900','#006699','#006633','#33FFCC','#99CC66','#66FF66','#333366','#FF6699','#FF3399','#FFCC00','#CCFFFF','#000000','#009999','#0066CC','#6699FF','#3300CC','#336600','#CCCC99','#996699','#9933FF','#CCCCCC','#CC3333','#33CCCC','#FF6699','#FFFF00','#66FF00','#000099','#CC9999','#666600','#CCCC33','#FFFFCC','#FF6600','#336666');

function initialize(){
	objContainerDiv = element.document.createElement("<div class='phms_ps_containerDiv'/>");
	objContainerDiv = element.appendChild(objContainerDiv);
	objContainerDiv.style.visibility = "visible";
	objContainerDiv.oncontextmenu = processContextMenuEvent;
	
	///////////////////////////////////////////////////
	objContextMenuContainersDiv = element.document.createElement("<div style='position:absolute;background:#cccccc;border:outset 2px;z-index:1;'>");
	objContextMenuContainersDiv.onblur = function(){this.style.visibility="hidden";};
	var objMenuItem = element.document.createElement("<span style='position:absolute;width:125;height:17;padding-top:3;padding-left:3;top:2;font-size:9pt;'>");
	objMenuItem.innerText = "导出统计图到office";
	objMenuItem.onfocus = transVMLtoOfficeDocument;
	objMenuItem = objContextMenuContainersDiv.appendChild(objMenuItem);
	objMenuItem.onmouseover = function(){this.style.background = "#000080";this.style.color = "#ffffff";};
	objMenuItem.onmouseout = function(){this.style.background = "#cccccc";this.style.color = "#000000";};
	objContextMenuContainersDiv = element.appendChild(objContextMenuContainersDiv);
	objContextMenuContainersDiv.style.visibility = "hidden";
	///////////////////////////////
	
	createCaky();
	refresh();
}

function transVMLtoOfficeDocument(){
	/////////此处添加发送vml导出请求数据到服务器/////////////////////
	alert();
	/////////////////////////////////////////////////
}


function processContextMenuEvent(){
	event.returnValue = false;
	with(objContextMenuContainersDiv.style){
		left = event.x - 10;
		top = event.y - 10;
		width = 130;
		height = 25;
		visibility = "visible";
	}
	objContextMenuContainersDiv.focus();
}

function refreshData(){
	if(objContainerDiv){
		objContainerDiv.innerHTML = "";
	}
	createCaky();
}

function createVMLForWord(){//生成饼图的vml代码        
        var oItemNodesList = null;//分类项目节点
        var vmlEnd = "";//最终的vml代码
        var vmlCaky = "";//饼图vml代码
        var vmlTitle = "";//饼图标题vml代码        
        var vAltText = "";//提示内容
        var lastPercent = 0;//起始百分比
        var curPercent = 0;//结束百分比        
        var vLengendLeft = 0;
        var topScale = 0;
        //try{
                oItemNodesList = objXMLDoc.selectNodes("//root/item");
                if(!oItemNodesList || !oItemNodesList.length) return; 
                if(booleanHasLegend){
                        if(oItemNodesList.length <15){//装配vmlTitle
                                vmlTitle = "<v:shape style='position:absolute;left:600;top:100;width:5200;height:350;' filled='false' stroked='false'><v:textbox><w:txbxContent><w:p><w:pPr><w:jc w:val='center'/><w:rPr><w:b/><w:b-cs/><w:sz w:val='20'/><w:sz-cs w:val='20'/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:hint='fareast'/><wx:font wx:val='宋体'/><w:b/><w:b-cs/><w:sz w:val='20'/><w:sz-cs w:val='20'/></w:rPr><w:t>" + vCaption + "</w:t></w:r></w:p></w:txbxContent></v:textbox></v:shape>";
                        }else if(oItemNodesList.length >= 15 && oItemNodesList.length <30){
                                vmlTitle = "<v:shape style='border:solid 0px green;left:600;top:100;width:6700;height:350;' filled='false' stroked='false'><v:textbox><w:txbxContent><w:p><w:pPr><w:jc w:val='center'/><w:rPr><w:b/><w:b-cs/><w:sz w:val='20'/><w:sz-cs w:val='20'/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:hint='fareast'/><wx:font wx:val='宋体'/><w:b/><w:b-cs/><w:sz w:val='20'/><w:sz-cs w:val='20'/></w:rPr><w:t>" + vCaption + "</w:t></w:r></w:p></w:txbxContent></v:textbox></v:shape>";        
                        }else{
                                vmlTitle = "<v:shape style='border:solid 0px green;left:600;top:100;width:10200;height:350;' filled='false' stroked='false'><v:textbox><w:txbxContent><w:p><w:pPr><w:jc w:val='center'/><w:rPr><w:b/><w:b-cs/><w:sz w:val='20'/><w:sz-cs w:val='20'/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:hint='fareast'/><wx:font wx:val='宋体'/><w:b/><w:b-cs/><w:sz w:val='20'/><w:sz-cs w:val='20'/></w:rPr><w:t>" + vCaption + "</w:t></w:r></w:p></w:txbxContent></v:textbox></v:shape>";        
                        }
                }else{
                        vmlTitle = "<v:shape style='border:solid 0px green;left:800;top:100;width:5200;height:350;' filled='false' stroked='false'><v:textbox><w:txbxContent><w:p><w:pPr><w:jc w:val='center'/><w:rPr><w:b/><w:b-cs/><w:sz w:val='20'/><w:sz-cs w:val='20'/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:hint='fareast'/><wx:font wx:val='宋体'/><w:b/><w:b-cs/><w:sz w:val='20'/><w:sz-cs w:val='20'/></w:rPr><w:t>" + vCaption + "</w:t></w:r></w:p></w:txbxContent></v:textbox></v:shape>";
                }
                for(var i=0;i<oItemNodesList.length;i++){//装配vmlCaky
                        if(parseFloat(oItemNodesList[i].childNodes[1].text) != 0){//
                                vAltText = oItemNodesList[i].childNodes[0].text + " " + oItemNodesList[i].childNodes[2].text;
                        
                                if(i==0){//第一个饼图
                                        lastPercent = parseFloat(oItemNodesList[i].childNodes[2].text);
                                        curPercent = lastPercent;
                                        vmlCaky += createCakyVML(0,curPercent*3.6,objCakyColorArray[i],vAltText,4000,i);
                                }else if( i== (oItemNodesList.length - 1)){//最后一个饼图
                                        curPercent = parseFloat(oItemNodesList[i].childNodes[2].text);
                                        vmlCaky += createCakyVML(lastPercent*3.6,100*3.6,objCakyColorArray[i],vAltText,4000,i);
                                }else{//中间的饼图
                                        curPercent = parseFloat(oItemNodesList[i].childNodes[2].text) + lastPercent;
                                        vmlCaky += createCakyVML(lastPercent*3.6,curPercent*3.6,objCakyColorArray[i],vAltText,4000,i);
                                        lastPercent = curPercent;
                                }
                        }
                        if(booleanHasLegend){//有图例
                                if(i>=0 && i< 15){//装配图例
                                        vLengendLeft = 5600;
                                        topScale = i;
                                }else if(i>=15 && i<30){
                                        vLengendLeft = 7100;
                                        topScale = i - 15;
                                }else if(i>=30){
                                        vLengendLeft = 8900;
                                        topScale = i - 30;
                                }
                                vmlCaky +="<v:rect style='position:absolute;left:" + vLengendLeft + ";top:" + (900 + topScale*250) + ";width:200;height:160;z-index:1;' coordsize='5000,5000' fillcolor='" + objCakyColorArray[i] + "' stroked='false'><v:shadow on='True' offset='0pt,1pt' color='black'/></v:rect>";//图例
                                vmlCaky +="<v:rect style='position:absolute;border:solid 0px green;left:" + (vLengendLeft + 150) + ";width:1500;top:" + (780 + topScale*250) + ";height:350' filled='false' stroked='false'><v:textbox><w:txbxContent><w:p><w:pPr><w:jc w:val='center'/></w:pPr><w:r><w:rPr><w:sz w:val='18'/><w:sz-cs w:val='18'/></w:rPr><w:t>" + oItemNodesList[i].childNodes[0].text + "(" + oItemNodesList[i].childNodes[1].text + ")</w:t></w:r></w:p></w:txbxContent></v:textbox></v:rect>";//图例说明文字
                                if(i == oItemNodesList.length-1){//总计
                                        vmlCaky += "<v:rect style='position:absolute;left:" + (vLengendLeft + 50) + ";width:1500;top:" + (840 + (topScale+1)*250) + ";height:350' filled='false' stroked='false'><v:textbox><w:txbxContent><w:p><w:pPr><w:jc w:val='center'/></w:pPr><w:r><w:rPr><w:sz w:val='18'/><w:sz-cs w:val='18'/></w:rPr><w:t>总计:" + patientTotal + "</w:t></w:r></w:p></w:txbxContent></v:textbox></v:rect>";
                                }        
                        }
                }
                //if(vHasBorder){//有边框
                //        vmlEnd = "<v:group id='" + vTagID + "' style='position:absolute;border:solid " + vBorderWeight + "px " + vBorderColor + ";background:" + vBackColor + ";left:0px;top:0px;width:180px;height:180px;' coordsize='2000,2000' xmlns:v='urn:schemas-microsoft-com:vml'>" + vmlTitle + vmlCaky + "<v:rect style='position:absolute;left:0;top:0;height:5500;' stroked='false'/></v:group>";
                //}else{//无边框
                        vmlEnd = "<v:group id='" + vTagID + "' style='position:absolute;background:" + vBackColor + ";left:0px;top:0px;width:300px;height:300px;' coordsize='4000,4000' xmlns:v='urn:schemas-microsoft-com:vml'><v:rect style='position:absolute;left:0;top:0;height:2000;width:2000' stroked='false'/>" + vmlTitle + vmlCaky + "</v:group>";
                //}
                return vmlEnd;
       // }catch(e){}
}

function createCakyVML(sa,ea,cakyColor,altText,cakySize,vIndex){
	var sx=parseInt(2000*Math.sin(Math.PI*2*(sa/360)));
	var sy=parseInt(-2000*Math.cos(Math.PI*2*(sa/360)));
	var ex=parseInt(2000*Math.sin(Math.PI*2*(ea/360)));
	var ey=parseInt(-2000*Math.cos(Math.PI*2*(ea/360)));
	var returnVml = "";
	returnVml += "<v:shape colorIndex='" + vIndex + "' title='"+ altText +"' style='position:absolute;border:solid 0px " + cakyColor + ";z-index:1;left:3000;top:2800;width:4000;height:4000' CoordSize='" + cakySize + "," + cakySize + "' strokeweight='" + intBlankDistance + "pt' fillcolor='" + cakyColor + "' strokecolor='" + vBackColor + "' path='m0,0 l "+sx+","+sy+" ar -2000,-2000,2000,2000,"+ex+","+ey+","+sx+","+sy+" l0,0 x e'><v:fill color2='white' rotate='t' angle='180' type='gradient'/></v:shape>";
/*
	if(parseInt(vIndex) == 0){
		returnVml += "<v:rect style='position:absolute;border:solid 0px black;left:" + (sx + 3200) + ";width:2500;top:" + (sy + 2600) + ";height:300;z-index:2' filled='false' stroked='false'><v:textbox style='position:absolute;border:solid 0px blue;left:0;top:0;font-size:9pt;'>" + altText + "</v:textbox></v:rect>";
	}else if(parseInt(vIndex) == 1){
		returnVml += "<v:rect style='position:absolute;border:solid 0px black;left:" + (sx + 3000) + ";width:2500;top:" + (sy + 2800) + ";height:300;z-index:2' filled='false' stroked='false'><v:textbox style='position:absolute;border:solid 0px blue;left:0;top:0;font-size:9pt;'>" + altText + "</v:textbox></v:rect>";
	}else if(parseInt(vIndex) == 2){
		returnVml += "<v:rect style='position:absolute;border:solid 0px black;left:" + (sx + 2950) + ";width:2500;top:" + (sy + 3200) + ";height:300;z-index:2' filled='false' stroked='false'><v:textbox style='position:absolute;border:solid 0px blue;left:0;top:0;font-size:9pt;'>" + altText + "</v:textbox></v:rect>";	
	}else if(parseInt(ea/3.6) < 40){
		returnVml += "<v:rect style='position:absolute;border:solid 0px black;left:" + (sx + 2800) + ";width:2500;top:" + (sy + 2900) + ";height:300;z-index:2' filled='false' stroked='false'><v:textbox style='position:absolute;border:solid 0px blue;left:0;top:0;font-size:9pt;'>" + altText + "</v:textbox></v:rect>";
	}else if(parseInt(ea/3.6) >= 40 && parseInt(ea/3.6) < 50){
		returnVml += "<v:rect style='position:absolute;border:solid 0px black;left:" + (sx + 2600) + ";width:2500;top:" + (sy + 2900) + ";height:300;z-index:2' filled='false' stroked='false'><v:textbox style='position:absolute;border:solid 0px blue;left:0;top:0;font-size:9pt;'>" + altText + "</v:textbox></v:rect>";		
	}else if(parseInt(ea/3.6) >= 50 && parseInt(ea/3.6) < 55){	
		returnVml += "<v:rect style='position:absolute;border:solid 0px black;left:" + (sx + 2000) + ";width:2500;top:" + (sy + 3000) + ";height:300;z-index:2' filled='false' stroked='false'><v:textbox style='position:absolute;border:solid 0px blue;left:0;top:0;font-size:9pt;'>" + altText + "</v:textbox></v:rect>";	
	}else if(parseInt(ea/3.6) >= 55 && parseInt(ea/3.6) < 70){		
		returnVml += "<v:rect style='position:absolute;border:solid 0px black;left:" + (sx + 1600) + ";width:2500;top:" + (sy + 3000) + ";height:300;z-index:2' filled='false' stroked='false'><v:textbox style='position:absolute;border:solid 0px blue;left:0;top:0;font-size:9pt;'>" + altText + "</v:textbox></v:rect>";	
	}else{
		returnVml += "<v:rect style='position:absolute;border:solid 0px black;left:" + (sx + 1800) + ";width:2500;top:" + (sy + 2400) + ";height:300;z-index:2' filled='false' stroked='false'><v:textbox style='position:absolute;border:solid 0px blue;left:0;top:0;font-size:9pt;'>" + altText + "</v:textbox></v:rect>";	
	}
*/	
	return returnVml;
}

function createCaky(){//生成饼图的vml代码	
	var oItemNodesList = null;
	var vmlEnd = "";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -