📄 pillarstat.htc
字号:
if(vPsStyle == "2"){//圆柱
vmlLegend += "<v:shape style='position:absolute;left:1200px;top:" + (100 + (i-15)*130) + "px;width:900px;height:100px;z-index:1'><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>" + oItemNodesList[i].childNodes[0].text + "</w:t></w:r></w:p></w:txbxContent></v:textbox></v:shape><v:rect title='" + oItemNodesList[i].childNodes[0].text + "' style='left:1000px;top:" + (120 + (i-15)*130) + "px;width:120px;height:60px;z-index:1;' fillcolor='white' strokecolor='black'><v:fill color2='" + objPillarColorArray[i] + "' angle='-90' focus='50%' type='gradient'/></v:rect>";
}else{//直方图
vmlLegend += "<v:shape style='position:absolute;left:1200px;top:" + (100 + (i-15)*130) + "px;width:900px;height:100px;z-index:1'><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>" + oItemNodesList[i].childNodes[0].text + "</w:t></w:r></w:p></w:txbxContent></v:textbox></v:shape><v:rect title='" + oItemNodesList[i].childNodes[0].text + "' style='left:1000px;top:" + (120 + (i-15)*130) + "px;width:120px;height:60px;z-index:1;' fillcolor='" + objPillarColorArray[i] + "' strokecolor='black'><v:fill color2='white' rotate='t' type='gradient'/><o:extrusion v:ext='view' backdepth='3' color='black' on='t'/></v:rect>";
}
}
//总计
if(booleanYScaleIsInteger && i==(intNodeListLength-1)){//
if(intNodeListLength <15){
vmlLegend += "<v:rect style='position:absolute;left:200px;width:1500;top:" + (220 + i*130) + "px;height:300' 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>总计:" + patientTotal + "</w:t></w:r></w:p></w:txbxContent></v:textbox></v:rect>";
}
}
}
}else{//使用预置色填充(默认)
if(parseFloat(oItemNodesList[i].childNodes[1].text) == 0){
if(vPsStyle == "2"){//圆柱
vmlCaky += "<v:oval title='" + oItemNodesList[i].childNodes[0].text + "\n数值:" + oItemNodesList[i].childNodes[1].text + " 百分比:0%' style='position:absolute;left:" + (300 + i*xScale) + "px;top:" + (2430 + vTopDistance) + "px;width:" + pillarWidth + "px;height:0px;z-index:1' fillcolor='" + objPillarColorArray[i] + "'/>";
}else{
vmlCaky += "<v:rect title='" + oItemNodesList[i].childNodes[0].text + "\n数值:" + oItemNodesList[i].childNodes[1].text + " 百分比:0%' style='position:absolute;left:" + (300 + i*xScale) + "px;top:" + (2430 + vTopDistance) + "px;width:" + pillarWidth + "px;height:0px;z-index:1' fillcolor='" + objPillarColorArray[i] + "'><o:extrusion v:ext='view' backdepth='" + vExtrusiondepth + "' color='black' skewangle='230' on='t'/></v:rect>";
}
}else{
if(vPsStyle == "2"){//圆柱
vmlCaky += "<v:rect title='" + oItemNodesList[i].childNodes[0].text + "\n数值:" + oItemNodesList[i].childNodes[1].text + " 百分比:" + oItemNodesList[i].childNodes[2].text + "' style='position:absolute;left:" + (300 + i*xScale) + "px;top:" + (2400 - (2000/maxPatientNum)*(parseFloat(oItemNodesList[i].childNodes[1].text)) - 60 + vTopDistance) + "px;width:" + pillarWidth + "px;height:" + ((2000/maxPatientNum)*(parseFloat(oItemNodesList[i].childNodes[1].text)) + 90) + "px;z-index:1' fillcolor='white'><v:fill color2='" + objPillarColorArray[i] + "' angle='-90' focus='50%' type='gradient'/></v:rect>";
}else{//直方图
vmlCaky += "<v:rect title='" + oItemNodesList[i].childNodes[0].text + "\n数值:" + oItemNodesList[i].childNodes[1].text + " 百分比:" + oItemNodesList[i].childNodes[2].text + "' style='position:absolute;left:" + (300 + i*xScale) + "px;top:" + (2400 - (2000/maxPatientNum)*(parseFloat(oItemNodesList[i].childNodes[1].text)) - 60 + vTopDistance) + "px;width:" + pillarWidth + "px;height:" + ((2000/maxPatientNum)*(parseFloat(oItemNodesList[i].childNodes[1].text)) + 90) + "px;z-index:1' fillcolor='" + objPillarColorArray[i] + "'><v:fill color2='white' rotate='t' angle='-180' type='gradient'/><o:extrusion v:ext='view' backdepth='" + vExtrusiondepth + "pt' color='" + objPillarColorArray[i] + "' on='t'/></v:rect>";
}
}
//图例
if(booleanHasLegend){
if(i<15){
if(vPsStyle == "2"){//圆柱
vmlLegend += "<v:shape style='position:absolute;left:300px;top:" + (100 + i*130) + "px;width:1200px;height:200px;z-index:1'><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>" + oItemNodesList[i].childNodes[0].text + "</w:t></w:r></w:p></w:txbxContent></v:textbox></v:shape><v:rect title='" + oItemNodesList[i].childNodes[0].text + "' style='left:100px;top:" + (120 + i*130) + "px;width:120px;height:120px;z-index:1;' fillcolor='white' strokecolor='black'><v:fill color2='" + objPillarColorArray[i] + "' angle='-90' focus='50%' type='gradient'/></v:rect>";
}else{//直方图
vmlLegend += "<v:shape style='position:absolute;left:200px;top:" + (85 + i*130) + "px;width:1200px;height:200px;z-index:1'><v:textbox><w:txbxContent><w:p><w:pPr><w:jc w:val='center'/><w:rPr><w:b-cs/><w:sz w:val='18'/><w:sz-cs w:val='18'/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:hint='fareast'/><wx:font wx:val='宋体'/><w:b-cs/><w:sz w:val='18'/><w:sz-cs w:val='18'/></w:rPr><w:t>" + oItemNodesList[i].childNodes[0].text + "</w:t></w:r></w:p></w:txbxContent></v:textbox></v:shape><v:rect title='" + oItemNodesList[i].childNodes[0].text + "' style='left:200px;top:" + (120 + i*130) + "px;width:120px;height:120px;z-index:1;' fillcolor='" + objPillarColorArray[i] + "' strokecolor='black'><v:fill color2='white' rotate='t' type='gradient'/><o:extrusion v:ext='view' backdepth='3' color='" + objPillarColorArray[i] + "' on='t'/></v:rect>";
}
}else{
if(vPsStyle == "2"){//圆柱
vmlLegend += "<v:shape style='position:absolute;left:1200px;top:" + (100 + (i-15)*130) + "px;width:1200px;height:200px;z-index:1'><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>" + oItemNodesList[i].childNodes[0].text + "</w:t></w:r></w:p></w:txbxContent></v:textbox></v:shape><v:rect title='" + oItemNodesList[i].childNodes[0].text + "' style='left:1000px;top:" + (120 + (i-15)*130) + "px;width:120px;height:120px;z-index:1;' fillcolor='white' strokecolor='black'><v:fill color2='" + objPillarColorArray[i] + "' angle='-90' focus='50%' type='gradient'/></v:rect>";
}else{//直方图
vmlLegend += "<v:shape style='position:absolute;left:1200px;top:" + (100 + (i-15)*130) + "px;width:1200px;height:200px;z-index:1'><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>" + oItemNodesList[i].childNodes[0].text + "</w:t></w:r></w:p></w:txbxContent></v:textbox></v:shape><v:rect title='" + oItemNodesList[i].childNodes[0].text + "' style='left:1000px;top:" + (120 + (i-15)*130) + "px;width:120px;height:120px;z-index:1;' fillcolor='" + objPillarColorArray[i] + "' strokecolor='black'><v:fill color2='white' rotate='t' type='gradient'/><o:extrusion v:ext='view' backdepth='" + vExtrusiondepth + "pt' color='" + objPillarColorArray[i] + "' on='t'/></v:rect>";
}
}
//总计
if(booleanYScaleIsInteger && i==(intNodeListLength-1)){//
if(intNodeListLength <15){
vmlLegend += "<v:rect style='position:absolute;left:350px;width:1500;top:" + (220 + i*130) + "px;height:200' filled='false' stroked='false'><v:textbox><w:txbxContent><w:p><w:pPr><w:jc w:val='left'/><w:rPr><w:b-cs/><w:sz w:val='18'/><w:sz-cs w:val='18'/></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='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(parseFloat(oItemNodesList[i].childNodes[1].text) == 0){
vmlCaky += "<v:shape style='position:absolute;left:" + (200 + i*xScale + pillarWidth/2 - (oItemNodesList[i].childNodes[1].text.length)*45/2) + "px;top:" + (2290 + vTopDistance) + "px;width:" + pillarWidth + "px;height:200px;z-index:1'><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>0</w:t></w:r></w:p></w:txbxContent></v:textbox></v:shape> ";
}else{
vmlCaky += "<v:shape style='position:absolute;left:" + (200 + i*xScale + pillarWidth/2 - (oItemNodesList[i].childNodes[1].text.length)*45/2) + "px;top:" + (2100 - (2000/maxPatientNum)*(parseFloat(oItemNodesList[i].childNodes[1].text)) + vTopDistance) + "px;width:400px;height:200px;z-index:1'><v:textbox><w:txbxContent><w:p><w:pPr><w:jc w:val='center'/><w:rPr><w:b-cs/><w:sz w:val='15 '/><w:sz-cs w:val='15'/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:hint='fareast'/><wx:font wx:val='宋体'/><w:b-cs/><w:sz w:val='15'/><w:sz-cs w:val='15'/></w:rPr><w:t>" + oItemNodesList[i].childNodes[1].text + "</w:t></w:r></w:p></w:txbxContent></v:textbox></v:shape> ";
}
}
vmlLegend = "<v:group style='position:absolute;left:3500px;top:" + (200 + vTopDistance) + "px;width:750px;height:900px;z-index:1;' coordsize='900,900'>" + vmlLegend + "</v:group>";
vmlEnd = "<v:group style='position:absolute;background:" + vBackColor + ";top:" + vTop + "px;left:" + vLeft + "px;width:260px;height:260px;' coordsize='2000,2000'>" + vmlTitle + vmlExtendCoordinate + vmlCaky + vmlLegend + "</v:group>";
return vmlEnd;
}
////////////////////////////////////////////////////////////////
function createPlumbPillar(){//装配垂直柱状统计图vml代码
var oItemNodesList = null
var vmlEnd = "";//最终的vml代码
var vmlCaky = "";//柱图vml代码
var vmlLegend = "";//图例vml代码
var vmlTitle = "";//柱图标题vml代码
var vmlExtendCoordinate = "";//扩展坐标系
var xScale = 0;
var yScale = 0;
var intNodeListLength = 0;
var intTitleWidth = 0;
var vTopDistance = 100;
var spaceValue = 100;
var pillarWidth = 0;
if(!objXMLDoc) return;
var oItemNodesList = objXMLDoc.selectNodes("//root/item");//区域节点
intNodeListLength = oItemNodesList.length;
if(!oItemNodesList || oItemNodesList.length==0){
objContainerDiv.style.background = "#cccccc";
with(objInfoSpan.style){
visibility = "visible";
width = 120;
height = 30;
left = (parseInt(objContainerDiv.style.width) + parseInt(element.offsetLeft))/2 - parseInt(objInfoSpan.style.width)/2;
top = (parseInt(objContainerDiv.style.height) + parseInt(element.offsetTop))/2 - parseInt(objInfoSpan.style.height)/2;
}
objInfoSpan.innerText = "数据加载失败......";
return;
}else{
objContainerDiv.innerHTML = "";
objContainerDiv.style.background = "";
objInfoSpan.innerText = "";
}
xScale = Math.ceil(2950/intNodeListLength);
yScale = Math.ceil(maxPatientNum/10);
pillarWidth = (2950 - (intNodeListLength+1)*spaceValue)/intNodeListLength;
if(booleanHasLegend){
if(intNodeListLength >15){
intTitleWidth = 5900;
}else{
intTitleWidth = 5100;
}
}else{
intTitleWidth = 4400;
}
/////////装配柱图标题vml代码////////////////////////
if(booleanHasBorder){
vmlTitle = "<v:rect style='position:absolute;width:" + intTitleWidth + "px;height:" + (2900 + vTopDistance) + "px;z-index:1;' coordsize='21600,21600' filled='false' strokecolor='" + vBorderColor + "' strokeweight='" + vBorderWeight + "'></v:rect><v:shape style='position:absolute;left:0px;top:80px;width:" + intTitleWidth + "px;height:400px;text-align:center;z-index:1'><div style='font-size:10.5pt;font-weight:bold;'>" + vCaption + "</div></v:shape>";
}else{
vmlTitle = "<v:rect style='position:absolute;width:" + intTitleWidth + "px;height:" + (2900 + vTopDistance) + "px;z-index:1;' coordsize='21600,21600' fillcolor='white' stroked='false'></v:rect><v:shape style='position:absolute;left:0px;top:80px;width:" + intTitleWidth + "px;height:400px;text-align:center;z-index:1'><div style='font-size:10.5pt;font-weight:bold;'>" + vCaption + "</div></v:shape>";
}
////////装配扩展坐标系vml代码////////////////
vmlExtendCoordinate += "<v:shape id='boxbottom' FillColor='" + vExtendCoordinateBaseColor + "'style='position:absolute;width:2000;height:2000;top:" + vTopDistance + "px;z-index:1;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=40);' path = 'm 500,2500 l 700,2300,4000,2300,3800,2500,500,2500,x e'><v:fill color2='white' rotate='t' angle='110' type='gradient'/></v:shape><v:shape id='boxleft' fillColor='" + vExtendCoordinateBackColor + "'style='position:absolute;top:" + vTopDistance + "px;width:2000;height:2000;z-index:1;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=60);' path = 'm 500,2500 l 700,2300,4000,2300,4000,300,700,300,500,500,500,2500,x e'><v:fill color2='white' rotate='t' angle='170' type='gradient'/></v:shape>";
for(var i = 0; i < 10; i++){//装配扩展坐标系
//水平左虚线
vmlExtendCoordinate += "<v:line from='500," + (500 + i*200 + vTopDistance) + "' to='700," + (300 + i*200 + vTopDistance) + "' style='z-index:1;' strokecolor='" + vExtendCoordinateLineColor + "' strokeweight='1pt'/>";
//水平右虚线
vmlExtendCoordinate += "<v:line from='700," + (300 + i*200 + vTopDistance) + "' to='4000," + (300 + i*200 + vTopDistance) + "' style='z-index:1;' strokecolor='" + vExtendCoordinateLineColor + "' strokeweight='1pt'/>";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -