Esempio n. 1
0
        /// <summary>
        /// Gets the pie chart.
        /// </summary>
        /// <returns></returns>
        private PieChartViewModel GetPieChart()
        {
            var pieChart = new PieChartViewModel();

            var groups = this._trades.GroupBy(i => i.Price.CurrencyType).Select(g => new { Type = g.First().Price.CurrencyType, Sum = g.Sum(i => i.Price.NumberOfCurrencies) });

            foreach (var group in groups)
            {
                pieChart.Add(group.Type.ToString(), group.Sum);
            }

            return(pieChart);
        }
        /// <summary>
        /// Creates the item class chart.
        /// </summary>
        /// <returns>The PieChart.</returns>
        private PieChartViewModel CreateItemClassChart()
        {
            var pieChart = new PieChartViewModel()
            {
                InnerRadius = 85,
                FontSize    = 18,
            };

            var groups = this._leagueTrades.GroupBy(i => i.ItemClass).Select(g => new { Type = g.First().ItemClass, Sum = g.Sum(i => i.Price.CalculateValue()) });

            foreach (var group in groups.OrderByDescending(g => g.Sum).Take(5))
            {
                pieChart.Add(group.Type.ToString(), group.Sum);
            }

            return(pieChart);
        }
        /// <summary>
        /// Gets the pie chart.
        /// </summary>
        /// <returns>The PieChart.</returns>
        private PieChartViewModel CreateTotalChart()
        {
            var pieChart = new PieChartViewModel()
            {
                FontSize      = 12,
                LabelPosition = LiveCharts.PieLabelPosition.InsideSlice,
            };

            var groups = this._leagueTrades.GroupBy(i => i.Price.CurrencyType).Select(g => new { Type = g.First().Price.CurrencyType, Sum = g.Sum(i => i.Price.CalculateValue()) });

            foreach (var group in groups)
            {
                pieChart.Add(group.Type.ToString(), group.Sum);
            }

            return(pieChart);
        }