📄 pillarstat.htc
字号:
width = 130;
height = 25;
visibility = "visible";
}
objContextMenuContainersDiv.focus();
}
function refreshData(){
if(vPsOrientation == "plane"){//水平方向
createPlanePillar();
}else if(vPsOrientation == "plumb"){//垂直方向(默认)
createPlumbPillar();
}
}
function refresh(){//
with(element.style){//element位置
left = vLeft;
top = vTop;
width = vWidth;
height = vHeight;
}
with(objContainerDiv.style){
left = element.style.left;
top = element.style.top;
width = element.style.width;
height = element.style.height;
}
}
function createVMLForWord(){//装配垂直柱状统计图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;
xScale = Math.ceil(2950/intNodeListLength);
yScale = Math.ceil(maxPatientNum/10);
pillarWidth = (2950 - (intNodeListLength+1)*spaceValue)/intNodeListLength;
if(booleanHasLegend){
if(intNodeListLength >15){
intTitleWidth = 4000;
}else{
intTitleWidth = 3500;
}
}else{
intTitleWidth = 3500;
}
/////////装配柱图标题vml代码////////////////////////
if(booleanHasBorder){
vmlTitle = "<v:shape style='position:absolute;left:0px;top:0px;width:"+intTitleWidth+"px;height:300px;text-align:center;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='23'/><w:sz-cs w:val='232'/></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='23'/><w:sz-cs w:val='23'/></w:rPr><w:t>" + vCaption + "</w:t></w:r></w:p></w:txbxContent></v:textbox></v:shape>";
}else{
vmlTitle = "<v:shape style='position:absolute;left:0px;top:80px;width:" + intTitleWidth + "px;height:300px;text-align:center;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='23'/><w:sz-cs w:val='23'/></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='23'/><w:sz-cs w:val='23'/></w:rPr><w:t>" + vCaption + "</w:t></w:r></w:p></w:txbxContent></v:textbox></v:shape>";
}
////////装配扩展坐标系vml代码////////////////
vmlExtendCoordinate += "<v:shape filled='false' style='position:absolute;width:2000;height:2000;top:" + vTopDistance + "px;z-index:1;' path = 'm 0,2500 l 200,2300, 3500,2300, 3200,2500x e'></v:shape><v:shape filled='false' style='position:absolute;top:" + vTopDistance + "px;width:2000;height:2000;z-index:1;' path = 'm 0,2500 l 200,2300,3500,2300,3500,300,200,300,0,500x e'></v:shape>";
//vmlExtendCoordinate += "<v:shape filled='false' style='position:absolute;width:1800;height:2000;top:" + vTopDistance + "px;z-index:1;' path = 'm 0,2500 l 200,2300, 3500,2300, 3300,2500x e'></v:shape><v:shape filled='false' style='position:absolute;top:" + vTopDistance + "px;width:1800;height:2000;z-index:1;' path = 'm 0,2500 l 200,2300,3500,2300,3500,300,200,300,0,500x e'></v:shape>";
for(var i=0;i<10;i++){//装配扩展坐标系
//水平左虚线
vmlExtendCoordinate += "<v:line from='0," + (500 + i*200 + vTopDistance) + "' to='200," + (300 + i*200 + vTopDistance) + "' style='z-index:1;' strokecolor='" + vExtendCoordinateLineColor + "' strokeweight='1pt'/>";
//水平右虚线
vmlExtendCoordinate += "<v:line from='200," + (500 + i*200 + vTopDistance) + "' to='3500," + (500 + i*200 + vTopDistance) + "' style='z-index:1;' strokecolor='" + vExtendCoordinateLineColor + "' strokeweight='1pt'/>";
//y轴刻度线//////////////////////////////////////////////////////
if(booleanYScaleIsInteger && maxPatientNum % 10 != 0){//y轴刻度为整型
maxPatientNum = maxPatientNum + (10 - maxPatientNum % 10);
}
if(i==0){//y轴第一个刻度
vmlExtendCoordinate += "<v:shape style='position:absolute;left:-300px;top:" + (2400 - 200*i + 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>0</w:t></w:r></w:p></w:txbxContent></v:textbox></v:shape>";
}else{//y轴中间刻度
vmlExtendCoordinate += "<v:shape style='position:absolute;left:-300px;top:" + (2400 - 200*i + 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>" + Math.round((maxPatientNum/10)*i*100)/100 + "</w:t></w:r></w:p></w:txbxContent></v:textbox></v:shape>";
}
if(i==9){//y轴最后一个刻度
vmlExtendCoordinate += "<v:shape style='position:absolute;left:-300px;top:" + (2400 - 200*10 + 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>" + maxPatientNum + "</w:t></w:r></w:p></w:txbxContent></v:textbox></v:shape>";
}
}
//装配扩展坐标系交接线
vmlExtendCoordinate += "<v:line from='200," + (300 + vTopDistance) + "' to='200," + (2300 + vTopDistance) + "' style='z-index:1;' strokecolor='" + vExtendCoordinateLineColor + "' strokeweight='1pt'/>";
/////////装配柱图vml代码////////////////////////////////
vmlCaky += "<v:shapetype id='__COLUMN' coordsize='26000,26000' o:spt='22' adj='5400' path='m0,0l0,21600,21600,21600,21600,0xe'><v:path shadowok='t' o:extrusionok='t' strokeok='t' fillok='t' o:connecttype='rect' /><v:stroke joinstyle='miter'/><o:lock v:ext='edit' shapetype='t'/></v:shapetype>";
vmlCaky += '<v:shapetype id="__QINGXIANXIANSHI" coordsize="21600,21600" o:spt="136" adj="10800" path="m@7,l@8,m@5,21600l@6,21600e"><v:formulas><v:f eqn="sum #0 0 10800"/><v:f eqn="prod #0 2 1"/><v:f eqn="sum 21600 0 @1"/><v:f eqn="sum 0 0 @2"/><v:f eqn="sum 21600 0 @3"/><v:f eqn="if @0 @3 0"/><v:f eqn="if @0 21600 @1"/><v:f eqn="if @0 0 @2"/><v:f eqn="if @0 @4 21600"/><v:f eqn="mid @5 @6"/><v:f eqn="mid @8 @5"/><v:f eqn="mid @7 @8"/><v:f eqn="mid @6 @7"/><v:f eqn="sum @6 0 @5"/></v:formulas><v:path textpathok="t" o:connecttype="custom" o:connectlocs="@9,0;@10,10800;@11,21600;@12,10800" o:connectangles="270,180,90,0"/><v:textpath on="t" fitshape="t"/><v:handles><v:h position="#0,bottomRight" xrange="6629,14971"/></v:handles><o:lock v:ext="edit" text="t" shapetype="t"/></v:shapetype>';
for(var i=0;i<intNodeListLength;i++){//装配柱图
//x轴标记值//////////////////////////////////////////////////////
if(booleanHasXText){//是否显示x轴刻度值
if(booleanSlant){//倾斜显示
vmlCaky += '<v:shape id="_x0000_s1037" type="#__QINGXIANXIANSHI" style="position:absolute;left:' + (300 + i*xScale - (parseInt((oItemNodesList[i].childNodes[0].text).length) * 80)/2) + ';top:' + (2600 + vTopDistance) + ';text-align:left;margin-left:-9px;margin-top:23.4px;width:' + (parseInt((oItemNodesList[i].childNodes[0].text).length) * 80) + 'px;height:70px;rotation:21805313fd;z-index:1"><v:shadow color="#868686"/><v:textpath style="font-family:"宋体";font-size:8px;v-text-kern:t" trim="t" fitpath="t" string="' + oItemNodesList[i].childNodes[0].text + '"/></v:shape>';
}else{//水平显示(默认)
vmlCaky += "<v:shape style='position:absolute;left:" + (200 + i*xScale) + "px;top:" + (2600 + vTopDistance) + "px;width:700px;height:200px;z-index:1;' rotation='130'><v:textbox><w:txbxContent><w:p><w:pPr><w:jc w:val='center'/><w:rPr><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='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>";
}
}
//柱状图
if(booleanSingleExtrusionColor){//使用单色填充
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:" + (2200 - (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:" + (2200 - (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 + "' color='black' skewangle='230' 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: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:100px;top:" + (120 + i*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:400px;top:" + (100 + i*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:500px;top:" + (120 + i*130) + "px;width:120px;height:60px;z-index:1;' fillcolor='" + objPillarColorArray[i] + "' strokecolor='black'><v:fill color2='white' rotate='t' type='gradient'/></v:rect>";
}
}else{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -