使用stack column2d进行融合图表显示的问题

时间:2011-06-21 11:12:58

标签: fusioncharts

我第一次使用融合图表..我在使用StackedColumn2D.swf显示数据时遇到了一些问题..

在vs2005中使用c#

代码:

     strXML += ("<chart palette='2' caption='Product Comparison' defaultNumberScale='s' numberScaleValue='60,60,24,7' numberScaleUnit='min,hr,day,wk' ");
    strXML += (" showLabels='1' showvalues='1'  numberPrefix='' showSum='0' decimals='0' useRoundEdges='1' legendBorderAlpha='0'>");
    strXML_category += "<categories> ";
    strXML_run += ("<dataset seriesname='RUN'  color='8D38C9' showValues='0' >");
    strXML_idle += ("<dataset seriesname='IDLE'  color='4AA02C' showValues='0' >");
    strXML_ec += ("<dataset seriesname='EC'  color='FBB917' showValues='0' >");
    strXML_rw += ("<dataset seriesname='RW'  color='F87431' showValues='0' >");
    strXML_down += ("<dataset seriesname='DOWN_TIME'  color='736AFF' showValues='0' >");

    while (ddDR.Read())
           {
               strXML_category += " <category label='" + ddDR["machinename"].ToString() + "' /> ";
             strXML_run += ("<set value='" + ddDR["RunMinutes"].ToString() + "' />");
             strXML_idle += ("<set value='" + ddDR["IdleMinutes"].ToString() + "'/>");
             strXML_ec += ("<set value='" + ddDR["EcMinutes"].ToString() + "' />");
             strXML_rw += ("<set value='" + ddDR["ReworkMinutes"].ToString() + "'/>");
             strXML_down += ("<set value='" + ddDR["DownMinutes"].ToString() + "'/>");  

             // strXML += "<set name='" + ddDR["dept_name"].ToString() + "' value='" + ddDR["dept_id"].ToString() + "' />";
           }

           strXML_category += " </categories>";
           strXML_run += " </dataset>";
           strXML_idle += " </dataset>";
           strXML_ec += " </dataset>";
           strXML_rw += " </dataset>";
           strXML_down += " </dataset>";
           strXML +=  strXML_category;
           strXML += strXML_run;
           strXML += strXML_idle;
           strXML += strXML_ec;
           strXML += strXML_rw;
           strXML += strXML_down;
           strXML += "</chart>";
           return RenderChart("swf/StackedColumn2D.swf", "", strXML, "FactorySum", "650", "450", false, false);   

datareader包含机器名称和所有其他值,以秒为单位....

输出:

它显示无效的XML数据......

当我改变这一行时,

   strXML_category += " <category label='" + ddDR["machinename"].ToString() + "' /> ";

    strXML_category += " <category label='" + ddDR["machine_id"].ToString() + "' /> ";

输出:我得到了输出......

请帮我解决这个问题..我只需要显示机器名称

感谢和问候 T.Navin

1 个答案:

答案 0 :(得分:3)

请您说明这些字段的区别,即您提供的“machinename”和“machine_id”数据?
另外,请确保“machinename”字段的数据不包含任何可能使XML数据无效的特殊字符。