插件地址 :http://www.maani.us/xml_charts/index.php
C# :
1 FileStream fs = File.Open(Server.MapPath("~/Admin/CaiWuGuanLi/sample.xml"), FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite); 2 fs.SetLength(0); 3 4 byte[] bytes = Encoding.UTF8.GetBytes(xmlText); 5 fs.Write(bytes, 0, bytes.Length); 6 fs.Close();
sample.xml :
1 <?xml version="1.0" encoding="utf-8" ?> 2 <chart><chart_transition type="slide_right" delay="1" duration="2" order="series" /> 3 <chart_type>3d pie</chart_type> 4 <legend font="system" size="7"></legend> 5 <legend shadow="low" layout="horizontal" margin="20" x="65" y="-10" width="345" height="25" fill_alpha="0" color="000000" alpha="75" /> 6 <chart_data> 7 <row> 8 <null/> 9 <string>网银 9611.70</string> 10 <string>点卡 4531.00</string> 11 <string>其他 95840.70</string> 12 <string>支付宝 20.30</string> 13 <string>财付通 108.30</string> 14 </row> 15 <row> 16 <string>Region A</string> 17 <number>9611.70</number> 18 <number>4531.00</number> 19 <number>95840.70</number> 20 <number>20.30</number> 21 <number>108.30</number> 22 </row> 23 </chart_data> 24 </chart>
HTML:
1 <!-- 圆饼统计 --> 2 <div id="div_flashGrapTxt" runat="server"> </div> 3 <div style="display:none" id="div_flashGrap" runat="server"> 4 <script language="JavaScript" type="text/javascript"> 5 6 if (AC_FL_RunContent == 0 || DetectFlashVer == 0) { 7 alert("This page requires AC_RunActiveContent.js."); 8 } else { 9 var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision); 10 if (hasRightVersion) { 11 AC_FL_RunContent( 12 'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,45,2', 13 'width', '750', 14 'height', '320', 15 'scale', 'noscale', 16 'salign', 'TL', 17 'bgcolor', '#E8F3FC', 18 'wmode', 'opaque', 19 'movie', 'charts', 20 'src', 'charts', 21 'FlashVars', 'library_path=charts_library&xml_source=sample.xml', 22 'id', 'my_chart', 23 'name', 'my_chart', 24 'menu', 'true', 25 'allowFullScreen', 'true', 26 'allowScriptAccess', 'sameDomain', 27 'quality', 'high', 28 'align', 'middle', 29 'pluginspage', 'http://www.macromedia.com/go/getflashplayer', 30 'play', 'true', 31 'devicefont', 'false' 32 ); 33 } else { 34 var alternateContent = 'This content requires the Adobe Flash Player. ' 35 + '<u><a href=http://www.macromedia.com/go/getflash/>Get Flash</a></u>.'; 36 document.write(alternateContent); 37 } 38 } 39 </script> 40 </div> 41 <!-- 圆饼统计 -->