Пример #1
0
        public static PlotyData GetPlotyNumberOfEntiesByNumberOfItemsBought(this IEnumerable <PromoData> @this)
        {
            var result = new PlotyData();

            if (@this != null && @this?.Count() > 0)
            {
                var x = @this.GroupBy(p => p.Entry);

                foreach (var group in x)
                {
                    var xTemp = group.Key;
                    var yTemp = group.Sum(p => p.NumberOfItemsBought);

                    result.x.Add(xTemp.ToString());
                    result.y.Add(yTemp.ToString());
                }
            }

            return(result);
        }
Пример #2
0
        public static PlotyData GetPlotyDataByDate(this IEnumerable <PromoData> @this)
        {
            var result = new PlotyData();

            if (@this != null && @this?.Count() > 0)
            {
                var x = @this.GroupBy(p => p.Date);

                foreach (var group in x)
                {
                    var xTemp = group.Key.ToShortDateString();
                    var yTemp = group.Count();

                    result.x.Add(xTemp);
                    result.y.Add(yTemp.ToString());
                }
            }

            return(result);
        }