Beispiel #1
0
        public string ToJson()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("{\"series\":");
            sb.Append('[');
            for (int n = 0; n < Series.Count; n++)
            {
                if (n > 0)
                {
                    sb.Append(',');
                }
                StatSerie s = Series [n];
                sb.Append("{\"name\":\"").Append(s.Name).Append("\",\"values\":");
                s.ToJson(sb);
                sb.Append('}');
            }
            sb.Append(']');
            sb.Append(", \"totals\":[");
            bool fa = false;

            for (int n = 0; n < Series.Count; n++)
            {
                StatSerie s = Series [n];
                if (s == totalsSerie)
                {
                    continue;
                }
                if (fa)
                {
                    sb.Append(',');
                }
                sb.Append("[\"").Append(s.Name).Append("\",").Append(s.GetTotal()).Append("]");
                fa = true;
            }
            sb.Append("]}");
            return(sb.ToString());
        }