Exemple #1
0
        private static Chart GetHourlyActivityChart(Dictionary <TimeSpan, double> timePerTimeOfDay)
        {
            var labels = timePerTimeOfDay.Keys.Select(x => x.IsFullHour() ? x.ToString("hh':'mm") : "");

            var chart = new Chart {
                Type = Enums.ChartType.Radar
            };
            var data = new ChartJSCore.Models.Data {
                Labels = labels.ToList()
            };
            var dataset = new RadarDataset
            {
                Label           = "# hours watched",
                Data            = new List <double?>(timePerTimeOfDay.Values.Select(x => (double?)x)),
                BorderWidth     = 1,
                BackgroundColor = ChartColor.FromRgba(229, 9, 20, 0.8),
                Type            = Enums.ChartType.Radar
            };

            data.Datasets = new List <Dataset> {
                dataset
            };
            chart.Data    = data;
            chart.Options = new RadarOptions
            {
                Responsive          = true,
                MaintainAspectRatio = false,
                Title = new Title {
                    Text = "Hours watched per time of day", Display = true
                },
                ResponsiveAnimationDuration = 500,
                Tooltips = new ToolTip {
                    Enabled = false
                }
            };

            return(chart);
        }
Exemple #2
0
        public static string GenerateRadarChart()
        {
            Chart chart = new Chart();

            chart.Type = "radar";

            Data data = new Data();

            data.Labels = new List <string>()
            {
                "Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"
            };

            RadarDataset dataset1 = new RadarDataset()
            {
                Label                = "My First dataset",
                BackgroundColor      = "rgba(179,181,198,0.2)",
                BorderColor          = "rgba(179,181,198,1)",
                PointBackgroundColor = new List <string>()
                {
                    "rgba(179,181,198,1)"
                },
                PointBorderColor = new List <string>()
                {
                    "#fff"
                },
                PointHoverBackgroundColor = new List <string>()
                {
                    "#fff"
                },
                PointHoverBorderColor = new List <string>()
                {
                    "rgba(179,181,198,1)"
                },
                Data = new List <double>()
                {
                    65, 59, 80, 81, 56, 55, 40
                }
            };

            RadarDataset dataset2 = new RadarDataset()
            {
                Label                = "My Second dataset",
                BackgroundColor      = "rgba(255,99,132,0.2)",
                BorderColor          = "rgba(255,99,132,1)",
                PointBackgroundColor = new List <string>()
                {
                    "rgba(255,99,132,1)"
                },
                PointBorderColor = new List <string>()
                {
                    "#fff"
                },
                PointHoverBackgroundColor = new List <string>()
                {
                    "#fff"
                },
                PointHoverBorderColor = new List <string>()
                {
                    "rgba(255,99,132,1)"
                },
                Data = new List <double>()
                {
                    28, 48, 40, 19, 96, 27, 100
                }
            };

            data.Datasets = new List <Dataset>();
            data.Datasets.Add(dataset1);
            data.Datasets.Add(dataset2);

            chart.Data = data;

            string code = chart.CreateChartCode("radarChart");

            return(code);
        }
