Ejemplo n.º 1
0
        public void GenerateTotals()
        {
            StatSerie total = new StatSerie()
            {
                Name = "Total"
            };
            Dictionary <string, StatValue> values = new Dictionary <string, StatValue> ();

            foreach (StatSerie s in Series)
            {
                foreach (StatValue v in s.Values)
                {
                    StatValue cval;
                    if (!values.TryGetValue(v.Label, out cval))
                    {
                        cval = new StatValue()
                        {
                            Label = v.Label, Value = v.Value, StartDate = v.StartDate, EndDate = v.EndDate
                        };
                        values [v.Label] = cval;
                        total.Values.Add(cval);
                    }
                    else
                    {
                        cval.Value += v.Value;
                    }
                }
            }
            totalsSerie = total;
            Series.Add(total);
        }
Ejemplo n.º 2
0
        public void FillGaps(TimePeriod p, DateTime start, DateTime end)
        {
            int pos = 0;

            foreach (DateTime date in GetPeriods(p, start, end))
            {
                if (pos >= Values.Count || Values[pos].StartDate > date)
                {
                    StatValue v = new StatValue()
                    {
                        Value = 0, StartDate = date, EndDate = GetNext(p, date)
                    };
                    Values.Insert(pos, v);
                }
                pos++;
            }
        }
Ejemplo n.º 3
0
 public void FillGaps(TimePeriod p, DateTime start, DateTime end)
 {
     int pos = 0;
     foreach (DateTime date in GetPeriods (p, start, end)) {
         if (pos >= Values.Count || Values[pos].StartDate > date) {
             StatValue v = new StatValue () { Value = 0, StartDate = date, EndDate = GetNext (p, date) };
             Values.Insert (pos, v);
         }
         pos++;
     }
 }
Ejemplo n.º 4
0
 public void GenerateTotals()
 {
     StatSerie total = new StatSerie () { Name = "Total" };
     Dictionary<string,StatValue> values = new Dictionary<string, StatValue> ();
     foreach (StatSerie s in Series) {
         foreach (StatValue v in s.Values) {
             StatValue cval;
             if (!values.TryGetValue (v.Label, out cval)) {
                 cval = new StatValue () { Label = v.Label, Value = v.Value, StartDate = v.StartDate, EndDate = v.EndDate };
                 values [v.Label] = cval;
                 total.Values.Add (cval);
             } else
                 cval.Value += v.Value;
         }
     }
     totalsSerie = total;
     Series.Add (total);
 }