using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
namespace Stat.Report
{
    /// <summary>
    /// 饼状报表
    /// </summary>
    public class Rp_3_Pie3D
    {
        /*------------------------------------------------------------------------------------------*/
        /// <summary>
        /// 小时流量分布
        /// </summary>
        /// <param name="dt">数据源</param>
        /// <param name="caption">标题</param>
        /// <param name="subcaption">副标题</param>
        /// <param name="showValues">（0）</param> 
        /// <param name="numberSuffix"></param>
        /// <returns></returns>
        public static string GetXML_Engine(IList<Model.StatItem> dt, string caption, string subcaption, int showValues, string numberSuffix)
        {
            StringBuilder strXML = new System.Text.StringBuilder();
            strXML.Append("<chart palette='4' decimals='2' enableSmartLabels='1' enableRotation='0' bgColor='FFFFFF' bgAlpha='100' bgRatio='0,100' bgAngle='360' showBorder='0' startingAngle='70'");

            strXML.Append(" caption='" + caption + "' subCaption='" + subcaption + "' baseFontSize ='13' showValues='" + showValues + "' numberSuffix='" + numberSuffix + "' ");
            strXML.Append(" captionPadding='3' chartTopMargin='5' chartBottomMargin='5' chartLeftMargin='5' chartRightMargin='5'");
            strXML.Append(">");
            if (dt != null && dt.Count > 0)
            {
                string[] c = Plugin.Common.RpColor();
                int cj = 0;
                for (int i = 1; i < dt.Count; i++)
                {
                    if (dt[i].PvCount > 0)
                    {
                        if (i < 3)
                        {
                            strXML.Append("   <set label='" + dt[i].Name + "' value='" + dt[i].PvCount + "' isSliced='1' color='" + c[cj].ToString() + "' />");
                            //  strXML.Append( " toolText='" + dt.Rows[i][0] + "(" + dt.Rows[i][2] + "次)：" + Convert.ToInt64(dt.Rows[i][6]).ToString("0.00") + "%'");

                        }
                        else
                        {
                            strXML.Append("   <set label='" + dt[i].Name + "' value='" + dt[i].PvCount + "' color='" + c[cj].ToString() + "' />");
                            //   strXML.Append( " toolText='" + dt.Rows[i][0] + "(" + dt.Rows[i][2] + "次)：" + Convert.ToInt64(dt.Rows[i][6]).ToString("0.00") + "%'");

                        }
                    }
                    cj++;
                    cj = cj >= (c.GetLength(0) - 1) ? 0 : cj; //颜色编号
                }
            }
            strXML.Append("</chart>");

            return strXML.ToString();

        }
        /*-------------------------------------------------------------------------------------------*/
        /// <summary>
        /// 来路域名
        /// </summary>
        /// <param name="dt">数据源</param>
        /// <param name="caption">标题</param>
        /// <param name="subcaption">副标题</param>
        /// <param name="numberSuffix"></param>
        /// <param name="showValues"></param>
        /// <returns></returns>
        public static string GetXML_Domain(DataTable dt, string caption, string subcaption, int showValues, string numberSuffix)
        {
            StringBuilder strXML = new System.Text.StringBuilder();
            strXML.Append("<chart palette='4' decimals='2' enableSmartLabels='1' enableRotation='0' bgColor='FFFFFF' bgAlpha='100' bgRatio='0,100' bgAngle='360' showBorder='0' startingAngle='70'");

            strXML.Append(" caption='" + caption + "' subCaption='" + subcaption + "' baseFontSize ='13' showLabels='0' showValues='" + showValues + "' numberSuffix='" + numberSuffix + "' ");
            strXML.Append(" captionPadding='3' chartTopMargin='5' chartBottomMargin='5' chartLeftMargin='5' chartRightMargin='5'");
            strXML.Append(">");
            if (dt != null && dt.Rows.Count > 0)
            {
                string[] c = Plugin.Common.RpColor();
                int cj = 0;
                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i][2].ToString() != "0")
                    {
                        if (i < 3)
                        {
                            strXML.Append("   <set label='" + FormatDomain(dt.Rows[i][1].ToString()) + "' value='" + dt.Rows[i][2] + "' isSliced='1' color='" + c[cj].ToString() + "' />");
                            //  strXML.Append( " toolText='" + dt.Rows[i][0] + "(" + dt.Rows[i][2] + "次)：" + Convert.ToInt64(dt.Rows[i][6]).ToString("0.00") + "%'");

                        }
                        else
                        {
                            strXML.Append("   <set label='" + FormatDomain(dt.Rows[i][1].ToString()) + "' value='" + dt.Rows[i][2] + "' color='" + c[cj].ToString() + "' />");
                            //   strXML.Append( " toolText='" + dt.Rows[i][0] + "(" + dt.Rows[i][2] + "次)：" + Convert.ToInt64(dt.Rows[i][6]).ToString("0.00") + "%'");

                        }
                    }
                    cj++;
                    cj = cj >= (c.GetLength(0) - 1) ? 0 : cj; //颜色编号
                }
            }
            strXML.Append("</chart>");

            return strXML.ToString();

        }

        private static string FormatDomain(string s)
        {
            if (s == "")
            {

                return "输入域名";
            }
            return s;
        }
        /*----------------------------------------------------------------------------------------------*/
        /// <summary>
        /// 来源分类
        /// </summary>
        /// <param name="dt">数据源</param>
        /// <param name="caption">标题</param>
        /// <param name="subcaption">副标题</param>
        /// <param name="showValues">（0）</param>
        /// <param name="numberSuffix"></param>
        /// <returns></returns>
        public static string GetXML_TReferer(DataTable dt, string caption, string subcaption, int showValues, string numberSuffix)
        {
            StringBuilder strXML = new System.Text.StringBuilder();
            strXML.Append("<chart palette='4' decimals='2' enableSmartLabels='1' enableRotation='0' bgColor='FFFFFF' bgAlpha='100' bgRatio='0,100' bgAngle='360' showBorder='0' startingAngle='70'");

            strXML.Append(" caption='" + caption + "' subCaption='" + subcaption + "' baseFontSize ='13' showValues='" + showValues + "' numberSuffix='" + numberSuffix + "' ");
            strXML.Append(" captionPadding='3' chartTopMargin='5' chartBottomMargin='5' chartLeftMargin='5' chartRightMargin='5'");
            strXML.Append(">");
            if (dt != null && dt.Rows.Count > 0)
            {
                string[] c = Plugin.Common.RpColor();
                int cj = 0;
                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i][2].ToString() != "0")
                    {
                        if (i < 2)
                        {
                            strXML.Append("   <set label='" + dt.Rows[i][1].ToString() + "' value='" + dt.Rows[i][2] + "' isSliced='1' color='" + c[cj].ToString() + "' />");

                        }
                        else
                        {
                            strXML.Append("   <set label='" + dt.Rows[i][1].ToString() + "' value='" + dt.Rows[i][2] + "' color='" + c[cj].ToString() + "' />");
                            //   strXML.Append( " toolText='" + dt.Rows[i][0] + "(" + dt.Rows[i][2] + "次)：" + Convert.ToInt64(dt.Rows[i][6]).ToString("0.00") + "%'");

                        }
                    }
                    cj++;
                    cj = cj >= (c.GetLength(0) - 1) ? 0 : cj; //颜色编号
                }
            }
            strXML.Append("</chart>");

            return strXML.ToString();

        }
        /*---------------------------------------------------------------------------------------------------------*/
        /// <summary>
        /// 
        /// </summary>
        /// <param name="list">数据源</param>
        /// <param name="caption">标题</param>
        /// <param name="subcaption">副标题</param>
        /// <param name="showValues">（0）</param>
        /// <param name="numberSuffix"></param>
        /// <returns></returns>
        public static string GetXML(List<Model.StatItem> list, string caption, string subcaption, int showValues, string numberSuffix)
        {
            StringBuilder strXML = new System.Text.StringBuilder();
            strXML.Append("<chart palette='4' decimals='2' enableSmartLabels='1' enableRotation='0' bgColor='FFFFFF' bgAlpha='100' bgRatio='0,100' bgAngle='360' showBorder='0' startingAngle='70'");

            strXML.Append(" caption='" + caption + "' subCaption='" + subcaption + "' baseFontSize ='13' showValues='" + showValues + "' numberSuffix='" + numberSuffix + "' ");
            strXML.Append(" captionPadding='3' chartTopMargin='5' chartBottomMargin='5' chartLeftMargin='5' chartRightMargin='5'");
            strXML.Append(">");
            if (list != null && list.Count > 0)
            {
                string[] colorList = Plugin.Common.RpColor();
                int clIndex = new Random().Next(0, 8);

                for (int i = 1; i < list.Count; i++)
                {
                    if (list[i].PvCount > 0)
                    {
                        if (i < 3)
                        {
                            strXML.Append("   <set label='" + list[i].Name + "' value='" + list[i].PvCount + "' isSliced='1' color='" + colorList[clIndex].ToString() + "' />");

                        }
                        else
                        {
                            strXML.Append("   <set label='" + list[i].Name + "' value='" + list[i].PvCount + "' color='" + colorList[clIndex].ToString() + "' />");

                        }
                    }
                    clIndex++;
                    clIndex = clIndex >= (colorList.GetLength(0) - 1) ? 0 : clIndex; //颜色编号
                }
            }
            strXML.Append("</chart>");

            return strXML.ToString();
        }
        /*---------------------------------------------------------------------------------------------------------*/
        /// <summary>
        /// 操作系统
        /// </summary>
        /// <param name="dt">数据源</param>
        /// <param name="caption">标题</param>
        /// <param name="subcaption">副标题</param>
        /// <param name="showValues">（0）</param>
        /// <param name="numberSuffix"></param>
        /// <returns></returns>
        public static string GetXML_System(DataTable dt, string caption, string subcaption, int showValues, string numberSuffix)
        {
            StringBuilder strXML = new System.Text.StringBuilder();
            strXML.Append("<chart palette='4' decimals='2' enableSmartLabels='1' enableRotation='0' bgColor='FFFFFF' bgAlpha='100' bgRatio='0,100' bgAngle='360' showBorder='0' startingAngle='70'");

            strXML.Append(" caption='" + caption + "' subCaption='" + subcaption + "' baseFontSize ='13' showValues='" + showValues + "' numberSuffix='" + numberSuffix + "' ");
            strXML.Append(" captionPadding='3' chartTopMargin='5' chartBottomMargin='5' chartLeftMargin='5' chartRightMargin='5'");
            strXML.Append(">");
            if (dt != null && dt.Rows.Count > 0)
            {
                string[] c = Plugin.Common.RpColor();
                int cj = 0;

                int init = 0;
                if (dt.Columns.Count == 7) { init = 1; }
                if (dt.Columns.Count == 4) { init = 0; }

                for (int i = init; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i][2].ToString() != "0")
                    {
                        if (i < 3)
                        {
                            strXML.Append("   <set label='" + dt.Rows[i][1] + "' value='" + dt.Rows[i][2] + "' isSliced='1' color='" + c[cj].ToString() + "' />");

                        }
                        else
                        {
                            strXML.Append("   <set label='" + dt.Rows[i][1] + "' value='" + dt.Rows[i][2] + "' color='" + c[cj].ToString() + "' />");

                        }
                    }
                    cj++;
                    cj = cj >= (c.GetLength(0) - 1) ? 0 : cj; //颜色编号
                }
            }
            strXML.Append("</chart>");

            return strXML.ToString();

        }
        /*---------------------------------------------------------------------------------------------------------*/
        /// <summary>
        /// 分辨率
        /// </summary>
        /// <param name="dt">数据源</param>
        /// <param name="caption">标题</param>
        /// <param name="subcaption">副标题</param>
        /// <param name="showValues">（0）</param>
        /// <param name="numberSuffix"></param>
        /// <returns></returns>
        public static string GetXML_Resolve(DataTable dt, string caption, string subcaption, int showValues, string numberSuffix)
        {
            StringBuilder strXML = new System.Text.StringBuilder();
            strXML.Append("<chart palette='4' decimals='2' enableSmartLabels='1' enableRotation='0' bgColor='FFFFFF' bgAlpha='100' bgRatio='0,100' bgAngle='360' showBorder='0' startingAngle='70'");

            strXML.Append(" caption='" + caption + "' subCaption='" + subcaption + "' baseFontSize ='13' showValues='" + showValues + "' numberSuffix='" + numberSuffix + "' ");
            strXML.Append(" captionPadding='3' chartTopMargin='5' chartBottomMargin='5' chartLeftMargin='5' chartRightMargin='5'");
            strXML.Append(">");
            if (dt != null && dt.Rows.Count > 0)
            {
                string[] c = Plugin.Common.RpColor();
                int cj = 0;
                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i][2].ToString() != "0")
                    {
                        if (i < 3)
                        {
                            strXML.Append("   <set label='" + dt.Rows[i][1] + "' value='" + dt.Rows[i][2] + "' isSliced='1' color='" + c[cj].ToString() + "' />");

                        }
                        else
                        {
                            strXML.Append("   <set label='" + dt.Rows[i][1] + "' value='" + dt.Rows[i][2] + "' color='" + c[cj].ToString() + "' />");

                        }
                    }
                    cj++;
                    cj = cj >= (c.GetLength(0) - 1) ? 0 : cj; //颜色编号
                }
            }
            strXML.Append("</chart>");

            return strXML.ToString();

        }
        /*---------------------------------------------------------------------------------------------------------*/
        /// <summary>
        /// 回头率
        /// </summary>
        /// <param name="dt">数据源</param>
        /// <param name="caption">标题</param>
        /// <param name="subcaption">副标题</param>
        /// <param name="showValues">（0）</param>
        /// <param name="numberSuffix"></param>
        /// <returns></returns>
        public static string GetXML_Returnuser(DataTable dt, string caption, string subcaption, int showValues, string numberSuffix)
        {
            StringBuilder strXML = new System.Text.StringBuilder();
            strXML.Append("<chart palette='4' decimals='2' enableSmartLabels='1' enableRotation='0' bgColor='FFFFFF' bgAlpha='100' bgRatio='0,100' bgAngle='360' showBorder='0' startingAngle='70'");

            strXML.Append(" caption='" + caption + "' subCaption='" + subcaption + "' baseFontSize ='13' showValues='" + showValues + "' numberSuffix='" + numberSuffix + "' ");
            strXML.Append(" captionPadding='3' chartTopMargin='5' chartBottomMargin='5' chartLeftMargin='5' chartRightMargin='5'");
            strXML.Append(">");
            if (dt != null && dt.Rows.Count > 0)
            {
                string[] c = Plugin.Common.RpColor();
                int cj = 6;
                for (int i = 0; i < (dt.Rows.Count - 1); i++)
                {
                    if (dt.Rows[i][2].ToString() != "0")
                    {
                        if (i < 3)
                        {
                            strXML.Append("   <set label='" + dt.Rows[i][1] + "' value='" + dt.Rows[i][2] + "' isSliced='1' color='" + c[cj].ToString() + "' />");

                        }
                        else
                        {
                            strXML.Append("   <set label='" + dt.Rows[i][1] + "' value='" + dt.Rows[i][2] + "' color='" + c[cj].ToString() + "' />");

                        }
                    }
                    cj++;
                    cj = cj >= (c.GetLength(0) - 1) ? 0 : cj; //颜色编号
                }
            }
            strXML.Append("</chart>");

            return strXML.ToString();

        }
        /*---------------------------------------------------------------------------------------------------------*/
        /// <summary>
        /// 网络接入商
        /// </summary>
        /// <param name="dt">数据源</param>
        /// <param name="caption">标题</param>
        /// <param name="subcaption">副标题</param>
        /// <param name="showValues">（0）</param>
        /// <param name="numberSuffix"></param>
        /// <returns></returns>
        public static string GetXML_Tele(DataTable dt, string caption, string subcaption, int showValues, string numberSuffix)
        {
            StringBuilder strXML = new System.Text.StringBuilder();
            strXML.Append("<chart palette='4' decimals='2' enableSmartLabels='1' enableRotation='0' bgColor='FFFFFF' bgAlpha='100' bgRatio='0,100' bgAngle='360' showBorder='0' startingAngle='70'");

            strXML.Append(" caption='" + caption + "' subCaption='" + subcaption + "' baseFontSize ='13' showValues='" + showValues + "' numberSuffix='" + numberSuffix + "' ");
            strXML.Append(" captionPadding='3' chartTopMargin='5' chartBottomMargin='5' chartLeftMargin='5' chartRightMargin='5'");
            strXML.Append(">");
            if (dt != null && dt.Rows.Count > 0)
            {
                string[] c = Plugin.Common.RpColor();
                int cj = 4;
                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i][2].ToString() != "0")
                    {
                        if (i < 3)
                        {
                            strXML.Append("   <set label='" + dt.Rows[i][1] + "' value='" + dt.Rows[i][2] + "' isSliced='1' color='" + c[cj].ToString() + "' />");

                        }
                        else
                        {
                            strXML.Append("   <set label='" + dt.Rows[i][1] + "' value='" + dt.Rows[i][2] + "' color='" + c[cj].ToString() + "' />");

                        }
                    }
                    cj++;
                    cj = cj >= (c.GetLength(0) - 1) ? 0 : cj; //颜色编号
                }
            }
            strXML.Append("</chart>");

            return strXML.ToString();

        }
        /*---------------------------------------------------------------------------------------------------------*/
        /// <summary>
        /// 省份
        /// </summary>
        /// <param name="dt">数据源</param>
        /// <param name="caption">标题</param>
        /// <param name="subcaption">副标题</param>
        /// <param name="numberSuffix"></param>
        /// <param name="showValues"></param>
        /// <returns></returns>
        public static string GetXML_Province(DataTable dt, string caption, string subcaption, int showValues, string numberSuffix)
        {
            StringBuilder strXML = new System.Text.StringBuilder();
            strXML.Append("<chart palette='4' decimals='2' enableSmartLabels='1' enableRotation='0' bgColor='FFFFFF' bgAlpha='100' bgRatio='0,100' bgAngle='360' showBorder='0' startingAngle='70'");

            strXML.Append(" caption='" + caption + "' subCaption='" + subcaption + "' baseFontSize ='13' showValues='" + showValues + "' numberSuffix='" + numberSuffix + "' ");
            strXML.Append(" captionPadding='3' chartTopMargin='5' chartBottomMargin='5' chartLeftMargin='5' chartRightMargin='5'");
            strXML.Append(">");
            if (dt != null && dt.Rows.Count > 0)
            {
                string[] c = Plugin.Common.RpColor();
                int cj = 5;
                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i][2].ToString() != "0")
                    {
                        if (i < 3)
                        {
                            strXML.Append("   <set label='" + dt.Rows[i][1] + "' value='" + dt.Rows[i][2] + "' isSliced='1' color='" + c[cj].ToString() + "' />");

                        }
                        else
                        {
                            strXML.Append("   <set label='" + dt.Rows[i][1] + "' value='" + dt.Rows[i][2] + "' color='" + c[cj].ToString() + "' />");

                        }
                    }
                    cj++;
                    cj = cj >= (c.GetLength(0) - 1) ? 0 : cj; //颜色编号
                }
            }
            strXML.Append("</chart>");

            return strXML.ToString();

        }
        /*---------------------------------------------------------------------------------------------------------*/
        /// <summary>
        /// 语言
        /// </summary>
        /// <param name="dt">数据源</param>
        /// <param name="caption">标题</param>
        /// <param name="subcaption">副标题</param>
        /// <param name="numberSuffix"></param>
        /// <param name="showValues"></param>
        /// <returns></returns>
        public static string GetXML_Lang(DataTable dt, string caption, string subcaption, int showValues, string numberSuffix)
        {
            StringBuilder strXML = new System.Text.StringBuilder();
            strXML.Append("<chart palette='4' decimals='2' enableSmartLabels='1' enableRotation='0' bgColor='FFFFFF' bgAlpha='100' bgRatio='0,100' bgAngle='360' showBorder='0' startingAngle='70'");

            strXML.Append(" caption='" + caption + "' subCaption='" + subcaption + "' baseFontSize ='13' showValues='" + showValues + "' numberSuffix='" + numberSuffix + "' ");
            strXML.Append(" captionPadding='3' chartTopMargin='5' chartBottomMargin='5' chartLeftMargin='5' chartRightMargin='5'");
            strXML.Append(">");
            if (dt != null && dt.Rows.Count > 0)
            {
                string[] c = Plugin.Common.RpColor();
                int cj = 0;
                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i][2].ToString() != "0")
                    {
                        if (i < 3)
                        {
                            strXML.Append("   <set label='" + dt.Rows[i][1] + "' value='" + dt.Rows[i][2] + "' isSliced='1' color='" + c[cj].ToString() + "' />");

                        }
                        else
                        {
                            strXML.Append("   <set label='" + dt.Rows[i][1] + "' value='" + dt.Rows[i][2] + "' color='" + c[cj].ToString() + "' />");

                        }
                    }
                    cj++;
                    cj = cj >= (c.GetLength(0) - 1) ? 0 : cj; //颜色编号
                }
            }
            strXML.Append("</chart>");

            return strXML.ToString();

        }

        /*---------------------------------------------------------------------------------------------------------*/
        /// <summary>
        /// 颜色质量
        /// </summary>
        /// <param name="dt">数据源</param>
        /// <param name="caption">标题</param>
        /// <param name="showValues">（0）</param>
        /// <param name="numberSuffix"></param>
        /// <param name="subcaption"></param>
        /// <returns></returns>
        public static string GetXML_ColorDep(DataTable dt, string caption, string subcaption, int showValues, string numberSuffix)
        {
            StringBuilder strXML = new System.Text.StringBuilder();
            strXML.Append("<chart palette='4' decimals='2' enableSmartLabels='1' enableRotation='0' bgColor='FFFFFF' bgAlpha='100' bgRatio='0,100' bgAngle='360' showBorder='0' startingAngle='70'");

            strXML.Append(" caption='" + caption + "' subCaption='" + subcaption + "' baseFontSize ='13' showValues='" + showValues + "' numberSuffix='" + numberSuffix + "' ");
            strXML.Append(" captionPadding='3' chartTopMargin='5' chartBottomMargin='5' chartLeftMargin='5' chartRightMargin='5'");
            strXML.Append(">");
            if (dt != null && dt.Rows.Count > 0)
            {
                string[] c = Plugin.Common.RpColor();
                int cj = 0;
                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i][2].ToString() != "0")
                    {
                        if (i < 3)
                        {
                            strXML.Append("   <set label='" + dt.Rows[i][1] + "' value='" + dt.Rows[i][2] + "' isSliced='1' color='" + c[cj].ToString() + "' />");

                        }
                        else
                        {
                            strXML.Append("   <set label='" + dt.Rows[i][1] + "' value='" + dt.Rows[i][2] + "' color='" + c[cj].ToString() + "' />");

                        }
                    }
                    cj++;
                    cj = cj >= (c.GetLength(0) - 1) ? 0 : cj; //颜色编号
                }
            }
            strXML.Append("</chart>");

            return strXML.ToString();

        }
        /*---------------------------------------------------------------------------------------------------------*/
        /// <summary>
        /// Alexa/JavaApplets
        /// </summary>
        /// <param name="dt">数据源</param>
        /// <param name="caption">标题</param>
        /// <param name="subcaption">副标题</param>
        /// <param name="showValues">（0）</param>
        /// <param name="numberSuffix"></param>
        /// <returns></returns>
        public static string GetXML_Alexa(DataTable dt, string caption, string subcaption, int showValues, string numberSuffix)
        {
            StringBuilder strXML = new System.Text.StringBuilder();
            strXML.Append("<chart palette='4' decimals='2' enableSmartLabels='1' enableRotation='0' bgColor='FFFFFF' bgAlpha='100' bgRatio='0,100' bgAngle='360' showBorder='0' startingAngle='70'");

            strXML.Append(" caption='" + caption + "' subCaption='" + subcaption + "' baseFontSize ='13' showValues='" + showValues + "' numberSuffix='" + numberSuffix + "' ");
            strXML.Append(" captionPadding='3' chartTopMargin='5' chartBottomMargin='5' chartLeftMargin='5' chartRightMargin='5'");
            strXML.Append(">");
            if (dt != null && dt.Rows.Count > 0)
            {
                string[] c = Plugin.Common.RpColor();
                int cj = 7;
                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i][2].ToString() != "0")
                    {
                        if (i < 3)
                        {
                            strXML.Append("   <set label='" + dt.Rows[i][1] + "' value='" + dt.Rows[i][2] + "' isSliced='1' color='" + c[cj].ToString() + "' />");

                        }
                        else
                        {
                            strXML.Append("   <set label='" + dt.Rows[i][1] + "' value='" + dt.Rows[i][2] + "' color='" + c[cj].ToString() + "' />");

                        }
                    }
                    cj++;
                    cj = cj >= (c.GetLength(0) - 1) ? 0 : cj; //颜色编号
                }
            }
            strXML.Append("</chart>");

            return strXML.ToString();

        }
    }
}