xml文档转换程序的一个小应用,几行代码生成饼图。源代码打包提供。
源文档,饼图数据
xml version="1.0" encoding="utf-8"?>
<items>
<title>各指标所占比重title>
<unit>人unit>
<item>
<name>指标一name>
<value>50value>
<description>1description>
item>
<item >
<name>指标二百五十二name>
<value>50value>
<description>2description>
item>
<item>
<name>指标三name>
<value>50value>
<description>3description>
item>
<item>
<name>指标四name>
<value>50value>
<description>4description>
item>
<item>
<name>指标五name>
<value>50value>
<description>5description>
item>
<item>
<name>指标六name>
<value>10value>
<description>6description>
item>
<item>
<name>指标七name>
<value>50value>
<description>7description>
item>
<item>
<name>指标八name>
<value>50value>
<description>8description>
item>
items>
<items>
<title>各指标所占比重title>
<unit>人unit>
<item>
<name>指标一name>
<value>50value>
<description>1description>
item>
<item >
<name>指标二百五十二name>
<value>50value>
<description>2description>
item>
<item>
<name>指标三name>
<value>50value>
<description>3description>
item>
<item>
<name>指标四name>
<value>50value>
<description>4description>
item>
<item>
<name>指标五name>
<value>50value>
<description>5description>
item>
<item>
<name>指标六name>
<value>10value>
<description>6description>
item>
<item>
<name>指标七name>
<value>50value>
<description>7description>
item>
<item>
<name>指标八name>
<value>50value>
<description>8description>
item>
items>
模板文档
xml version&#61;"1.0" encoding&#61;"utf-8"?>
<template rootname&#61;"DIV">
<attribute name&#61;"style" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
$System.Event.EventManager.attachEvent
(
$$("#ctrlid#") , "AfterRender",
function(sender)
{
var cMenu &#61; new $System.UI.ContextMenu($$("#ctrlid#").domid);
//alert(2);
$$("#ctrlid#").addChildNode(cMenu.guid , true);
$$("#ctrlid#").$$secret.codebehind.cMenuGUID &#61; cMenu.guid;
var srcDoc &#61; new $System.XML.XMLUtil.XDOC("root");
var tplDoc &#61; $System.XML.XMLUtil.loadXMLFile("res\\app\\module\\style\\contextmenu.tpl.xml");
cMenu.hide();
cMenu.render(srcDoc , tplDoc);
}
)
$$("#ctrlid#").$$secret.codebehind.showItemDetail &#61; function(itemName , itemValue , itemPercent)
{
//alert();
var cMenu &#61; $$($$(leftFrameGUID).$$secret.codebehind.cMenuGUID);
$(cMenu.guid &#43; "_detail").innerHTML &#61; $System.String.StringUtil.decodeURIComponent(detail);
//alert($(cMenu.guid &#43; "_detail").innerHTML);
cMenu.show(window.event.x , window.event.y);
}
$$("#ctrlid#").$$secret.codebehind.sectorOnMouseOver &#61; function(domid , startAngle , offsetAngle , angle , radius)
{
//$(domid).path &#61; "m0,0l0,0xe";
window.setTimeout("$(&#39;" &#43; domid &#43; "&#39;).path &#61; &#39;m0,0ae0,0,1000,1000," &#43; startAngle &#43;"," &#43; offsetAngle &#43; "xe&#39;" , 10 , "Javascript");
}
$$("#ctrlid#").$$secret.codebehind.sectorOnMouseOut &#61; function(domid , startAngle , offsetAngle , angle , radius)
{
//$(domid).path &#61; "m0,0l0,0xe";
window.setTimeout("$(&#39;" &#43; domid &#43; "&#39;).path &#61; &#39;m0,0ae0,0,850,850," &#43; startAngle &#43;"," &#43; offsetAngle &#43; "xe&#39;" , 10 , "Javascript");
}
//
//图表高、宽
var pContainer &#61; $$("#ctrlid#").getDomObject();
var w &#61; pContainer.style.pixelWidth;
var h &#61; pContainer.style.pixelHeight;
//alert(h);
if(h h &#61; h <(w * 5 / 6) ? h : Math.floor(w * 5 / 6);
}
else{
h &#61; Math.floor(w * 5 / 6);
}
var hv &#61; Math.min(w , h);
var rad &#61; Math.floor(2 * hv / 5);
//alert(rad);
var radius &#61; 1000;
$$("#ctrlid#").$$secret.codebehind.radius &#61; radius;
$$("#ctrlid#").$$secret.codebehind.rad &#61; rad;
//扇区数
var itemNodeList &#61; $$("#sdocguid#").getElementsByTagName("item");
$$("#ctrlid#").$$secret.codebehind.sectorCount &#61; itemNodeList.length;
var nameLengthArray &#61; [];
var maxItemNameLength , cNameLength;
if($$("#ctrlid#").$$secret.codebehind.sectorCount !&#61; 0){
for(iteri &#61; 0 ; iteri <$$("#ctrlid#").$$secret.codebehind.sectorCount; iteri &#43;&#43;){
cNameLength &#61; $System.String.StringUtil.getLengthInCn(itemNodeList.item(iteri).getElementsByTagName("name").item(0).text);
nameLengthArray.push(cNameLength);
}
maxItemNameLength &#61; nameLengthArray.sort
(
function(a , b){
if(a &#61;&#61; b){
return 0;
}
if(a > b){
return 1;
}
return -1;
}
)[nameLengthArray.length - 1];
}
$$("#ctrlid#").$$secret.codebehind.maxItemNameLength &#61; maxItemNameLength;
//图表背景尺寸
var bgLeft &#61; Math.floor((w - 2 * rad - Math.ceil(rad / 9) - Math.ceil(rad / 10) - (maxItemNameLength / 10) * rad) / 2);
//alert(bgLeft);
var bgTop &#61; Math.floor(rad / 7);
//alert(bgTop);
var bgWidth &#61; 2 * rad;
var bgHeight &#61; 2 * rad;
$$("#ctrlid#").$$secret.codebehind.bg &#61; {bgLeft : bgLeft , bgTop : bgTop , bgWidth : bgWidth , bgHeight : bgHeight};
//当前扇区起始角度
$$("#ctrlid#").$$secret.codebehind.cStartAngle &#61; 0;
$$("#ctrlid#").$$secret.codebehind.angleOffset &#61; 0;
$$("#ctrlid#").$$secret.codebehind.cSN &#61; null;
$$("#ctrlid#").$$secret.codebehind.cIndex &#61; 1000;
var strStyle;
strStyle &#61; "border:1px solid red;position:relative;left:0px;top:" &#43; Math.floor((pContainer.style.pixelHeight - h) / 2) &#43; "px;width:" &#43; w &#43; "px;height:" &#43; h &#43; "px;overflow:visible;";
//alert(strStyle);
]]>
statement>
expression>
attribute>
<foreach base&#61;"/item">
<element name&#61;"v:shape">
<attribute name&#61;"coordorigin" value&#61;"-1000,-1000" />
<attribute name&#61;"coordsize" value&#61;"2000,2000" />
<attribute name&#61;"stroked" value&#61;"false" />
<attribute name&#61;"fill" value&#61;"true" />
<element name&#61;"v:fill">
<attribute name&#61;"rotate" value&#61;"true" />
<attribute name&#61;"angle" value&#61;"180" />
<attribute name&#61;"focus" value&#61;"100%" />
<attribute name&#61;"type" value&#61;"gradient" />
<attribute name&#61;"color" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
paramlist>
<statement>
var sn;
if($$("#ctrlid#").$$secret.codebehind.cSN &#61;&#61; null){
$$("#ctrlid#").$$secret.codebehind.cSN &#61; 0;
}
else{
$$("#ctrlid#").$$secret.codebehind.cSN&#43;&#43;;
}
sn &#61; $$("#ctrlid#").$$secret.codebehind.cSN;
var totalCount &#61; $$("#ctrlid#").$$secret.codebehind.sectorCount;
//compute color.
var ar &#61; $System.UI.ColorUtil.genColorArrayOnItemNum(totalCount , 1 , 0.7);
sColor &#61; "rgb(" &#43; ar[sn].r &#43; " " &#43; ar[sn].g &#43; " " &#43; ar[sn].b &#43; ")";
]]>
statement>
expression>
attribute>
<attribute name&#61;"color2" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
paramlist>
<statement>
var sn;
sn &#61; $$("#ctrlid#").$$secret.codebehind.cSN;
var totalCount &#61; $$("#ctrlid#").$$secret.codebehind.sectorCount;
//compute color.
var ar &#61; $System.UI.ColorUtil.genColorArrayOnItemNum(totalCount , 0.5 , 1);
sColor &#61; "rgb(" &#43; ar[sn].r &#43; " " &#43; ar[sn].g &#43; " " &#43; ar[sn].b &#43; ")";
]]>
statement>
expression>
attribute>
element>
<attribute name&#61;"path" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var sn &#61; $$("#ctrlid#").$$secret.codebehind.cSN;
var cldNodeList &#61; $System.XML.XMLUtil.XElement.getElementChildsByTagName($$("#sdocguid#").documentElement , "item");
var totalCount &#61; $$("#ctrlid#").$$secret.codebehind.sectorCount;
var totalValue &#61; 0;
var valueArray &#61; [];
var cValue;
//compute startangle and endangle. degree * (2^16)
for(var ai &#61; 0 ; ai cValue &#61; parseFloat($System.XML.XMLUtil.XElement.getFirstElementChildByTagName(cldNodeList[ai] , "value").firstChild.nodeValue);
valueArray.push(cValue);
totalValue &#43;&#61; cValue;
}
var startAngle &#61; 0;
var angleOffset &#61; 0;
for(var ai &#61; 0 ; ai if(sn !&#61; ai){
startAngle &#43;&#61; (ai % 2 &#61;&#61; 0) ? Math.floor(valueArray[ai] / totalValue * 360 * 65536) : Math.ceil(valueArray[ai] / totalValue * 360 * 65536);
}
else{
angleOffset &#61; ((ai % 2 &#61;&#61; 0) ? Math.floor(valueArray[ai] / totalValue * 360 * 65536) : Math.ceil(valueArray[ai] / totalValue * 360 * 65536));
break;
}
}
if(sn &#61;&#61; (totalCount - 1)){
angleOffset &#61; 360 * 65536 - startAngle;
}
$$("#ctrlid#").$$secret.codebehind.cStartAngle &#61; startAngle;
$$("#ctrlid#").$$secret.codebehind.angleOffset &#61; angleOffset;
//construct the path attribute value.
var sPath;
sPath &#61; "m0,0ae0,0,850,850," &#43; startAngle &#43;"," &#43; angleOffset &#43; "xe";
]]>
statement>
expression>
attribute>
<element name&#61;"v:extrusion">
<attribute name&#61;"on" value&#61;"t" />
<attribute name&#61;"type" value&#61;"parallel" />
<attribute name&#61;"backdepth" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var str;
str &#61; Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 8);
]]>
statement>
expression>
attribute>
<attribute name&#61;"type" value&#61;"parallel" />
<attribute name&#61;"color" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var sn;
sn &#61; $$("#ctrlid#").$$secret.codebehind.cSN;
var totalCount &#61; $$("#ctrlid#").$$secret.codebehind.sectorCount;
//compute color.
var ar &#61; $System.UI.ColorUtil.genColorArrayOnItemNum(totalCount , 1 , 0.7);
sColor &#61; "rgb(" &#43; ar[sn].r &#43; " " &#43; ar[sn].g &#43; " " &#43; ar[sn].b &#43; ")";
]]>
statement>
expression>
attribute>
<attribute name&#61;"metal" value&#61;"t" />
<attribute name&#61;"rotationangle" value&#61;"20,0" />
<attribute name&#61;"skewangle" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var skewangle;
skewangle &#61; 90;
]]>
statement>
expression>
attribute>
element>
<attribute name&#61;"style" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var strStyle;
strStyle &#61; "border:0px solid red;position:absolute;left:" &#43; $$("#ctrlid#").$$secret.codebehind.bg.bgLeft &#43; "px;top:" &#43; $$("#ctrlid#").$$secret.codebehind.bg.bgTop &#43; "px;width:" &#43; $$("#ctrlid#").$$secret.codebehind.bg.bgWidth &#43; "px;height:" &#43; $$("#ctrlid#").$$secret.codebehind.bg.bgHeight &#43; "px;";
//alert(strStyle);
var startAngle &#61; $$("#ctrlid#").$$secret.codebehind.cStartAngle / 65536;
if(startAngle &#61;&#61; 0){
strStyle &#43;&#61; "z-index:" &#43; $$("#ctrlid#").$$secret.codebehind.cIndex;
}
else if(startAngle <90 && startAngle > 0){
strStyle &#43;&#61; "z-index:" &#43; (--$$("#ctrlid#").$$secret.codebehind.cIndex);
}
else if(startAngle >&#61;90 && startAngle <270){
$$("#ctrlid#").$$secret.codebehind.cIndex &#43;&#61; 2;
strStyle &#43;&#61; "z-index:" &#43; $$("#ctrlid#").$$secret.codebehind.cIndex;
}
else{
strStyle &#43;&#61; "z-index:" &#43; (--$$("#ctrlid#").$$secret.codebehind.cIndex);
}
]]>
statement>
expression>
attribute>
<attribute name&#61;"id" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var domid &#61; $System.genGUID();
domid;
]]>
statement>
expression>
attribute>
<attribute name&#61;"onmouseover" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#titleid#" path&#61;"." attr&#61;"id" tdoc&#61;"t" />
paramlist>
<statement>
var startAngle &#61; $$("#ctrlid#").$$secret.codebehind.cStartAngle;
var offsetAngle &#61; $$("#ctrlid#").$$secret.codebehind.angleOffset;
var angleLine &#61; ($$("#ctrlid#").$$secret.codebehind.cStartAngle &#43; $$("#ctrlid#").$$secret.codebehind.angleOffset / 2) / 65536;
var str;
str &#61; "$$(&#39;#ctrlid#&#39;).$$secret.codebehind.sectorOnMouseOver(&#39;#titleid#&#39; , " &#43; startAngle &#43; " , " &#43; offsetAngle &#43; " , " &#43; angleLine &#43; " , " &#43; $$("#ctrlid#").$$secret.codebehind.rad &#43; ")";
//alert(str);
]]>
statement>
expression>
attribute>
<attribute name&#61;"onmouseout" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#titleid#" path&#61;"." attr&#61;"id" tdoc&#61;"t" />
paramlist>
<statement>
var angleLine &#61; ($$("#ctrlid#").$$secret.codebehind.cStartAngle &#43; $$("#ctrlid#").$$secret.codebehind.angleOffset / 2) / 65536;
var str;
str &#61; "$$(&#39;#ctrlid#&#39;).$$secret.codebehind.sectorOnMouseOut(&#39;#titleid#&#39; , " &#43; startAngle &#43; " , " &#43; offsetAngle &#43; " , " &#43; angleLine &#43; " , " &#43; $$("#ctrlid#").$$secret.codebehind.rad &#43; ")";
]]>
statement>
expression>
attribute>
element>
foreach>
<element name&#61;"div">
<attribute name&#61;"style" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var pContainer &#61; $$("#ctrlid#").getDomObject();
var strStyle;
var h &#61; pContainer.style.pixelHeight - Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 4) - Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 8);
var l &#61; $$("#ctrlid#").$$secret.codebehind.bg.bgLeft &#43; $$("#ctrlid#").$$secret.codebehind.bg.bgWidth &#43; Math.ceil($$("#ctrlid#").$$secret.codebehind.rad / 10);
var w &#61; Math.ceil($$("#ctrlid#").$$secret.codebehind.maxItemNameLength / 8) * $$("#ctrlid#").$$secret.codebehind.rad &#43; Math.ceil($$("#ctrlid#").$$secret.codebehind.rad / 12);
strStyle &#61; "border:solid 0px #FF0000;position:absolute;left:" &#43; l &#43; "px;top:" &#43; Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 4) &#43; "px;width:" &#43; w &#43; "px;height:" &#43; h &#43; "px;";
]]>
statement>
expression>
attribute>
<element name&#61;"table">
<attribute name&#61;"height" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var pContainer &#61; $$("#ctrlid#").getDomObject();
var h;
h &#61; pContainer.style.pixelHeight - Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 4) - Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 8);
]]>
statement>
expression>
attribute>
<attribute name&#61;"border" value&#61;"0" />
<attribute name&#61;"align" value&#61;"right" />
<element name&#61;"tr">
<element name&#61;"td">
<attribute name&#61;"align" value&#61;"left" />
<attribute name&#61;"valign" value&#61;"middle" />
<element name&#61;"table">
<attribute name&#61;"border" value&#61;"0" />
<attribute name&#61;"height" value&#61;"1" />
<attribute name&#61;"cellpadding" value&#61;"0" />
<attribute name&#61;"cellspacing" value&#61;"0" />
<foreach base&#61;"/item">
<element name&#61;"tr">
<element name&#61;"td">
<attribute name&#61;"align" value&#61;"center" />
<attribute name&#61;"valign" value&#61;"middle" />
<attribute name&#61;"height" value&#61;"1" />
<element name&#61;"div">
<attribute name&#61;"style" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var strStyle;
var hw &#61; Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 10);
strStyle &#61; "margin:0px;position:relative;top:0px;left:0px;border:0px solid #FF0000;width:" &#43; hw &#43; "px;height:" &#43; hw &#43; "px;padding:0px;";
]]>
statement>
expression>
attribute>
<element name&#61;"v:shape">
<attribute name&#61;"style" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var strStyle;
var hw &#61; Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 10);
strStyle &#61; "margin:0px;position:absolute;top:0px;left:0px;width:" &#43; hw &#43; "px;height:" &#43; hw &#43; "px;";
]]>
statement>
expression>
attribute>
<attribute name&#61;"path" value&#61;"m 0,0 l 0,100 100,100 100,0 x e" />
<attribute name&#61;"coordorigin" value&#61;"0,0" />
<attribute name&#61;"coordsize" value&#61;"100,100" />
<element name&#61;"v:fill">
<attribute name&#61;"rotate" value&#61;"true" />
<attribute name&#61;"angle" value&#61;"180" />
<attribute name&#61;"focus" value&#61;"100%" />
<attribute name&#61;"type" value&#61;"gradient" />
<attribute name&#61;"color" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
if($$("#ctrlid#").$$secret.codebehind.sampleI &#61;&#61; null){
$$("#ctrlid#").$$secret.codebehind.sampleI &#61; 0;
}
var sColor;
var sn &#61; $$("#ctrlid#").$$secret.codebehind.sampleI;
var totalCount &#61; $$("#ctrlid#").$$secret.codebehind.sectorCount;
//compute color.
var ar &#61; $System.UI.ColorUtil.genColorArrayOnItemNum(totalCount , 1 , 0.7);
//$$("#ctrlid#").$$secret.codebehind.cColumnFillColor &#61; ar[sn].r &#43; "," &#43;ar[sn].g &#43; "," &#43;ar[sn].b;
sColor &#61; "rgb(" &#43; ar[sn].r &#43; " " &#43; ar[sn].g &#43; " " &#43; ar[sn].b &#43; ")";
]]>
statement>
expression>
attribute>
<attribute name&#61;"color2" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var sColor;
var sn &#61; $$("#ctrlid#").$$secret.codebehind.sampleI;
var totalCount &#61; $$("#ctrlid#").$$secret.codebehind.sectorCount;
//compute color.
var ar &#61; $System.UI.ColorUtil.genColorArrayOnItemNum(totalCount , 0.5 , 1);
//$$("#ctrlid#").$$secret.codebehind.cColumnFillColor &#61; ar[sn].r &#43; "," &#43;ar[sn].g &#43; "," &#43;ar[sn].b;
$$("#ctrlid#").$$secret.codebehind.sampleI&#43;&#43;;
sColor &#61; "rgb(" &#43; ar[sn].r &#43; " " &#43; ar[sn].g &#43; " " &#43; ar[sn].b &#43; ")";
]]>
statement>
expression>
attribute>
element>
element>
element>
element>
<element name&#61;"td">
<attribute name&#61;"height" value&#61;"1" />
<attribute name&#61;"width" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var ww;
ww &#61; Math.max(Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 30) , 5);
]]>
statement>
expression>
attribute>
<attribute name&#61;"style" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var strStyle;
var hw &#61; Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 8);
strStyle &#61; "margin:0px;padding:0px;height:" &#43; hw &#43; "px;line-height:1px;";
]]>
statement>
expression>
attribute>
<element name&#61;"br" />
element>
<element name&#61;"td">
<attribute name&#61;"height" value&#61;"1" />
<attribute name&#61;"align" value&#61;"left" />
<attribute name&#61;"valign" value&#61;"middle" />
<attribute name&#61;"nowrap" value&#61;"true" />
<attribute name&#61;"style" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var fs &#61; Math.ceil($$("#ctrlid#").$$secret.codebehind.rad / 15) > 9 ? Math.ceil($$("#ctrlid#").$$secret.codebehind.rad / 15) : 9;
strStyle &#61; "padding:0px;margin:0px;height:1px;line-height:" &#43; fs &#43; "px;font-size:" &#43; fs &#43;"px;font-weight:bold;font-family: &#39;Microsoft YaHei&#39;,SimHei,Helvetica,STHeiti,Georgia, &#39;Times New Roman&#39;, Times, serif;";
]]>
statement>
expression>
attribute>
<text path&#61;"./name" />
element>
element>
foreach>
element>
element>
element>
element>
element>
<element name&#61;"div">
<attribute name&#61;"style" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var w &#61; $$("#ctrlid#").getDomStyle("pixelWidth");
var h &#61; Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 6);
var fs &#61; h > 14 ? h : 14;
strStyle &#61; "padding-top:" &#43; Math.floor(fs / 4) &#43; "px;font-size:" &#43; fs &#43; "px;text-align:center;border:solid 0px #FF0000;position:absolute;left:0px;top:0px;width:" &#43; w &#43; "px;height:" &#43; (fs &#43; Math.floor(fs / 4)) &#43; "px;line-height" &#43; (fs &#43; Math.floor(fs / 4)) &#43; "px;font-weight:bold;font-family: &#39;Microsoft YaHei&#39;,SimHei,Helvetica,STHeiti,Georgia, &#39;Times New Roman&#39;, Times, serif;";
]]>
statement>
expression>
attribute>
<text path&#61;"/title" />
element>
template>
<template rootname&#61;"DIV">
<attribute name&#61;"style" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
$System.Event.EventManager.attachEvent
(
$$("#ctrlid#") , "AfterRender",
function(sender)
{
var cMenu &#61; new $System.UI.ContextMenu($$("#ctrlid#").domid);
//alert(2);
$$("#ctrlid#").addChildNode(cMenu.guid , true);
$$("#ctrlid#").$$secret.codebehind.cMenuGUID &#61; cMenu.guid;
var srcDoc &#61; new $System.XML.XMLUtil.XDOC("root");
var tplDoc &#61; $System.XML.XMLUtil.loadXMLFile("res\\app\\module\\style\\contextmenu.tpl.xml");
cMenu.hide();
cMenu.render(srcDoc , tplDoc);
}
)
$$("#ctrlid#").$$secret.codebehind.showItemDetail &#61; function(itemName , itemValue , itemPercent)
{
//alert();
var cMenu &#61; $$($$(leftFrameGUID).$$secret.codebehind.cMenuGUID);
$(cMenu.guid &#43; "_detail").innerHTML &#61; $System.String.StringUtil.decodeURIComponent(detail);
//alert($(cMenu.guid &#43; "_detail").innerHTML);
cMenu.show(window.event.x , window.event.y);
}
$$("#ctrlid#").$$secret.codebehind.sectorOnMouseOver &#61; function(domid , startAngle , offsetAngle , angle , radius)
{
//$(domid).path &#61; "m0,0l0,0xe";
window.setTimeout("$(&#39;" &#43; domid &#43; "&#39;).path &#61; &#39;m0,0ae0,0,1000,1000," &#43; startAngle &#43;"," &#43; offsetAngle &#43; "xe&#39;" , 10 , "Javascript");
}
$$("#ctrlid#").$$secret.codebehind.sectorOnMouseOut &#61; function(domid , startAngle , offsetAngle , angle , radius)
{
//$(domid).path &#61; "m0,0l0,0xe";
window.setTimeout("$(&#39;" &#43; domid &#43; "&#39;).path &#61; &#39;m0,0ae0,0,850,850," &#43; startAngle &#43;"," &#43; offsetAngle &#43; "xe&#39;" , 10 , "Javascript");
}
//
//图表高、宽
var pContainer &#61; $$("#ctrlid#").getDomObject();
var w &#61; pContainer.style.pixelWidth;
var h &#61; pContainer.style.pixelHeight;
//alert(h);
if(h
}
else{
h &#61; Math.floor(w * 5 / 6);
}
var hv &#61; Math.min(w , h);
var rad &#61; Math.floor(2 * hv / 5);
//alert(rad);
var radius &#61; 1000;
$$("#ctrlid#").$$secret.codebehind.radius &#61; radius;
$$("#ctrlid#").$$secret.codebehind.rad &#61; rad;
//扇区数
var itemNodeList &#61; $$("#sdocguid#").getElementsByTagName("item");
$$("#ctrlid#").$$secret.codebehind.sectorCount &#61; itemNodeList.length;
var nameLengthArray &#61; [];
var maxItemNameLength , cNameLength;
if($$("#ctrlid#").$$secret.codebehind.sectorCount !&#61; 0){
for(iteri &#61; 0 ; iteri <$$("#ctrlid#").$$secret.codebehind.sectorCount; iteri &#43;&#43;){
cNameLength &#61; $System.String.StringUtil.getLengthInCn(itemNodeList.item(iteri).getElementsByTagName("name").item(0).text);
nameLengthArray.push(cNameLength);
}
maxItemNameLength &#61; nameLengthArray.sort
(
function(a , b){
if(a &#61;&#61; b){
return 0;
}
if(a > b){
return 1;
}
return -1;
}
)[nameLengthArray.length - 1];
}
$$("#ctrlid#").$$secret.codebehind.maxItemNameLength &#61; maxItemNameLength;
//图表背景尺寸
var bgLeft &#61; Math.floor((w - 2 * rad - Math.ceil(rad / 9) - Math.ceil(rad / 10) - (maxItemNameLength / 10) * rad) / 2);
//alert(bgLeft);
var bgTop &#61; Math.floor(rad / 7);
//alert(bgTop);
var bgWidth &#61; 2 * rad;
var bgHeight &#61; 2 * rad;
$$("#ctrlid#").$$secret.codebehind.bg &#61; {bgLeft : bgLeft , bgTop : bgTop , bgWidth : bgWidth , bgHeight : bgHeight};
//当前扇区起始角度
$$("#ctrlid#").$$secret.codebehind.cStartAngle &#61; 0;
$$("#ctrlid#").$$secret.codebehind.angleOffset &#61; 0;
$$("#ctrlid#").$$secret.codebehind.cSN &#61; null;
$$("#ctrlid#").$$secret.codebehind.cIndex &#61; 1000;
var strStyle;
strStyle &#61; "border:1px solid red;position:relative;left:0px;top:" &#43; Math.floor((pContainer.style.pixelHeight - h) / 2) &#43; "px;width:" &#43; w &#43; "px;height:" &#43; h &#43; "px;overflow:visible;";
//alert(strStyle);
]]>
statement>
expression>
attribute>
<foreach base&#61;"/item">
<element name&#61;"v:shape">
<attribute name&#61;"coordorigin" value&#61;"-1000,-1000" />
<attribute name&#61;"coordsize" value&#61;"2000,2000" />
<attribute name&#61;"stroked" value&#61;"false" />
<attribute name&#61;"fill" value&#61;"true" />
<element name&#61;"v:fill">
<attribute name&#61;"rotate" value&#61;"true" />
<attribute name&#61;"angle" value&#61;"180" />
<attribute name&#61;"focus" value&#61;"100%" />
<attribute name&#61;"type" value&#61;"gradient" />
<attribute name&#61;"color" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
paramlist>
<statement>
var sn;
if($$("#ctrlid#").$$secret.codebehind.cSN &#61;&#61; null){
$$("#ctrlid#").$$secret.codebehind.cSN &#61; 0;
}
else{
$$("#ctrlid#").$$secret.codebehind.cSN&#43;&#43;;
}
sn &#61; $$("#ctrlid#").$$secret.codebehind.cSN;
var totalCount &#61; $$("#ctrlid#").$$secret.codebehind.sectorCount;
//compute color.
var ar &#61; $System.UI.ColorUtil.genColorArrayOnItemNum(totalCount , 1 , 0.7);
sColor &#61; "rgb(" &#43; ar[sn].r &#43; " " &#43; ar[sn].g &#43; " " &#43; ar[sn].b &#43; ")";
]]>
statement>
expression>
attribute>
<attribute name&#61;"color2" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
paramlist>
<statement>
var sn;
sn &#61; $$("#ctrlid#").$$secret.codebehind.cSN;
var totalCount &#61; $$("#ctrlid#").$$secret.codebehind.sectorCount;
//compute color.
var ar &#61; $System.UI.ColorUtil.genColorArrayOnItemNum(totalCount , 0.5 , 1);
sColor &#61; "rgb(" &#43; ar[sn].r &#43; " " &#43; ar[sn].g &#43; " " &#43; ar[sn].b &#43; ")";
]]>
statement>
expression>
attribute>
element>
<attribute name&#61;"path" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var sn &#61; $$("#ctrlid#").$$secret.codebehind.cSN;
var cldNodeList &#61; $System.XML.XMLUtil.XElement.getElementChildsByTagName($$("#sdocguid#").documentElement , "item");
var totalCount &#61; $$("#ctrlid#").$$secret.codebehind.sectorCount;
var totalValue &#61; 0;
var valueArray &#61; [];
var cValue;
//compute startangle and endangle. degree * (2^16)
for(var ai &#61; 0 ; ai
valueArray.push(cValue);
totalValue &#43;&#61; cValue;
}
var startAngle &#61; 0;
var angleOffset &#61; 0;
for(var ai &#61; 0 ; ai
startAngle &#43;&#61; (ai % 2 &#61;&#61; 0) ? Math.floor(valueArray[ai] / totalValue * 360 * 65536) : Math.ceil(valueArray[ai] / totalValue * 360 * 65536);
}
else{
angleOffset &#61; ((ai % 2 &#61;&#61; 0) ? Math.floor(valueArray[ai] / totalValue * 360 * 65536) : Math.ceil(valueArray[ai] / totalValue * 360 * 65536));
break;
}
}
if(sn &#61;&#61; (totalCount - 1)){
angleOffset &#61; 360 * 65536 - startAngle;
}
$$("#ctrlid#").$$secret.codebehind.cStartAngle &#61; startAngle;
$$("#ctrlid#").$$secret.codebehind.angleOffset &#61; angleOffset;
//construct the path attribute value.
var sPath;
sPath &#61; "m0,0ae0,0,850,850," &#43; startAngle &#43;"," &#43; angleOffset &#43; "xe";
]]>
statement>
expression>
attribute>
<element name&#61;"v:extrusion">
<attribute name&#61;"on" value&#61;"t" />
<attribute name&#61;"type" value&#61;"parallel" />
<attribute name&#61;"backdepth" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var str;
str &#61; Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 8);
]]>
statement>
expression>
attribute>
<attribute name&#61;"type" value&#61;"parallel" />
<attribute name&#61;"color" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var sn;
sn &#61; $$("#ctrlid#").$$secret.codebehind.cSN;
var totalCount &#61; $$("#ctrlid#").$$secret.codebehind.sectorCount;
//compute color.
var ar &#61; $System.UI.ColorUtil.genColorArrayOnItemNum(totalCount , 1 , 0.7);
sColor &#61; "rgb(" &#43; ar[sn].r &#43; " " &#43; ar[sn].g &#43; " " &#43; ar[sn].b &#43; ")";
]]>
statement>
expression>
attribute>
<attribute name&#61;"metal" value&#61;"t" />
<attribute name&#61;"rotationangle" value&#61;"20,0" />
<attribute name&#61;"skewangle" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var skewangle;
skewangle &#61; 90;
]]>
statement>
expression>
attribute>
element>
<attribute name&#61;"style" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var strStyle;
strStyle &#61; "border:0px solid red;position:absolute;left:" &#43; $$("#ctrlid#").$$secret.codebehind.bg.bgLeft &#43; "px;top:" &#43; $$("#ctrlid#").$$secret.codebehind.bg.bgTop &#43; "px;width:" &#43; $$("#ctrlid#").$$secret.codebehind.bg.bgWidth &#43; "px;height:" &#43; $$("#ctrlid#").$$secret.codebehind.bg.bgHeight &#43; "px;";
//alert(strStyle);
var startAngle &#61; $$("#ctrlid#").$$secret.codebehind.cStartAngle / 65536;
if(startAngle &#61;&#61; 0){
strStyle &#43;&#61; "z-index:" &#43; $$("#ctrlid#").$$secret.codebehind.cIndex;
}
else if(startAngle <90 && startAngle > 0){
strStyle &#43;&#61; "z-index:" &#43; (--$$("#ctrlid#").$$secret.codebehind.cIndex);
}
else if(startAngle >&#61;90 && startAngle <270){
$$("#ctrlid#").$$secret.codebehind.cIndex &#43;&#61; 2;
strStyle &#43;&#61; "z-index:" &#43; $$("#ctrlid#").$$secret.codebehind.cIndex;
}
else{
strStyle &#43;&#61; "z-index:" &#43; (--$$("#ctrlid#").$$secret.codebehind.cIndex);
}
]]>
statement>
expression>
attribute>
<attribute name&#61;"id" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var domid &#61; $System.genGUID();
domid;
]]>
statement>
expression>
attribute>
<attribute name&#61;"onmouseover" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#titleid#" path&#61;"." attr&#61;"id" tdoc&#61;"t" />
paramlist>
<statement>
var startAngle &#61; $$("#ctrlid#").$$secret.codebehind.cStartAngle;
var offsetAngle &#61; $$("#ctrlid#").$$secret.codebehind.angleOffset;
var angleLine &#61; ($$("#ctrlid#").$$secret.codebehind.cStartAngle &#43; $$("#ctrlid#").$$secret.codebehind.angleOffset / 2) / 65536;
var str;
str &#61; "$$(&#39;#ctrlid#&#39;).$$secret.codebehind.sectorOnMouseOver(&#39;#titleid#&#39; , " &#43; startAngle &#43; " , " &#43; offsetAngle &#43; " , " &#43; angleLine &#43; " , " &#43; $$("#ctrlid#").$$secret.codebehind.rad &#43; ")";
//alert(str);
]]>
statement>
expression>
attribute>
<attribute name&#61;"onmouseout" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#titleid#" path&#61;"." attr&#61;"id" tdoc&#61;"t" />
paramlist>
<statement>
var angleLine &#61; ($$("#ctrlid#").$$secret.codebehind.cStartAngle &#43; $$("#ctrlid#").$$secret.codebehind.angleOffset / 2) / 65536;
var str;
str &#61; "$$(&#39;#ctrlid#&#39;).$$secret.codebehind.sectorOnMouseOut(&#39;#titleid#&#39; , " &#43; startAngle &#43; " , " &#43; offsetAngle &#43; " , " &#43; angleLine &#43; " , " &#43; $$("#ctrlid#").$$secret.codebehind.rad &#43; ")";
]]>
statement>
expression>
attribute>
element>
foreach>
<element name&#61;"div">
<attribute name&#61;"style" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var pContainer &#61; $$("#ctrlid#").getDomObject();
var strStyle;
var h &#61; pContainer.style.pixelHeight - Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 4) - Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 8);
var l &#61; $$("#ctrlid#").$$secret.codebehind.bg.bgLeft &#43; $$("#ctrlid#").$$secret.codebehind.bg.bgWidth &#43; Math.ceil($$("#ctrlid#").$$secret.codebehind.rad / 10);
var w &#61; Math.ceil($$("#ctrlid#").$$secret.codebehind.maxItemNameLength / 8) * $$("#ctrlid#").$$secret.codebehind.rad &#43; Math.ceil($$("#ctrlid#").$$secret.codebehind.rad / 12);
strStyle &#61; "border:solid 0px #FF0000;position:absolute;left:" &#43; l &#43; "px;top:" &#43; Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 4) &#43; "px;width:" &#43; w &#43; "px;height:" &#43; h &#43; "px;";
]]>
statement>
expression>
attribute>
<element name&#61;"table">
<attribute name&#61;"height" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var pContainer &#61; $$("#ctrlid#").getDomObject();
var h;
h &#61; pContainer.style.pixelHeight - Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 4) - Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 8);
]]>
statement>
expression>
attribute>
<attribute name&#61;"border" value&#61;"0" />
<attribute name&#61;"align" value&#61;"right" />
<element name&#61;"tr">
<element name&#61;"td">
<attribute name&#61;"align" value&#61;"left" />
<attribute name&#61;"valign" value&#61;"middle" />
<element name&#61;"table">
<attribute name&#61;"border" value&#61;"0" />
<attribute name&#61;"height" value&#61;"1" />
<attribute name&#61;"cellpadding" value&#61;"0" />
<attribute name&#61;"cellspacing" value&#61;"0" />
<foreach base&#61;"/item">
<element name&#61;"tr">
<element name&#61;"td">
<attribute name&#61;"align" value&#61;"center" />
<attribute name&#61;"valign" value&#61;"middle" />
<attribute name&#61;"height" value&#61;"1" />
<element name&#61;"div">
<attribute name&#61;"style" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var strStyle;
var hw &#61; Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 10);
strStyle &#61; "margin:0px;position:relative;top:0px;left:0px;border:0px solid #FF0000;width:" &#43; hw &#43; "px;height:" &#43; hw &#43; "px;padding:0px;";
]]>
statement>
expression>
attribute>
<element name&#61;"v:shape">
<attribute name&#61;"style" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var strStyle;
var hw &#61; Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 10);
strStyle &#61; "margin:0px;position:absolute;top:0px;left:0px;width:" &#43; hw &#43; "px;height:" &#43; hw &#43; "px;";
]]>
statement>
expression>
attribute>
<attribute name&#61;"path" value&#61;"m 0,0 l 0,100 100,100 100,0 x e" />
<attribute name&#61;"coordorigin" value&#61;"0,0" />
<attribute name&#61;"coordsize" value&#61;"100,100" />
<element name&#61;"v:fill">
<attribute name&#61;"rotate" value&#61;"true" />
<attribute name&#61;"angle" value&#61;"180" />
<attribute name&#61;"focus" value&#61;"100%" />
<attribute name&#61;"type" value&#61;"gradient" />
<attribute name&#61;"color" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
if($$("#ctrlid#").$$secret.codebehind.sampleI &#61;&#61; null){
$$("#ctrlid#").$$secret.codebehind.sampleI &#61; 0;
}
var sColor;
var sn &#61; $$("#ctrlid#").$$secret.codebehind.sampleI;
var totalCount &#61; $$("#ctrlid#").$$secret.codebehind.sectorCount;
//compute color.
var ar &#61; $System.UI.ColorUtil.genColorArrayOnItemNum(totalCount , 1 , 0.7);
//$$("#ctrlid#").$$secret.codebehind.cColumnFillColor &#61; ar[sn].r &#43; "," &#43;ar[sn].g &#43; "," &#43;ar[sn].b;
sColor &#61; "rgb(" &#43; ar[sn].r &#43; " " &#43; ar[sn].g &#43; " " &#43; ar[sn].b &#43; ")";
]]>
statement>
expression>
attribute>
<attribute name&#61;"color2" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var sColor;
var sn &#61; $$("#ctrlid#").$$secret.codebehind.sampleI;
var totalCount &#61; $$("#ctrlid#").$$secret.codebehind.sectorCount;
//compute color.
var ar &#61; $System.UI.ColorUtil.genColorArrayOnItemNum(totalCount , 0.5 , 1);
//$$("#ctrlid#").$$secret.codebehind.cColumnFillColor &#61; ar[sn].r &#43; "," &#43;ar[sn].g &#43; "," &#43;ar[sn].b;
$$("#ctrlid#").$$secret.codebehind.sampleI&#43;&#43;;
sColor &#61; "rgb(" &#43; ar[sn].r &#43; " " &#43; ar[sn].g &#43; " " &#43; ar[sn].b &#43; ")";
]]>
statement>
expression>
attribute>
element>
element>
element>
element>
<element name&#61;"td">
<attribute name&#61;"height" value&#61;"1" />
<attribute name&#61;"width" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var ww;
ww &#61; Math.max(Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 30) , 5);
]]>
statement>
expression>
attribute>
<attribute name&#61;"style" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var strStyle;
var hw &#61; Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 8);
strStyle &#61; "margin:0px;padding:0px;height:" &#43; hw &#43; "px;line-height:1px;";
]]>
statement>
expression>
attribute>
<element name&#61;"br" />
element>
<element name&#61;"td">
<attribute name&#61;"height" value&#61;"1" />
<attribute name&#61;"align" value&#61;"left" />
<attribute name&#61;"valign" value&#61;"middle" />
<attribute name&#61;"nowrap" value&#61;"true" />
<attribute name&#61;"style" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var fs &#61; Math.ceil($$("#ctrlid#").$$secret.codebehind.rad / 15) > 9 ? Math.ceil($$("#ctrlid#").$$secret.codebehind.rad / 15) : 9;
strStyle &#61; "padding:0px;margin:0px;height:1px;line-height:" &#43; fs &#43; "px;font-size:" &#43; fs &#43;"px;font-weight:bold;font-family: &#39;Microsoft YaHei&#39;,SimHei,Helvetica,STHeiti,Georgia, &#39;Times New Roman&#39;, Times, serif;";
]]>
statement>
expression>
attribute>
<text path&#61;"./name" />
element>
element>
foreach>
element>
element>
element>
element>
element>
<element name&#61;"div">
<attribute name&#61;"style" expression&#61;"true">
<expression>
<paramlist>
<param name&#61;"#ctrlid#" path&#61;"/" attr&#61;"controlguid" />
<param name&#61;"#sdocguid#" path&#61;"/" attr&#61;"guid" />
paramlist>
<statement>
var w &#61; $$("#ctrlid#").getDomStyle("pixelWidth");
var h &#61; Math.floor($$("#ctrlid#").$$secret.codebehind.rad / 6);
var fs &#61; h > 14 ? h : 14;
strStyle &#61; "padding-top:" &#43; Math.floor(fs / 4) &#43; "px;font-size:" &#43; fs &#43; "px;text-align:center;border:solid 0px #FF0000;position:absolute;left:0px;top:0px;width:" &#43; w &#43; "px;height:" &#43; (fs &#43; Math.floor(fs / 4)) &#43; "px;line-height" &#43; (fs &#43; Math.floor(fs / 4)) &#43; "px;font-weight:bold;font-family: &#39;Microsoft YaHei&#39;,SimHei,Helvetica,STHeiti,Georgia, &#39;Times New Roman&#39;, Times, serif;";
]]>
statement>
expression>
attribute>
<text path&#61;"/title" />
element>
template>
转换代码
var ctrl1 &#61; new $System.UI.Control("div005");
var srcdoc &#61; $System.XML.XMLUtil.loadXMLFile("ria09\\style\\xmls\\graph_src.xml");
var tpldoc &#61; $System.XML.XMLUtil.loadXMLFile("ria09\\style\\xmls\\graph_3dpie_tpl.xml");
ctrl1.renderE(srcdoc , tpldoc);
var srcdoc &#61; $System.XML.XMLUtil.loadXMLFile("ria09\\style\\xmls\\graph_src.xml");
var tpldoc &#61; $System.XML.XMLUtil.loadXMLFile("ria09\\style\\xmls\\graph_3dpie_tpl.xml");
ctrl1.renderE(srcdoc , tpldoc);
转换结果
代码下载