Exemplo n.º 1
0
        private ChartViewModel GetWinLoseCountsChart(List <ForecastJson> forecasts)
        {
            var winLoseCountChart = new ChartViewModel
            {
                Label       = "Win/Lose(Count)",
                Description = "Grafic care arata numarul de pierderi/cistiguri pe fiecare fir aparte",
                ChartData   = new List <ChartData>()
            };

            var index = 0;

            foreach (var group in forecasts.GroupBy(x => new { x.GameAt.Year, x.GameAt.Month }).OrderBy(x => x.Key.Year).ThenBy(x => x.Key.Month))
            {
                foreach (var forecastsGroup in group.GroupBy(x => x.ThreadNumber).OrderBy(x => x.Key))
                {
                    foreach (var item in forecastsGroup.GroupBy(x => x.GameResultType))
                    {
                        winLoseCountChart.ChartData.Add(new ChartData
                        {
                            Label = $"[{group.Key.Year}]{((Month)group.Key.Month).ToString()}",
                            Color = HtmlViewHelper.GetColor(item.Key),
                            X     = index++,
                            Y     = item.Count()
                        });
                    }

                    index += 1;

                    winLoseCountChart.ChartData.Add(new ChartData
                    {
                        Label = $"[{group.Key.Year}]{((Month)group.Key.Month).ToString()}",
                        Color = HtmlViewHelper.GetColor(GameResultType.Expectation),
                        X     = index++,
                        Y     = 0
                    });
                }

                index += 1;

                foreach (var forecastGroup in group.GroupBy(x => x.GameResultType))
                {
                    winLoseCountChart.ChartData.Add(new ChartData
                    {
                        Label = $"[{group.Key.Year}]{((Month)group.Key.Month).ToString()}",
                        Color = HtmlViewHelper.GetColor(forecastGroup.Key),
                        X     = index++,
                        Y     = forecastGroup.Count()
                    });
                }

                index += 2;
            }

            return(winLoseCountChart);
        }
Exemplo n.º 2
0
        private ChartViewModel GetWinLoseSeriesCountChart(List <WinLoseCountModel> chartData, int threadNumbers)
        {
            var winLoseChart = new ChartViewModel
            {
                Label       = "Win/Lose(Series Count)",
                Description = "Grafic care arata numarul de serii de fiecare tip",
                ChartData   = new List <ChartData>()
            };

            var index = 0;

            for (var i = 0; i < threadNumbers; i++)
            {
                var query = chartData
                            .Where(x => x.ThreadNumber == i)
                            .GroupBy(x => new { x.GameResultType, x.Count })
                            .OrderByDescending(x => x.Count())
                            .ToList();

                foreach (var group in query)
                {
                    winLoseChart.ChartData.Add(new ChartData
                    {
                        Label = group.Count().ToString(),
                        Color = HtmlViewHelper.GetColor(group.Key.GameResultType),
                        X     = index++,
                        Y     = group.Key.Count
                    });
                }

                index += 3;

                winLoseChart.ChartData.Add(new ChartData
                {
                    Label = "",
                    Color = HtmlViewHelper.GetColor(GameResultType.Expectation),
                    X     = index++,
                    Y     = 0
                });
            }

            return(winLoseChart);
        }
Exemplo n.º 3
0
        private ChartViewModel GetWinLoseChart(List <WinLoseCountModel> chartData, int threadNumbers)
        {
            var winLoseChart = new ChartViewModel
            {
                Label       = "Win/Lose",
                Description = "Grafic care arata care erau treptele de trecere de la cistig la pierderi si invers",
                ChartData   = new List <ChartData>()
            };

            var index = 0;

            for (var i = 0; i < threadNumbers; i++)
            {
                foreach (WinLoseCountModel model in chartData.Where(x => x.ThreadNumber == i))
                {
                    winLoseChart.ChartData.Add(new ChartData
                    {
                        Label = model.StartSeries.ToString("d"),
                        Color = HtmlViewHelper.GetColor(model.GameResultType),
                        X     = index++,
                        Y     = model.Count
                    });
                }

                index += 3;

                winLoseChart.ChartData.Add(new ChartData
                {
                    Label = DateTimeOffset.Now.ToString("d"),
                    Color = HtmlViewHelper.GetColor(GameResultType.Expectation),
                    X     = index++,
                    Y     = 0
                });
            }

            return(winLoseChart);
        }