Exemple #3
0
        public Chart GenerateRadarChart()
        {
            Chart chart = new Chart
            {
                Type = "radar"
            };

            ChartJSCore.Models.Data data = new ChartJSCore.Models.Data
            {
                Labels = new List <string>()
                {
                    "Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"
                }
            };

            RadarDataset dataset1 = new RadarDataset()
            {
                Label                = "My First dataset",
                BackgroundColor      = "rgba(179,181,198,0.2)",
                BorderColor          = "rgba(179,181,198,1)",
                PointBackgroundColor = new List <string>()
                {
                    "rgba(179,181,198,1)"
                },
                PointBorderColor = new List <string>()
                {
                    "#fff"
                },
                PointHoverBackgroundColor = new List <string>()
                {
                    "#fff"
                },
                PointHoverBorderColor = new List <string>()
                {
                    "rgba(179,181,198,1)"
                },
                Data = new List <double>()
                {
                    65, 59, 80, 81, 56, 55, 40
                }
            };

            RadarDataset dataset2 = new RadarDataset()
            {
                Label                = "My Second dataset",
                BackgroundColor      = "rgba(255,99,132,0.2)",
                BorderColor          = "rgba(255,99,132,1)",
                PointBackgroundColor = new List <string>()
                {
                    "rgba(255,99,132,1)"
                },
                PointBorderColor = new List <string>()
                {
                    "#fff"
                },
                PointHoverBackgroundColor = new List <string>()
                {
                    "#fff"
                },
                PointHoverBorderColor = new List <string>()
                {
                    "rgba(255,99,132,1)"
                },
                Data = new List <double>()
                {
                    28, 48, 40, 19, 96, 27, 100
                }
            };

            data.Datasets = new List <Dataset>
            {
                dataset1,
                dataset2
            };

            chart.Data = data;

            return(chart);
        }
        private static Chart GenerateRadarChart()
        {
            var chart = new Chart {
                Type = Enums.ChartType.Radar
            };

            var data = new Data
            {
                Labels = new List <string>
                {
                    "Eating",
                    "Drinking",
                    "Sleeping",
                    "Designing",
                    "Coding",
                    "Cycling",
                    "Running"
                }
            };

            var dataset1 = new RadarDataset
            {
                Label                = "My First dataset",
                BackgroundColor      = "rgba(179,181,198,0.2)",
                BorderColor          = "rgba(179,181,198,1)",
                PointBackgroundColor = new List <string> {
                    "rgba(179,181,198,1)"
                },
                PointBorderColor = new List <string> {
                    "#fff"
                },
                PointHoverBackgroundColor = new List <string> {
                    "#fff"
                },
                PointHoverBorderColor = new List <string> {
                    "rgba(179,181,198,1)"
                },
                Data = new List <double> {
                    65, 59, 80, 81, 56, 55, 40
                }
            };

            var dataset2 = new RadarDataset
            {
                Label                = "My Second dataset",
                BackgroundColor      = "rgba(255,99,132,0.2)",
                BorderColor          = "rgba(255,99,132,1)",
                PointBackgroundColor = new List <string> {
                    "rgba(255,99,132,1)"
                },
                PointBorderColor = new List <string> {
                    "#fff"
                },
                PointHoverBackgroundColor = new List <string> {
                    "#fff"
                },
                PointHoverBorderColor = new List <string> {
                    "rgba(255,99,132,1)"
                },
                Data = new List <double> {
                    28, 48, 40, 19, 96, 27, 100
                }
            };

            data.Datasets = new List <Dataset> {
                dataset1, dataset2
            };

            chart.Data = data;

            return(chart);
        }
Exemple #5
0
        private static Chart GenerateRadarChart(List <Project> listOfProjects)
        {
            Chart chart = new Chart();

            chart.Type = Enums.ChartType.Radar;

            Data data = new Data();

            data.Labels = new List <string>()
            {
                "Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"
            };

            RadarDataset dataset1 = new RadarDataset()
            {
                Label                = "My First dataset",
                BackgroundColor      = ChartColor.FromRgba(179, 181, 198, 0.2),
                BorderColor          = ChartColor.FromRgba(179, 181, 198, 1),
                PointBackgroundColor = new List <ChartColor>()
                {
                    ChartColor.FromRgba(179, 181, 198, 1)
                },
                PointBorderColor = new List <ChartColor>()
                {
                    ChartColor.FromHexString("#fff")
                },
                PointHoverBackgroundColor = new List <ChartColor>()
                {
                    ChartColor.FromHexString("#fff")
                },
                PointHoverBorderColor = new List <ChartColor>()
                {
                    ChartColor.FromRgba(179, 181, 198, 1)
                },
                Data = new List <double>()
                {
                    65, 59, 80, 81, 56, 55, 40
                }
            };

            RadarDataset dataset2 = new RadarDataset()
            {
                Label                = "My Second dataset",
                BackgroundColor      = ChartColor.FromRgba(255, 99, 132, 0.2),
                BorderColor          = ChartColor.FromRgba(255, 99, 132, 1),
                PointBackgroundColor = new List <ChartColor>()
                {
                    ChartColor.FromRgba(255, 99, 132, 1)
                },
                PointBorderColor = new List <ChartColor>()
                {
                    ChartColor.FromHexString("#fff")
                },
                PointHoverBackgroundColor = new List <ChartColor>()
                {
                    ChartColor.FromHexString("#fff")
                },
                PointHoverBorderColor = new List <ChartColor>()
                {
                    ChartColor.FromRgba(255, 99, 132, 1)
                },
                Data = new List <double>()
                {
                    28, 48, 40, 19, 96, 27, 100
                }
            };

            data.Datasets = new List <Dataset>();
            data.Datasets.Add(dataset1);
            data.Datasets.Add(dataset2);

            chart.Data = data;

            return(chart);
        }