示例#1
0
        private Chart GetAccountCreatedChart()
        {
            _logger.LogTrace("Generating chart for account created over the past 7 days.");
            var accountCreatedData = _reportRepo.GetAccountCreatedCount(DateTime.Today.AddDays(-8), DateTime.Today.AddDays(1)).OrderBy(x => x.CreatedDate).ToList();

            return(new Chart {
                Type = Enums.ChartType.Line,
                Data = new Data {
                    Labels = accountCreatedData.Select(x => x.CreatedDate.ToShortDateString()).ToList(),
                    Datasets = new List <Dataset> {
                        new LineDataset {
                            Label = "# Of Accounts Created",
                            Data = accountCreatedData.Select(x => (double)x.Count).ToList(),
                            Fill = "false",
                            LineTension = 0.1,
                            BackgroundColor = ChartColor.FromRgba(75, 192, 192, 0.4),
                            BorderColor = ChartColor.FromRgba(75, 192, 192, 1),
                            BorderCapStyle = "butt",
                            BorderDashOffset = 0.0,
                            BorderJoinStyle = "miter",
                            PointBorderColor = new List <ChartColor>()
                            {
                                ChartColor.FromRgba(75, 192, 192, 1)
                            },
                            PointBackgroundColor = new List <ChartColor>()
                            {
                                ChartColor.FromHexString("#fff")
                            },
                            PointBorderWidth = new List <int> {
                                1
                            },
                            PointHoverRadius = new List <int> {
                                5
                            },
                            PointHoverBackgroundColor = new List <ChartColor>()
                            {
                                ChartColor.FromRgba(75, 192, 192, 1)
                            },
                            PointHoverBorderColor = new List <ChartColor>()
                            {
                                ChartColor.FromRgba(220, 220, 220, 1)
                            },
                            PointHoverBorderWidth = new List <int> {
                                2
                            },
                            PointRadius = new List <int> {
                                1
                            },
                            PointHitRadius = new List <int> {
                                10
                            },
                        }
                    }
                }
            });
        }