Пример #1
0
        /// <summary>
        /// 销售利润排行
        /// </summary>
        /// <param name="app"></param>
        /// <param name="title"></param>
        /// <returns></returns>
        private async Task <ChartViewConfig> SalesProfitRankingPage_Chart(Module app, string title)
        {
            ChartViewConfig chartData = null;

            try
            {
                var result = await _reportingService.GetCostProfitRankingAsync(0, 0, 0, 0, DateTime.Now.AddDays(-15), DateTime.Now, this.ForceRefresh, new System.Threading.CancellationToken());

                if (result != null && result.Any())
                {
                    var series = result.ToList();
                    if (series.Count > 50)
                    {
                        series = result.Take(50).ToList();
                    }

                    chartData = new ChartViewConfig()
                    {
                        BackgroundColor = Color.White,
                        ChartConfig     = new ChartConfig
                        {
                            type = Wesley.ChartJS.ChartTypes.Bar,
                            data = ChartDataProvider.GetSalesProfitRanking(series)
                        }
                    };
                }
                return(chartData);
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
                return(chartData);
            }
        }
Пример #2
0
        private void RefreshData(List <CostProfitRanking> analysis)
        {
            RankSeries          = new ObservableCollection <CostProfitRanking>(analysis);
            TotalSumNetQuantity = analysis.Select(s => s.TotalSumNetQuantity).Sum();
            TotalSumNetAmount   = analysis.Select(s => s.TotalSumNetAmount).Sum();
            TotalSumProfit      = analysis.Select(s => s.TotalSumProfit).Sum();

            var ranks = analysis.ToList();

            if (ranks.Count > 10)
            {
                ranks = ranks.Take(10).ToList();
            }

            var data = new ChartViewConfig()
            {
                BackgroundColor = Color.White,
                ChartConfig     = new ChartConfig
                {
                    type = Wesley.ChartJS.ChartTypes.Bar,
                    data = ChartDataProvider.GetSalesProfitRanking(ranks)
                }
            };

            ChartConfig = data;
        }