Example #1
0
        public ActionResult ExportData(int id, DataFilter filter)
        {
            DateRange dateRange           = DateRangeConverter.GetDateRange(filter);
            ExportSchedulingResult result = this.exportService.ScheduleExport(id, dateRange);

            return(this.Json(result, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        /// <summary>
        /// Получить метрики.
        /// </summary>
        public ActionResult Metrics(int id, DataFilter filter)
        {
            DashboardMetrics metrics = this.metricsService.GetDashboardMetrics(id, DateRangeConverter.GetDateRange(filter));
            var viewModel            = new DashboardViewModel(metrics);

            return(this.MetricsView("_DashboardMetrics", viewModel));
        }
Example #3
0
        /// <summary>
        /// Получить график.
        /// </summary>
        public ActionResult Chart(int id, DataFilter filter)
        {
            var trendChartBuilder = new DashboardTrendChartBuilder(this.metricsService);

            IEnumerable <TrendChartData> trendChartData = filter.Period != FilteringPeriod.Other
                ? trendChartBuilder.GetCharts(id, filter.Period)
                : trendChartBuilder.GetCharts(id, DateRangeConverter.GetDateRange(filter));
            List <TrendChartData> data = trendChartData.ToList();

            data[0].Name       = "Динамика постов админов";
            data[0].ShowBars   = true;
            data[0].ShowLines  = false;
            data[0].ShowPoints = false;
            data[0].Stacking   = true;
            data[0].BarWidth   = 0.4;
            data[0].BarAlign   = BarAlign.Center;

            data[1].Name       = "Динамика постов пользователей";
            data[1].ShowBars   = true;
            data[1].ShowLines  = false;
            data[1].ShowPoints = false;
            data[1].BarOrder   = 1;
            data[1].Stacking   = true;
            data[1].BarWidth   = 0.4;
            data[1].BarAlign   = BarAlign.Center;

            data[2].Name      = "Динамика общего количества постов";
            data[2].BarOrder  = 2;
            data[2].FillLines = false;

            return(this.Chart(trendChartData));
        }
        public IEnumerable <TrendChartData> GetCharts(int projectId, FilteringPeriod period)
        {
            DateRange dateRange = DateRangeConverter.GetDateRange(period);

            dateRange.IsSpecified = false;
            Periodicity            periodicity = this.GetPeriodicity(period);
            IList <TrendChartData> data;
            DateRange timeLimit = this.GetLimit(projectId);

            if (this.SetLimit(dateRange, timeLimit) || (timeLimit != null))
            {
                data = this.GetPoints(projectId, dateRange, periodicity).Select(x => new TrendChartData(x, period)).ToList();

                for (int i = 0; i < data.Count; i++)
                {
                    data[i].Limited      = true;
                    data[i].MaxTimeLimit = timeLimit.To.ToString();
                    data[i].MinTimeLimit = timeLimit.From.ToString();
                }
            }
            else
            {
                data = this.GetPoints(projectId, dateRange, periodicity).Select(x => new TrendChartData(x, period)).ToList();
            }

            return(data);
        }
Example #5
0
        public ActionResult GetMostPopularContents(int id, DataFilter filter)
        {
            var converter       = new UiTableModelsConverter();
            var contentEntities = this.metricsService.GetMostPopularContent(id, DateRangeConverter.GetDateRange(filter));

            return(this.MetricsView("_MostPopularContent", contentEntities.Select(converter.CreateContentModel).ToList()));
        }
        public ActiveUserJsonModel GetActiveUserModel(int id, DataFilter filter, ActiveUserJsonModelBuilderOptions options)
        {
            var result = new ActiveUserJsonModel();

            if (filter.Period == FilteringPeriod.Other && filter.DateRange.From > filter.DateRange.To)
            {
                return(result);
            }

            var activeUsers  = this.metricsService.GetUserMetrics(id, DateRangeConverter.GetDateRange(filter), options.UserTableCount);
            var usersList    = activeUsers.MostActiveUsers.Take(options.ReportCount).ToList();
            var usersListIds = usersList.Select(u => u.Id).ToArray();
            var users        = new ActiveUserViewModel(activeUsers);

            if (users.MostActiveUsers.Count != 0)
            {
                result.Table              = this.GetTable(users.MostActiveUsers.ToList());
                result.InterestsData      = this.GetInterests(id, usersListIds, options.InterestCount);
                result.AgeData            = this.GetAgeInfo(id, usersList);
                result.GenderData         = this.GetGenderInfo(id, usersList);
                result.EducationData      = this.GetEducationInfo(id, usersList);
                result.CountryAndCityData = this.GetCountryAndCityInfo(id, usersListIds);
            }

            result.Table = this.GetTable(users.MostActiveUsers.ToList());
            return(result);
        }
Example #7
0
        public ActionResult SocialChart(int id, DataFilter filter)
        {
            var trendChartBuilder = new SocialTrendChartBuilder(this.metricsService);

            var trendChartData = filter.Period != FilteringPeriod.Other
                ? trendChartBuilder.GetCharts(id, filter.Period)
                : trendChartBuilder.GetCharts(id, DateRangeConverter.GetDateRange(filter));

            var data = trendChartData.ToList();

            data[0].Name       = "Кол-во участников";
            data[0].YaxisOrder = 2;
            data[0].FillLines  = false;

            /*data[1].ShowBars = true;
             * data[1].ShowLines = false;
             * data[1].ShowPoints = false;
             * data[1].BarOrder = 1;
             * data[1].Name = "Вступили";
             *
             * data[2].ShowBars = true;
             * data[2].ShowLines = false;
             * data[2].ShowPoints = false;
             * data[2].BarOrder = 2;
             * data[2].Name = "Покинули";*/

            return(this.Chart(trendChartData));
        }
Example #8
0
        public TrendChartData GetChart(int projectId, FilteringPeriod period)
        {
            DateRange   dateRange            = DateRangeConverter.GetDateRange(period);
            Periodicity periodicity          = this.GetPeriodicity(period);
            IEnumerable <PointInTime> points = this.GetPoints(projectId, dateRange, periodicity);

            return(new TrendChartData(points, period));
        }
Example #9
0
        public ActionResult Chart(int id, DataFilter filter)
        {
            var       trendChartBuilder = new PhotoTrendChartBuilder(this.metricsService);
            DateRange dateRange         = DateRangeConverter.GetDateRange(filter);

            TrendChartData trendChartData = filter.Period != FilteringPeriod.Other
                ? trendChartBuilder.GetChart(id, filter.Period)
                : trendChartBuilder.GetChart(id, dateRange);

            var            trendChartBuilder2 = new VideoTrendChartBuilder(this.metricsService);
            TrendChartData trendChartData2    = filter.Period != FilteringPeriod.Other
                ? trendChartBuilder2.GetChart(id, filter.Period)
                : trendChartBuilder2.GetChart(id, dateRange);

            trendChartData2.YaxisOrder = 3;
            trendChartData.Name        = "Фото";
            trendChartData2.Name       = "Видео";

            return(this.Chart(new[] { trendChartData, trendChartData2 }));
        }
        public ActionResult GetAverageCount(int id, DataFilter filter)
        {
            var data  = this.metricsService.GetLikesCommentsRepostsAverageCount(id, DateRangeConverter.GetDateRange(filter)).ToList();
            var graf1 = new TrendChartData();

            graf1.BarOrder       = 1;
            graf1.Name           = "Лайки";
            graf1.ShowLabelInTip = true;
            graf1.Values.Add(new ChartPoint(data[0][0].Item, data[0][0].Value));
            graf1.Values.Add(new ChartPoint(data[0][1].Item, data[0][1].Value));
            graf1.Values.Add(new ChartPoint(data[0][2].Item, data[0][2].Value));

            var graf2 = new TrendChartData();

            graf2.BarOrder       = 2;
            graf2.Name           = "Комментарии";
            graf2.ShowLabelInTip = true;
            graf2.Values.Add(new ChartPoint(data[1][0].Item, data[1][0].Value));
            graf2.Values.Add(new ChartPoint(data[1][1].Item, data[1][1].Value));
            graf2.Values.Add(new ChartPoint(data[1][2].Item, data[1][2].Value));

            var graf3 = new TrendChartData();

            graf3.BarOrder       = 3;
            graf3.Name           = "Републикации";
            graf3.ShowLabelInTip = true;
            graf3.Values.Add(new ChartPoint(data[2][0].Item, data[2][0].Value));
            graf3.Values.Add(new ChartPoint(data[2][1].Item, data[2][1].Value));
            graf3.Values.Add(new ChartPoint(data[2][2].Item, data[2][2].Value));

            var result = new List <TrendChartData>()
            {
                graf1, graf2, graf3
            };

            return(this.Chart(result));
        }
        /// <summary>
        /// Получить график.
        /// </summary>
        public ActionResult Chart(int id, DataFilter filter)
        {
            var       trendChartBuilder = new InteractionRateTrendChartBuilder(this.metricsService);
            DateRange dateRange         = DateRangeConverter.GetDateRange(filter);

            IEnumerable <TrendChartData> trendChartData = filter.Period != FilteringPeriod.Other
                ? trendChartBuilder.GetCharts(id, filter.Period)
                : trendChartBuilder.GetCharts(id, dateRange);

            List <TrendChartData> data = trendChartData.ToList();

            data[0].Name       = "IR";
            data[0].YaxisOrder = 2;

            data[1].ShowBars   = true;
            data[1].ShowLines  = false;
            data[1].ShowPoints = false;
            data[1].BarOrder   = 1;
            data[1].BarWidth   = 0.1;
            data[1].Name       = "Комментарии";

            data[2].ShowBars   = true;
            data[2].ShowLines  = false;
            data[2].ShowPoints = false;
            data[2].BarOrder   = 2;
            data[2].BarWidth   = 0.1;
            data[2].Name       = "Лайки";

            data[3].ShowBars   = true;
            data[3].ShowLines  = false;
            data[3].ShowPoints = false;
            data[3].BarOrder   = 3;
            data[3].BarWidth   = 0.1;
            data[3].Name       = "Репосты";

            return(this.Chart(trendChartData));
        }
        public ActionResult CompareGroups(int id, DataFilter filter, IList <int> concurrentIds)
        {
            this.analysisService.UpdateProjectsConcurrents(id, concurrentIds);
            var analysis  = this.analysisService.GetConcurrentAnalysis(id, concurrentIds, DateRangeConverter.GetDateRange(filter));
            var converter = new UiTableCompareGroupModelConverter();
            IList <UiTableColumn> columnModel = converter.CreateCompareGroupsModel(analysis);

            return(this.MetricsView("_GroupComparisonTable", columnModel));
        }