Beispiel #1
0
        public void Refresh(List <CustomerRanking> analysis)
        {
            RankSeries = new ObservableCollection <CustomerRanking>(analysis);
            SubTotal   = analysis.Select(s => s.VisitSum).Sum();
            Total      = analysis.Select(s => s.NetAmount).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.GetCustomerRanking(ranks)
                }
            };

            ChartConfig = data;
        }
Beispiel #2
0
        /// <summary>
        /// 客户排行榜
        /// </summary>
        /// <param name="app"></param>
        /// <param name="title"></param>
        /// <returns></returns>
        private async Task <ChartViewConfig> CustomerRankingPage_Chart(Module app, string title)
        {
            ChartViewConfig chartData = null;

            try
            {
                var result = await _reportingService.GetCustomerRankingAsync(0,
                                                                             0,
                                                                             Settings.UserId,
                                                                             DateTime.Now.AddDays(-100),
                                                                             DateTime.Now,
                                                                             calToken : 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.GetCustomerRanking(result.ToList())
                        }
                    };
                }
                return(chartData);
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
                return(chartData);
            }
        }