📄 pillarstat.htc
字号:
//y轴刻度线//////////////////////////////////////////////////////
if(booleanYScaleIsInteger && maxPatientNum % 10 != 0){//y轴刻度为整型
maxPatientNum = maxPatientNum + (10 - maxPatientNum % 10);
}
if(i==0){//y轴第一个刻度
vmlExtendCoordinate += "<v:shape style='position:absolute;left:200px;top:" + (2480 - 200*i + vTopDistance) + "px;width:400px;height:100px;z-index:1'><div align='left' style='font-size:8pt;font-weight:bold'>0</div></v:shape>";
}else{//y轴中间刻度
vmlExtendCoordinate += "<v:shape style='position:absolute;left:200px;top:" + (2480 - 200*i + vTopDistance) + "px;width:400px;height:100px;z-index:1'><div align='left' style='font-size:8pt;'>" + Math.round((maxPatientNum/10)*i*100)/100 + "</div></v:shape>";
}
if(i==9){//y轴最后一个刻度
vmlExtendCoordinate += "<v:shape style='position:absolute;left:200px;top:" + (2480 - 200*10 + vTopDistance) + "px;width:400px;height:100px;z-index:1'><div align='left' style='font-size:8pt;'>" + maxPatientNum + "</div></v:shape>";
}
}
//装配扩展坐标系交接线
vmlExtendCoordinate += "<v:line from='700," + (300 + vTopDistance) + "' to='700," + (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>";
for(var i=0;i<intNodeListLength;i++){//装配柱图
//x轴标记值//////////////////////////////////////////////////////
if(booleanHasXText){//是否显示x轴刻度值
if(booleanSlant){//倾斜显示
vmlCaky += "<v:line style='position:absolute;left:" + (800 + i*xScale) + "px;top:" + (2600 + vTopDistance) + "px;width:400px;height:100px;z-index:1;' from='-70,100' to='40,0'><v:path textpathok='true'/><v:textpath on='true' style='font-size:7pt' string='" + oItemNodesList[i].childNodes[0].text + "'/></v:line>";
}else{//水平显示(默认)
vmlCaky += "<v:shape style='position:absolute;left:" + (700 + i*xScale) + "px;top:" + (2600 + vTopDistance) + "px;width:400px;height:100px;z-index:1;' rotation=130><div align='left' style='font-size:9pt;' title='" + oItemNodesList[i].childNodes[0].text + "'>" + oItemNodesList[i].childNodes[0].text + "</div></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:" + (800 + 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:" + (800 + 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>";
}
//vmlCaky += "<v:rect title='" + oItemNodesList[i].childNodes[0].text + "\n数值:" + oItemNodesList[i].childNodes[1].text + " 百分比:0%' style='position:absolute;left:" + (800 + 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>";
//vmlCaky += "<v:oval title='" + oItemNodesList[i].childNodes[0].text + "\n数值:" + oItemNodesList[i].childNodes[1].text + " 百分比:0%' style='position:absolute;left:" + (800 + i*xScale) + "px;top:" + (2430 + vTopDistance) + "px;width:" + pillarWidth + "px;height:0px;z-index:1' fillcolor='" + objPillarColorArray[i] + "'/>";
}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:" + (800 + 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:" + (800 + 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 + "' 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'><div style='padding-left:5;font-size:12px;' title='" + oItemNodesList[i].childNodes[0].text + "'>" + oItemNodesList[i].childNodes[0].text + "</div></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:300px;top:" + (100 + i*130) + "px;width:900px;height:100px;z-index:1'><div style='padding-left:5;font-size:12px;' title='" + oItemNodesList[i].childNodes[0].text + "'>" + oItemNodesList[i].childNodes[0].text + "</div></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='" + 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>";
}
}else{
if(vPsStyle == "2"){//圆柱
vmlLegend += "<v:shape style='position:absolute;left:1200px;top:" + (100 + (i-15)*130) + "px;width:900px;height:100px;z-index:1'><div style='padding-left:5;font-size:12px;' title='" + oItemNodesList[i].childNodes[0].text + "'>" + oItemNodesList[i].childNodes[0].text + "</div></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'><div style='padding-left:5;font-size:12px;' title='" + oItemNodesList[i].childNodes[0].text + "'>" + oItemNodesList[i].childNodes[0].text + "</div></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:line style='position:absolute;left:120px;top:" + (300 + i*130) + ";z-index:1;' from='0,0' to='110,0' strokecolor='red' strokeweight='2pt'><v:stroke EndArrow='Classic'/></v:line>";
vmlLegend += "<v:rect style='position:absolute;left:250px;width:1500;top:" + (220 + i*130) + "px;height:300' filled='false' stroked='false'><v:textbox style='position:absolute;border:solid 0px blue;left:0;top:0;font-size:9pt;color:red;'>总计:" + patientTotal + "</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:" + (800 + 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:" + (800 + 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:" + (800 + 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:" + (800 + 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 + "' color='" + objPillarColorArray[i] + "' 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:1200px;height:100px;z-index:1'><div style='padding-left:5;font-size:12px;' title='" + oItemNodesList[i].childNodes[0].text + "'>" + oItemNodesList[i].childNodes[0].text + "</div></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:300px;top:" + (100 + i*130) + "px;width:1200px;height:100px;z-index:1'><div style='padding-left:5;font-size:12px;' title='" + oItemNodesList[i].childNodes[0].text + "'>" + oItemNodesList[i].childNodes[0].text + "</div></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='" + 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:100px;z-index:1'><div style='padding-left:5;font-size:12px;' title='" + oItemNodesList[i].childNodes[0].text + "'>" + oItemNodesList[i].childNodes[0].text + "</div></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:1200px;height:100px;z-index:1'><div style='padding-left:5;font-size:12px;' title='" + oItemNodesList[i].childNodes[0].text + "'>" + oItemNodesList[i].childNodes[0].text + "</div></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='" + objPillarColorArray[i] + "' on='t'/></v:rect>";
}
}
//总计
if(booleanYScaleIsInteger && i==(intNodeListLength-1)){//
if(intNodeListLength <15){
vmlLegend += "<v:line style='position:absolute;left:120px;top:" + (300 + i*130) + ";z-index:1;' from='0,0' to='110,0' strokecolor='red' strokeweight='2pt'><v:stroke EndArrow='Classic'/></v:line>";
vmlLegend += "<v:rect style='position:absolute;left:250px;width:1500;top:" + (220 + i*130) + "px;height:300' filled='false' stroked='false'><v:textbox style='position:absolute;border:solid 0px blue;left:0;top:0;font-size:9pt;color:red;'>总计:" + patientTotal + "</v:textbox></v:rect>";
//vmlLegend += "<v:roundrect arcsize='6554f' strokeweight='.75pt' style='position:absolute;top:" + (250 + i*130) + "px;left:250;width:70;height:16;cursor:hand' strokecolor='#4F789D' coordsize='21600,21600' title='打印'></v:roundrect>";
}
}
}
}
//柱状图值
if(parseFloat(oItemNodesList[i].childNodes[1].text) == 0){
vmlCaky += "<v:shape style='position:absolute;left:" + (800 + i*xScale + pillarWidth/2 - (oItemNodesList[i].childNodes[1].text.length)*45/2) + "px;top:" + (2290 + vTopDistance) + "px;width:" + pillarWidth + "px;height:100px;z-index:1'><div style='text-align:left;font-size:8pt;color:black;'>0</div></v:shape> ";
}else{
vmlCaky += "<v:shape style='position:absolute;left:" + (800 + i*xScale + pillarWidth/2 - (oItemNodesList[i].childNodes[1].text.length)*45/2) + "px;top:" + (2200 - (2000/maxPatientNum)*(parseFloat(oItemNodesList[i].childNodes[1].text)) + vTopDistance) + "px;width:400px;height:100px;z-index:1'><div style='text-align:left;font-size:8pt;color:black;'>" + oItemNodesList[i].childNodes[1].text + "</div></v:shape> ";
}
}
vmlLegend = "<v:group style='position:absolute;left:4100px;top:" + (200 + vTopDistance) + "px;width:750px;height:900px;z-index:1;' coordsize='900,900'>" + vmlLegend + "</v:group>";
vmlEnd = "<v:group id='" + vTagID + "' style='position:absolute;background:" + vBackColor + ";top:" + vTop + "px;left:" + vLeft + "px;width:" + vWidth + "px;height:" + vHeight + "px;' coordsize='2000,2000'>" + vmlTitle + vmlExtendCoordinate + vmlCaky + vmlLegend + "</v:group>";
objContainerDiv.insertAdjacentHTML("afterBegin",vmlEnd);
}
function createPlanePillar(){//装配水平柱状统计图vml代码
var oItemNodesList = null
var vmlEnd = "";//最终的vml代码
var vmlCaky = "";//柱图vml代码
var vmlLegend = "";//图例vml代码
var vmlTitle = "";//柱图标题vml代码
var vmlExtendCoordinate = "";//扩展坐标系
var intNodeListLength = 0;
var intTitleWidth = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -