Sign in to follow this  
Luohui

Error

Recommended Posts

Read the attachment first

 

window.onload = function () {
            var _today = new Date();
           document.getElementById("I_REPDT").value = (_today.addDays(-2)).toString("yyyyMMdd");
           var _I_REPDT = document.getElementById("I_REPDT").value; 
           var _I_WAERS = document.getElementById("I_WAERS").value; 
           var _I_PHQTY = "1000"; //            

           var xmlhttp = Utility.XmlHttpRequest.getXmlHttp();
           xmlhttp.open("POST", "Item.aspx?r=" + Math.random() + "&I_REPDT=" + _I_REPDT + "&I_WAERS=" + _I_WAERS + "&I_PHQTY=" + _I_PHQTY, true);
           xmlhttp.onreadystatechange = function () {
               if (xmlhttp.readyState == 4) {
                   if (xmlhttp.status == 200) {
                       xmldoc = xmlhttp.responseXML;
                       //
                       fillingChart(); 
                       //
                   }
               }
           }
           xmlhttp.send(null);
       }

function fillingChart() {
           chartDayDailyXml = getChartXml("日日发生额", "DAY");
           chartGrandTotalXml = getChartXml("日别累计(当月)", "MON");

           if (!FusionCharts("_li_01_content_day_daily_normal_chart_id")) {
               var chart_Day_Daily = new FusionCharts("Utility/FusionCharts/Charts/MSCombiDY2D1.swf", "_li_01_content_day_daily_normal_chart_id", chartWidth, chartHeight, "0", "1");
               chart_Day_Daily.setXMLData(chartDayDailyXml);
               chart_Day_Daily.render("li_01_content_day_daily_normal_chart");
           }
           else {
               //var chart_Day_Daily = FusionCharts("_li_01_content_day_daily_normal_chart_id");
               //chart_Day_Daily.setXMLData(chartDayDailyXml);//为什么不自动重绘??

               var chart_Day_Daily = FusionCharts("_li_01_content_day_daily_normal_chart_id");
               chart_Day_Daily.dispose();

               var chart_Day_Daily = new FusionCharts("Utility/FusionCharts/Charts/MSCombiDY2D1.swf", "_li_01_content_day_daily_normal_chart_id", chartWidth, chartHeight, "0", "1");
               chart_Day_Daily.setXMLData(chartDayDailyXml);
               chart_Day_Daily.render("li_01_content_day_daily_normal_chart");                              
           }
           //
           if (!FusionCharts("_li_01_content_day_grand_total_chart_id")) {
               var chart_Grand_Total = new FusionCharts("Utility/FusionCharts/Charts/MSCombiDY2D1.swf", "_li_01_content_day_grand_total_chart_id", chartWidth, chartHeight, "0", "1");
               chart_Grand_Total.setXMLData(chartGrandTotalXml);
               chart_Grand_Total.render("li_01_content_day_grand_total_chart");
           }
           else {
               //var chart_Grand_Total = FusionCharts("_li_01_content_day_grand_total_chart_id");
               //chart_Grand_Total.setXMLData(chartGrandTotalXml);

               var chart_Grand_Total = FusionCharts("_li_01_content_day_grand_total_chart_id");
               chart_Grand_Total.dispose();

               var chart_Grand_Total = new FusionCharts("Utility/FusionCharts/Charts/MSCombiDY2D1.swf", "_li_01_content_day_grand_total_chart_id", chartWidth, chartHeight, "0", "1");
               chart_Grand_Total.setXMLData(chartGrandTotalXml);
               chart_Grand_Total.render("li_01_content_day_grand_total_chart");
           }
       }

function getDataList() {
           var _dateList = [];

           var _date = document.getElementById("I_REPDT").value;
           var _regExp = new RegExp("^([0-9]{4})([0-9]{1,2})([0-9]{1,2})$");
           var _date_temp = _regExp.exec(_date);
           if (_date_temp != null) {
               var _i_year = parseFloat(_date_temp[1]); // 年
               var _i_month = parseFloat(_date_temp[2]); // 月  
               var _i_day = parseFloat(_date_temp[3]); // 日

               var _today = new Date(_i_year+"/"+_i_month+"/"+_i_day)
               _dateList[0] = _today.getMonth()+1 + "." + _today.toString("dd");
               _dateList[1] = _today.addDays(-1).getMonth() + 1 + "." + _today.toString("dd");
               _dateList[2] = _today.addDays(-1).getMonth() + 1 + "." + _today.toString("dd");
               _dateList[3] = _today.addDays(-1).getMonth() + 1 + "." + _today.toString("dd");
               _dateList[4] = _today.addDays(-1).getMonth() + 1 + "." + _today.toString("dd");
               _dateList[5] = _today.addDays(-1).getMonth() + 1 + "." + _today.toString("dd");
               _dateList[6] = _today.addDays(-1).getMonth() + 1 + "." + _today.toString("dd");
           }
           else {
               var _today = new Date();
               document.getElementById("I_REPDT").value = (_today.addDays(-2)).toString("yyyyMMdd");

               _today = new Date();
               _dateList[0] = _today.getMonth() + 1 + "." + _today.toString("dd");
               _dateList[1] = _today.addDays(-1).getMonth() + 1 + "." + _today.toString("dd");
               _dateList[2] = _today.addDays(-1).getMonth() + 1 + "." + _today.toString("dd");
               _dateList[3] = _today.addDays(-1).getMonth() + 1 + "." + _today.toString("dd");
               _dateList[4] = _today.addDays(-1).getMonth() + 1 + "." + _today.toString("dd");
               _dateList[5] = _today.addDays(-1).getMonth() + 1 + "." + _today.toString("dd");
               _dateList[6] = _today.addDays(-1).getMonth() + 1 + "." + _today.toString("dd");
           }
           return _dateList;
       }      
       function getChartXml(caption,zztyp) {
           var _today = new Date();
           var _dateList = getDataList();

           var CLSDT = window.clsdt;

           var _xmlStr = "";
           _xmlStr += "<chart caption=\"" + caption + "\" showValues=\"0\" sNumberSuffix=\"%\" baseFont='Arial' baseFontSize ='34' baseFontColor=\"464547\" decimals=\"1\" setAdaptiveYMin=\"1\" setAdaptiveSYMin=\"1\" lineThickness=\"1\" stack100percent=\"0\" canvasbgangle=\"0\" canvasborderthickness=\"2\" chartleftmargin=\"15\" chartrightmargin=\"5\" basefontsize=\"10\" outcnvbasefontsize=\"11\" bgcolor=\"E2E8F0\" showcumulativeline=\"1\" linecolor=\"D3AF1D\" showplotborder=\"1\" plotgradientcolor=\"\" plotbordercolor=\"F5BA00\" showcanvasbg=\"1\" showcanvasbase=\"1\" canvasbgcolor=\"ffffff\" canvasbgalpha=\"90\" canvasbasecolor=\"D3DBCA\" showalternatehgridcolor=\"0\" showborder=\"0\" canvasborderalpha=\"20\" divlinealpha=\"15\" showshadow=\"1\" plotfillangle=\"100\" plotfillratio=\"\" plotborderdashed=\"0\" plotborderdashlen=\"1\" anchorradius=\"3\" anchorbgcolor=\"FFFFFF\" anchorborderthickness=\"3\" linethickness=\"2\" canvasBorderThickness=\"1\" canvasBorderColor=\"74787C\" numDivLines=\"2\" showFCMenuItem=\"0\" chartTopMargin=\"10\" chartBottomMargin=\"0\" captionPadding=\"10\" labelPadding=\"0\" PYAxisMinValue=\"0\"  PYAxisMaxValue=\"50\" SYAxisMinValue=\"0\"  SYAxisMaxValue=\"40\">";
           _xmlStr += "    <categories>";
           _xmlStr += "        <category label=\"" + _dateList[6] + "\"/>";
           _xmlStr += "        <category label=\"" + _dateList[5] + "\" />";
           _xmlStr += "        <category label=\"" + _dateList[4] + "\" />";
           _xmlStr += "        <category label=\"" + _dateList[3] + "\" />";
           _xmlStr += "        <category label=\"" + _dateList[2] + "\" />";
           _xmlStr += "        <category label=\"" + _dateList[1] + "\" />";
           _xmlStr += "        <category label=\"" + _dateList[0] + "\" />";
           _xmlStr += "    </categories>";
           _xmlStr += "    <dataset seriesname=\"\" color=\"F5BA00\">";
           node = xmldoc.selectSingleNode("//rs:data/z:row[@ZZTYP='" + zztyp + "' and @CLSDT='" + CLSDT + "' and @CLS01='' and @CLS02='']"); //金额
           if (node != null) {
               _xmlStr += "    <set value=\"" + parseFloat(node.getAttribute("AMT01")).toFixed(0) + "\" hoverText=\"" + parseFloat(node.getAttribute("AMT01")).toFixed(0) + "\"/>";
               _xmlStr += "    <set value=\"" + parseFloat(node.getAttribute("AMT02")).toFixed(0) + "\" hoverText=\"" + parseFloat(node.getAttribute("AMT02")).toFixed(0) + "\"/>";
               _xmlStr += "    <set value=\"" + parseFloat(node.getAttribute("AMT03")).toFixed(0) + "\" hoverText=\"" + parseFloat(node.getAttribute("AMT03")).toFixed(0) + "\"/>";
               _xmlStr += "    <set value=\"" + parseFloat(node.getAttribute("AMT04")).toFixed(0) + "\" hoverText=\"" + parseFloat(node.getAttribute("AMT04")).toFixed(0) + "\"/>";
               _xmlStr += "    <set value=\"" + parseFloat(node.getAttribute("AMT05")).toFixed(0) + "\" hoverText=\"" + parseFloat(node.getAttribute("AMT05")).toFixed(0) + "\"/>";
               _xmlStr += "    <set value=\"" + parseFloat(node.getAttribute("AMT06")).toFixed(0) + "\" hoverText=\"" + parseFloat(node.getAttribute("AMT06")).toFixed(0) + "\"/>";
               _xmlStr += "    <set value=\"" + parseFloat(node.getAttribute("AMT07")).toFixed(0) + "\" hoverText=\"" + parseFloat(node.getAttribute("AMT07")).toFixed(0) + "\"/>";
           }
           else {
               _xmlStr += "    <set value=\"0\" hoverText=\"0\"/>";
               _xmlStr += "    <set value=\"0\" hoverText=\"0\"/>";
               _xmlStr += "    <set value=\"0\" hoverText=\"0\"/>";
               _xmlStr += "    <set value=\"0\" hoverText=\"0\"/>";
               _xmlStr += "    <set value=\"0\" hoverText=\"0\"/>";
               _xmlStr += "    <set value=\"0\" hoverText=\"0\"/>";
               _xmlStr += "    <set value=\"0\" hoverText=\"0\"/>";
           }
           _xmlStr += "    </dataset>";
           _xmlStr += "    <dataset parentYAxis=\"S\" seriesname=\"\" lineThickness=\"2\" color=\"5AC724\" anchorSides=\"3\" anchorRadius=\"7\" anchorBorderThickness=\"1\" anchorBorderColor=\"5AC724\" anchorBgColor=\"5AC724\">";
           node = xmldoc.selectSingleNode("//rs:data/z:row[@ZZTYP='" + zztyp + "' and @CLSDT='" + CLSDT + "' and @CLS01='PER' and @CLS02='']"); //挑战
           if (node != null) {
               _xmlStr += "        <set value=\"" + (parseFloat(parseFloat(node.getAttribute("PER01")).toFixed(1)) > 40 ? 40 : parseFloat(node.getAttribute("PER01")).toFixed(1)) + "\" hoverText=\"" + parseFloat(node.getAttribute("PER01")).toFixed(1) + "%\"/>";
               _xmlStr += "        <set value=\"" + (parseFloat(parseFloat(node.getAttribute("PER02")).toFixed(1)) > 40 ? 40 : parseFloat(node.getAttribute("PER02")).toFixed(1)) + "\" hoverText=\"" + parseFloat(node.getAttribute("PER02")).toFixed(1) + "%\"/>";
               _xmlStr += "        <set value=\"" + (parseFloat(parseFloat(node.getAttribute("PER03")).toFixed(1)) > 40 ? 40 : parseFloat(node.getAttribute("PER03")).toFixed(1)) + "\" hoverText=\"" + parseFloat(node.getAttribute("PER03")).toFixed(1) + "%\"/>";
               _xmlStr += "        <set value=\"" + (parseFloat(parseFloat(node.getAttribute("PER04")).toFixed(1)) > 40 ? 40 : parseFloat(node.getAttribute("PER04")).toFixed(1)) + "\" hoverText=\"" + parseFloat(node.getAttribute("PER04")).toFixed(1) + "%\"/>";
               _xmlStr += "        <set value=\"" + (parseFloat(parseFloat(node.getAttribute("PER05")).toFixed(1)) > 40 ? 40 : parseFloat(node.getAttribute("PER05")).toFixed(1)) + "\" hoverText=\"" + parseFloat(node.getAttribute("PER05")).toFixed(1) + "%\"/>";
               _xmlStr += "        <set value=\"" + (parseFloat(parseFloat(node.getAttribute("PER06")).toFixed(1)) > 40 ? 40 : parseFloat(node.getAttribute("PER06")).toFixed(1)) + "\" hoverText=\"" + parseFloat(node.getAttribute("PER06")).toFixed(1) + "%\"/>";
               _xmlStr += "        <set value=\"" + (parseFloat(parseFloat(node.getAttribute("PER07")).toFixed(1)) > 40 ? 40 : parseFloat(node.getAttribute("PER07")).toFixed(1)) + "\" hoverText=\"" + parseFloat(node.getAttribute("PER07")).toFixed(1) + "%\"/>";
           }
           else {
               _xmlStr += "    <set value=\"0\" hoverText=\"0.0%\"/>";
               _xmlStr += "    <set value=\"0\" hoverText=\"0.0%\"/>";
               _xmlStr += "    <set value=\"0\" hoverText=\"0.0%\"/>";
               _xmlStr += "    <set value=\"0\" hoverText=\"0.0%\"/>";
               _xmlStr += "    <set value=\"0\" hoverText=\"0.0%\"/>";
               _xmlStr += "    <set value=\"0\" hoverText=\"0.0%\"/>";
               _xmlStr += "    <set value=\"0\" hoverText=\"0.0%\"/>";
           }
           _xmlStr += "    </dataset>";
           _xmlStr += "    <dataset parentYAxis=\"S\" seriesname=\"\" lineThickness=\"2\" color=\"733AE0\" anchorSides=\"8\" anchorRadius=\"5\" anchorBorderThickness=\"1\" anchorBorderColor=\"733AE0\" anchorBgColor=\"733AE0\">";
           node = xmldoc.selectSingleNode("//rs:data/z:row[@ZZTYP='" + zztyp + "' and @CLSDT='" + CLSDT + "' and @CLS01='' and @CLS02='']"); //实绩
           if (node != null) {
               _xmlStr += "        <set value=\"" + (parseFloat(parseFloat(node.getAttribute("PER01")).toFixed(1)) > 40 ? 40 : parseFloat(node.getAttribute("PER01")).toFixed(1)) + "\" hoverText=\"" + parseFloat(node.getAttribute("PER01")).toFixed(1) + "%\"/>";
               _xmlStr += "        <set value=\"" + (parseFloat(parseFloat(node.getAttribute("PER02")).toFixed(1)) > 40 ? 40 : parseFloat(node.getAttribute("PER02")).toFixed(1)) + "\" hoverText=\"" + parseFloat(node.getAttribute("PER02")).toFixed(1) + "%\"/>";
               _xmlStr += "        <set value=\"" + (parseFloat(parseFloat(node.getAttribute("PER03")).toFixed(1)) > 40 ? 40 : parseFloat(node.getAttribute("PER03")).toFixed(1)) + "\" hoverText=\"" + parseFloat(node.getAttribute("PER03")).toFixed(1) + "%\"/>";
               _xmlStr += "        <set value=\"" + (parseFloat(parseFloat(node.getAttribute("PER04")).toFixed(1)) > 40 ? 40 : parseFloat(node.getAttribute("PER04")).toFixed(1)) + "\" hoverText=\"" + parseFloat(node.getAttribute("PER04")).toFixed(1) + "%\"/>";
               _xmlStr += "        <set value=\"" + (parseFloat(parseFloat(node.getAttribute("PER05")).toFixed(1)) > 40 ? 40 : parseFloat(node.getAttribute("PER05")).toFixed(1)) + "\" hoverText=\"" + parseFloat(node.getAttribute("PER05")).toFixed(1) + "%\"/>";
               _xmlStr += "        <set value=\"" + (parseFloat(parseFloat(node.getAttribute("PER06")).toFixed(1)) > 40 ? 40 : parseFloat(node.getAttribute("PER06")).toFixed(1)) + "\" hoverText=\"" + parseFloat(node.getAttribute("PER06")).toFixed(1) + "%\"/>";
               _xmlStr += "        <set value=\"" + (parseFloat(parseFloat(node.getAttribute("PER07")).toFixed(1)) > 40 ? 40 : parseFloat(node.getAttribute("PER07")).toFixed(1)) + "\" hoverText=\"" + parseFloat(node.getAttribute("PER07")).toFixed(1) + "%\"/>";
           }
           else {
               _xmlStr += "    <set value=\"0\" hoverText=\"0.0%\"/>";
               _xmlStr += "    <set value=\"0\" hoverText=\"0.0%\"/>";
               _xmlStr += "    <set value=\"0\" hoverText=\"0.0%\"/>";
               _xmlStr += "    <set value=\"0\" hoverText=\"0.0%\"/>";
               _xmlStr += "    <set value=\"0\" hoverText=\"0.0%\"/>";
               _xmlStr += "    <set value=\"0\" hoverText=\"0.0%\"/>";
               _xmlStr += "    <set value=\"0\" hoverText=\"0.0%\"/>";
           }
           _xmlStr += "    </dataset>";

           _xmlStr += "    <styles>";    
           _xmlStr += "        <definition>";
           _xmlStr += "            <style name=\"MyXScaleAnim\" type=\"ANIMATION\" duration=\"1\" start=\"0\" />"; //param=\"_xscale\" 
           _xmlStr += "            <style name=\"MyYScaleAnim\" type=\"ANIMATION\" duration=\"1\" start=\"0\"/>";  // param=\"_yscale\" 
           _xmlStr += "        </definition>";
           _xmlStr += "        <application>";
           _xmlStr += "            <apply toObject=\"Canvas\" styles=\"MyXScaleAnim,MyYScaleAnim\" />";     
           _xmlStr += "        </application>";
           _xmlStr += "    </styles>";

           _xmlStr += "</chart>";

           return _xmlStr;
       } 

post-37505-0-82056800-1361704664_thumb.png

Edited by Luohui

Share this post


Link to post
Share on other sites

Hi,

 

Thanks,

 

Info: Chart loaded and initialized.
Initial Width: 690
Initial Height: 225
Scale Mode: noScale
Debug Mode: Yes
Application Message Language: EN
Version: 3.0.4
Chart Type: Multi Series 2D Dual Y Combination Chart
Chart Objects: 
BACKGROUND
CANVAS
CAPTION
SUBCAPTION
YAXISNAME
XAXISNAME
DIVLINES
YAXISVALUES
HGRID
DATALABELS
DATAVALUES
TRENDLINES
TRENDVALUES
DATAPLOTCOLUMN
DATAPLOTLINE
DATAPLOTAREA
ANCHORS
TOOLTIP
VLINES
LEGEND

INFO: Chart registered with external script. DOM Id of chart is day_grand_chart_id
INFO: XML Data provided using dataXML method.
XML Data: <chart caption="日别累计(当月)" showLegend="0" legendPosition="RIGHT" showValues="0" sNumberSuffix="%" decimals="1" setAdaptiveYMin="1" setAdaptiveSYMin="1" lineThickness="1" stack100percent="0" canvasbgangle="0" canvasborderthickness="2" chartleftmargin="15" chartrightmargin="5" outcnvbasefontsize="11" bgcolor="E2E8F0" showcumulativeline="1" linecolor="D3AF1D" showplotborder="1" plotgradientcolor="" plotbordercolor="F5BA00" showcanvasbg="1" showcanvasbase="1" canvasbgcolor="ffffff" canvasbgalpha="90" canvasbasecolor="D3DBCA" showalternatehgridcolor="0" showborder="0" canvasborderalpha="20" divlinealpha="15" showshadow="1" plotfillangle="100" plotfillratio="" plotborderdashed="0" plotborderdashlen="1" anchorradius="3" anchorbgcolor="FFFFFF" anchorborderthickness="3" linethickness="2" canvasBorderThickness="1" canvasBorderColor="74787C" showFCMenuItem="0" chartTopMargin="10" chartBottomMargin="10" chartLeftMargin="10" chartRightMargin="10" captionPadding="10" labelPadding="0" adjustDiv="0" numDivLines="3" PYAxisMinValue="0" PYAxisMaxValue="100" SYAxisMinValue="0" SYAxisMaxValue="40">    <categories>        <category label="2.20(火)" />        <category label="2.21(木)" />        <category label="2.22(金)" />        <category label="2.23(土)" />        <category label="2.24(日)" />        <category label="2.25(月)" />        <category label="2.26(水)" />    </categories>    <dataset seriesname="金额" color="F5BA00">    <set value="4361" hoverText="4361" />    <set value="4598" hoverText="4598" />    <set value="4859" hoverText="4859" />    <set value="5055" hoverText="5055" />    <set value="5244" hoverText="5244" />    <set value="5471" hoverText="5471" />    <set value="5769" hoverText="5769" />    </dataset>    <dataset seriesname="挑战" parentYAxis="S" lineThickness="2" color="5AC724" anchorSides="3" anchorRadius="7" anchorBorderThickness="1" anchorBorderColor="5AC724" anchorBgColor="5AC724">        <set value="21.0" hoverText="21.0%" />        <set value="21.0" hoverText="21.0%" />        <set value="21.0" hoverText="21.0%" />        <set value="21.0" hoverText="21.0%" />        <set value="21.0" hoverText="21.0%" />        <set value="21.0" hoverText="21.0%" />        <set value="21.0" hoverText="21.0%" />    </dataset>    <dataset seriesname="实绩" parentYAxis="S" lineThickness="2" color="733AE0" anchorSides="8" anchorRadius="5" anchorBorderThickness="1" anchorBorderColor="733AE0" anchorBgColor="733AE0">        <set value="25.0" hoverText="25.0%" />        <set value="25.0" hoverText="25.0%" />        <set value="25.3" hoverText="25.3%" />        <set value="24.4" hoverText="24.4%" />        <set value="23.9" hoverText="23.9%" />        <set value="23.4" hoverText="23.4%" />        <set value="23.8" hoverText="23.8%" />    </dataset>    <styles>        <definition>            <style name="CanvasXScaleAnim" type="ANIMATION" duration="1" start="0" />            <style name="CanvasYScaleAnim" type="ANIMATION" duration="1" start="0" />            <style name="CaptionStyle" type="font" font="Verdana" size="14" color="464547" bold="1" bgColor="F1F4F8" borderColor="D7DBDF" leftMargin="5" rightMargin="5" letterSpacing="2" />        </definition>        <application>            <apply toObject="Caption" styles="CaptionStyle" />            <apply toObject="Canvas" styles="CanvasXScaleAnim,CanvasYScaleAnim" />        </application>    </styles></chart>

 

 

Share this post


Link to post
Share on other sites

Hi,

 

To make use of any multi-lingual characters on the chart, you necessarily need to use UTF-8 encoded XML/JSON. More importantly, the XML/JSON file or stream requires UTF-8 BOM stamp to be present as the very first 3 Bytes of the file. Most of the text editors like Notepad can do this automatically.

 

To know more on how to BOM mark a file, please refer to: http://docs.fusioncharts.com/charts/contents/advanced/special-chars/SpChar.htmlPlease note the two basic thumb rules:

 

  • For Data URL method - the XML/JSON should be having the BOM stamp
  • For Data String method - the HTML/application file containing the XML/JSON should have the BOM stamp.

Hope this helps.

 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this