コード例 #1
0
        public override View GetSampleContent(Context context)
        {
            var Data = new ObservableCollection <SunburstModel>();

            Data.Add(new SunburstModel()
            {
                Quarter = "Q1", Month = "Jan", Sales = 11
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q1", Month = "Feb", Sales = 8
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q1", Month = "Mar", Sales = 5
            });

            Data.Add(new SunburstModel()
            {
                Quarter = "Q2", Month = "Apr", Sales = 13
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q2", Month = "May", Sales = 12
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q2", Month = "Jun", Sales = 17
            });

            Data.Add(new SunburstModel()
            {
                Quarter = "Q3", Month = "Jul", Sales = 5
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q3", Month = "Aug", Sales = 4
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q3", Month = "Sep", Sales = 5
            });

            Data.Add(new SunburstModel()
            {
                Quarter = "Q4", Month = "Oct", Sales = 7
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q4", Month = "Nov", Sales = 18
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q4", Month = "Dec", Week = "W1", Sales = 5
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q4", Month = "Dec", Week = "W2", Sales = 5
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q4", Month = "Dec", Week = "W3", Sales = 5
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q4", Month = "Dec", Week = "W4", Sales = 5
            });



            chart                 = new SfSunburstChart(context);
            chart.ItemsSource     = Data;
            chart.Radius          = 0.95;
            chart.ValueMemberPath = "Sales";
            var levels = new SunburstLevelCollection()
            {
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "Quarter"
                },
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "Month"
                },
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "Week"
                }
            };

            chart.Levels = levels;

            chart.EnableAnimation = true;

            chart.Title.IsVisible = true;
            chart.Title.Margin    = new Thickness(10, 5, 5, 5);
            chart.Title.Text      = "Sales Performance";
            chart.Title.TextSize  = 20;

            chart.Legend.IsVisible = true;

            chart.DataLabel.ShowLabel = true;

            chart.TooltipSettings             = new CustomTooltip(context);
            chart.TooltipSettings.ShowTooltip = true;

            return(chart);
        }
コード例 #2
0
        public SunburstChart()
        {
            var Data = new ObservableCollection <SunburstModel>();

            Data.Add(new SunburstModel()
            {
                Quarter = "Q1", Month = "Jan", Sales = 11
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q1", Month = "Feb", Sales = 8
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q1", Month = "Mar", Sales = 5
            });

            Data.Add(new SunburstModel()
            {
                Quarter = "Q2", Month = "Apr", Sales = 13
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q2", Month = "May", Sales = 12
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q2", Month = "Jun", Sales = 17
            });

            Data.Add(new SunburstModel()
            {
                Quarter = "Q3", Month = "Jul", Sales = 5
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q3", Month = "Aug", Sales = 4
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q3", Month = "Sep", Sales = 5
            });

            Data.Add(new SunburstModel()
            {
                Quarter = "Q4", Month = "Oct", Sales = 7
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q4", Month = "Nov", Sales = 18
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q4", Month = "Dec", Week = "W1", Sales = 5
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q4", Month = "Dec", Week = "W2", Sales = 5
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q4", Month = "Dec", Week = "W3", Sales = 5
            });
            Data.Add(new SunburstModel()
            {
                Quarter = "Q4", Month = "Dec", Week = "W4", Sales = 5
            });



            chart                 = new SfSunburstChart();
            chart.ItemsSource     = Data;
            chart.Radius          = 0.95;
            chart.ValueMemberPath = "Sales";
            var levels = new SunburstLevelCollection()
            {
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "Quarter"
                },
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "Month"
                },
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "Week"
                },
            };

            chart.Levels = levels;


            chart.Title.IsVisible = true;
            chart.Title.Text      = "Sales Performance";
            chart.Title.Font      = UIFont.SystemFontOfSize(20);
            chart.Title.Margin    = new UIEdgeInsets(10, 5, 5, 5);

            chart.Legend.IsVisible       = true;
            chart.Legend.LegendPosition  = SunburstDockPosition.Bottom;
            chart.Legend.LabelStyle.Font = UIFont.SystemFontOfSize(16);
            chart.Legend.IconHeight      = 12;
            chart.Legend.IconWidth       = 12;

            chart.DataLabel.ShowLabel = true;

            chart.EnableAnimation = true;

            chart.TooltipSettings             = new CustomTooltip();
            chart.TooltipSettings.ShowTooltip = true;

            this.AddSubview(chart);
        }
コード例 #3
0
ファイル: DrillDown.cs プロジェクト: yo1249009/xamarin-demos
        public override View GetSampleContent(Context context)
        {
            this.DataSource = new ObservableCollection <SunburstModel>
            {
                new SunburstModel {
                    Country = "USA", JobDescription = "Sales", JobGroup = "Executive", EmployeesCount = 50
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Sales", JobGroup = "Analyst", EmployeesCount = 40
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Marketing", EmployeesCount = 40
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 35
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Windows", EmployeesCount = 175
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Web", EmployeesCount = 70
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Management", EmployeesCount = 40
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Accounts", EmployeesCount = 60
                },

                new SunburstModel {
                    Country = "India", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 33
                },
                new SunburstModel {
                    Country = "India", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Windows", EmployeesCount = 125
                },
                new SunburstModel {
                    Country = "India", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Web", EmployeesCount = 60
                },
                new SunburstModel {
                    Country = "India", JobDescription = "HR Executives", EmployeesCount = 70
                },
                new SunburstModel {
                    Country = "India", JobDescription = "Accounts", EmployeesCount = 45
                },

                new SunburstModel {
                    Country = "Germany", JobDescription = "Sales", JobGroup = "Executive", EmployeesCount = 30
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Sales", JobGroup = "Analyst", EmployeesCount = 40
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Marketing", EmployeesCount = 50
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 40
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Windows", EmployeesCount = 65
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Web", EmployeesCount = 27
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Management", EmployeesCount = 33
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Accounts", EmployeesCount = 55
                },

                new SunburstModel {
                    Country = "UK", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 25
                },
                new SunburstModel {
                    Country = "UK", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Windows", EmployeesCount = 96
                },
                new SunburstModel {
                    Country = "UK", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Web", EmployeesCount = 55
                },
                new SunburstModel {
                    Country = "UK", JobDescription = "HR Executives", EmployeesCount = 60
                },
                new SunburstModel {
                    Country = "UK", JobDescription = "Accounts", EmployeesCount = 30
                }
            };

            chart                 = new SfSunburstChart(context);
            chart.ItemsSource     = DataSource;
            chart.Radius          = 0.95;
            chart.ValueMemberPath = "EmployeesCount";
            var levels = new SunburstLevelCollection()
            {
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "Country"
                },
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "JobDescription"
                },
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "JobGroup"
                },
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "JobRole"
                }
            };

            chart.Levels = levels;

            chart.Title.IsVisible = true;
            chart.Title.Margin    = new Thickness(10, 40 * context.Resources.DisplayMetrics.Density, 5, 5);
            chart.Title.Text      = "Employees Count";
            chart.Title.TextSize  = 20;

            chart.Legend.IsVisible = true;

            chart.DataLabel.ShowLabel = true;

            chart.DrilldownSettings.Enable = true;

            var label = new TextView(context);

            label.SetPadding(5, 5, 5, 5);
            label.Text     = "Double tap on the segment to perform drill down.";
            label.TextSize = 16;
            label.SetTextColor(Color.Red);
            label.SetX(0);
            label.SetY(0);
            chart.AddView(label);

            return(chart);
        }
コード例 #4
0
        public override View GetSampleContent(Context context)
        {
            this.Population_Data = new ObservableCollection <SunburstModel>
            {
                new SunburstModel {
                    State = "Ontario", Continent = "North America", Country = "Canada", Population = 13210600
                },
                new SunburstModel {
                    State = "New York", Continent = "North America", Country = "United States", Population = 19378102
                },
                new SunburstModel {
                    State = "Pennsylvania", Continent = "North America", Country = "United States", Population = 12702379
                },
                new SunburstModel {
                    State = "Ohio", Continent = "North America", Country = "United States", Population = 11536504
                },
                new SunburstModel {
                    State = "Buenos Aires", Continent = "South America", Country = "Argentina", Population = 15594428
                },
                new SunburstModel {
                    State = "Minas Gerais", Continent = "South America", Country = "Brazil", Population = 20593366
                },
                new SunburstModel {
                    State = "Rio de Janeiro", Continent = "South America", Country = "Brazil", Population = 16369178
                },
                new SunburstModel {
                    State = "Bahia", Continent = "South America", Country = "Brazil", Population = 15044127
                },
                new SunburstModel {
                    State = "Rio Grande do Sul", Continent = "South America", Country = "Brazil", Population = 11164050
                },
                new SunburstModel {
                    State = "Parana", Continent = "South America", Country = "Brazil", Population = 10997462
                },
                new SunburstModel {
                    State = "Chittagong", Continent = "Asia", Country = "Bangladesh", Population = 28079000
                },
                new SunburstModel {
                    State = "Rajshahi", Continent = "Asia", Country = "Bangladesh", Population = 18329000
                },
                new SunburstModel {
                    State = "Khulna", Continent = "Asia", Country = "Bangladesh", Population = 15563000
                },
                new SunburstModel {
                    State = "Liaoning", Continent = "Asia", Country = "China", Population = 43746323
                },
                new SunburstModel {
                    State = "Shaanxi", Continent = "Asia", Country = "China", Population = 37327378
                },
                new SunburstModel {
                    State = "Fujian", Continent = "Asia", Country = "China", Population = 36894216
                },
                new SunburstModel {
                    State = "Shanxi", Continent = "Asia", Country = "China", Population = 35712111
                },
                new SunburstModel {
                    State = "Kerala", Continent = "Asia", Country = "India", Population = 33387677
                },
                new SunburstModel {
                    State = "Punjab", Continent = "Asia", Country = "India", Population = 27704236
                },
                new SunburstModel {
                    State = "Haryana", Continent = "Asia", Country = "India", Population = 25353081
                },
                new SunburstModel {
                    State = "Delhi", Continent = "Asia", Country = "India", Population = 16753235
                },
                new SunburstModel {
                    State = "Jammu", Continent = "Asia", Country = "India", Population = 12548926
                },
                new SunburstModel {
                    State = "West Java", Continent = "Asia", Country = "Indonesia", Population = 43021826
                },
                new SunburstModel {
                    State = "East Java", Continent = "Asia", Country = "Indonesia", Population = 37476011
                },
                new SunburstModel {
                    State = "Banten", Continent = "Asia", Country = "Indonesia", Population = 10644030
                },
                new SunburstModel {
                    State = "Jakarta", Continent = "Asia", Country = "Indonesia", Population = 10187595
                },
                new SunburstModel {
                    State = "Tianjin", Continent = "Africa", Country = "Ethiopia", Population = 24000200
                },
                new SunburstModel {
                    State = "Tianjin", Continent = "Africa", Country = "Ethiopia", Population = 15042531
                },
                new SunburstModel {
                    State = "Rift Valley", Continent = "Africa", Country = "Kenya", Population = 10006805
                },
                new SunburstModel {
                    State = "Lagos", Continent = "Africa", Country = "Nigeria", Population = 10006805
                },
                new SunburstModel {
                    State = "Kano", Continent = "Africa", Country = "Nigeria", Population = 10006805
                },
                new SunburstModel {
                    State = "Gauteng", Continent = "Africa", Country = "South Africa", Population = 12728400
                },
                new SunburstModel {
                    State = "KwaZulu-Natal", Continent = "Africa", Country = "South Africa", Population = 10456900
                },
                new SunburstModel {
                    State = "Ile-de- France", Continent = "Europe", Country = "France", Population = 11694000
                },
                new SunburstModel {
                    State = "North Rhine-Westphalia", Continent = "Europe", Country = "Germany", Population = 17872863
                },
                new SunburstModel {
                    State = "Bavaria", Continent = "Europe", Country = "Germany", Population = 12510331
                },
                new SunburstModel {
                    State = "NBaden-Wurttemberg", Continent = "Europe", Country = "Germany", Population = 10747479
                },
                new SunburstModel {
                    State = "England", Continent = "Europe", Country = "United Kingdom", Population = 51446600
                }
            };

            chart                 = new SfSunburstChart(context);
            chart.ItemsSource     = Population_Data;
            chart.Radius          = 0.95;
            chart.ValueMemberPath = "Population";
            var levels = new SunburstLevelCollection()
            {
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "Continent"
                },
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "Country"
                },
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "State"
                },
            };

            chart.Levels = levels;

            chart.Title.IsVisible = true;
            chart.Title.Margin    = new Thickness(10, 5, 5, 5);
            chart.Title.Text      = "Population Data";
            chart.Title.TextSize  = 20;

            chart.Legend.IsVisible = true;

            chart.DataLabel.ShowLabel = true;

            chart.SelectionSettings.EnableSelection = true;

            return(chart);
        }
コード例 #5
0
        public DrillDown()
        {
            this.DataSource = new ObservableCollection <SunburstModel>
            {
                new SunburstModel {
                    Country = "USA", JobDescription = "Sales", JobGroup = "Executive", EmployeesCount = 50
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Sales", JobGroup = "Analyst", EmployeesCount = 40
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Marketing", EmployeesCount = 40
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 35
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Windows", EmployeesCount = 175
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Web", EmployeesCount = 70
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Management", EmployeesCount = 40
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Accounts", EmployeesCount = 60
                },

                new SunburstModel {
                    Country = "India", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 33
                },
                new SunburstModel {
                    Country = "India", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Windows", EmployeesCount = 125
                },
                new SunburstModel {
                    Country = "India", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Web", EmployeesCount = 60
                },
                new SunburstModel {
                    Country = "India", JobDescription = "HR Executives", EmployeesCount = 70
                },
                new SunburstModel {
                    Country = "India", JobDescription = "Accounts", EmployeesCount = 45
                },

                new SunburstModel {
                    Country = "Germany", JobDescription = "Sales", JobGroup = "Executive", EmployeesCount = 30
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Sales", JobGroup = "Analyst", EmployeesCount = 40
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Marketing", EmployeesCount = 50
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 40
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Windows", EmployeesCount = 65
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Web", EmployeesCount = 27
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Management", EmployeesCount = 33
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Accounts", EmployeesCount = 55
                },

                new SunburstModel {
                    Country = "UK", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 25
                },
                new SunburstModel {
                    Country = "UK", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Windows", EmployeesCount = 96
                },
                new SunburstModel {
                    Country = "UK", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Web", EmployeesCount = 55
                },
                new SunburstModel {
                    Country = "UK", JobDescription = "HR Executives", EmployeesCount = 60
                },
                new SunburstModel {
                    Country = "UK", JobDescription = "Accounts", EmployeesCount = 30
                }
            };

            chart                 = new SfSunburstChart();
            chart.ItemsSource     = DataSource;
            chart.Radius          = 0.95;
            chart.ValueMemberPath = "EmployeesCount";
            var levels = new SunburstLevelCollection()
            {
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "Country"
                },
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "JobDescription"
                },
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "JobGroup"
                },
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "JobRole"
                }
            };

            chart.Levels = levels;

            chart.Title.IsVisible = true;
            chart.Title.Text      = "Employee Count";
            chart.Title.Font      = UIFont.SystemFontOfSize(20);
            chart.Title.Margin    = new UIEdgeInsets(10, 5, 5, 5);

            chart.Legend.IsVisible       = true;
            chart.Legend.LegendPosition  = SunburstDockPosition.Top;
            chart.Legend.LabelStyle.Font = UIFont.SystemFontOfSize(16);
            chart.Legend.IconHeight      = 12;
            chart.Legend.IconWidth       = 12;

            chart.DrilldownSettings.Enable = true;

            chart.DataLabel.ShowLabel = true;

            label               = new UILabel();
            label.Text          = "Double tap on the segment to perform drill down.";
            label.TextColor     = UIColor.Black;
            label.TextAlignment = UITextAlignment.Center;
            label.Font          = UIFont.FromName("Helvetica", 12f);



            this.AddSubview(chart);
            this.AddSubview(label);
        }
コード例 #6
0
        public override View GetSampleContent(Context context)
        {
            this.DataSource = new ObservableCollection <SunburstModel>
            {
                new SunburstModel {
                    Country = "USA", JobDescription = "Sales", JobGroup = "Executive", EmployeesCount = 50
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Sales", JobGroup = "Analyst", EmployeesCount = 40
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Marketing", EmployeesCount = 40
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 35
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Windows", EmployeesCount = 175
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Web", EmployeesCount = 70
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Management", EmployeesCount = 40
                },
                new SunburstModel {
                    Country = "USA", JobDescription = "Accounts", EmployeesCount = 60
                },

                new SunburstModel {
                    Country = "India", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 33
                },
                new SunburstModel {
                    Country = "India", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Windows", EmployeesCount = 125
                },
                new SunburstModel {
                    Country = "India", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Web", EmployeesCount = 60
                },
                new SunburstModel {
                    Country = "India", JobDescription = "HR Executives", EmployeesCount = 70
                },
                new SunburstModel {
                    Country = "India", JobDescription = "Accounts", EmployeesCount = 45
                },

                new SunburstModel {
                    Country = "Germany", JobDescription = "Sales", JobGroup = "Executive", EmployeesCount = 30
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Sales", JobGroup = "Analyst", EmployeesCount = 40
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Marketing", EmployeesCount = 50
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 40
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Windows", EmployeesCount = 65
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Web", EmployeesCount = 27
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Management", EmployeesCount = 33
                },
                new SunburstModel {
                    Country = "Germany", JobDescription = "Accounts", EmployeesCount = 55
                },

                new SunburstModel {
                    Country = "UK", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 25
                },
                new SunburstModel {
                    Country = "UK", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Windows", EmployeesCount = 96
                },
                new SunburstModel {
                    Country = "UK", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Web", EmployeesCount = 55
                },
                new SunburstModel {
                    Country = "UK", JobDescription = "HR Executives", EmployeesCount = 60
                },
                new SunburstModel {
                    Country = "UK", JobDescription = "Accounts", EmployeesCount = 30
                }
            };

            chart                 = new SfSunburstChart(context);
            chart.ItemsSource     = DataSource;
            chart.Radius          = 0.95;
            chart.ValueMemberPath = "EmployeesCount";
            var levels = new SunburstLevelCollection()
            {
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "Country"
                },
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "JobDescription"
                },
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "JobGroup"
                },
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "JobRole"
                }
            };

            chart.Levels = levels;

            chart.Title.IsVisible = true;
            chart.Title.Margin    = new Thickness(10, 5, 5, 5);
            chart.Title.Text      = "Employees Count";
            chart.Title.TextSize  = 20;

            chart.Legend.IsVisible = true;

            chart.DataLabel.ShowLabel = true;

            chart.DrilldownSettings.Enable = true;

            var label = new TextView(context);

            label.SetPadding(5, 10, 5, 15);
            label.Text     = "Double tap on the segment to perform drill down.";
            label.TextSize = 16;
            label.SetTextColor(Color.Red);


            var layout = new LinearLayout(context)
            {
                Orientation = Android.Widget.Orientation.Vertical
            };

            var layoutLabel = new LinearLayout(context)
            {
                Orientation      = Android.Widget.Orientation.Horizontal,
                LayoutParameters =
                    new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            };

            layoutLabel.SetHorizontalGravity(GravityFlags.CenterHorizontal);
            layoutLabel.AddView(label);

            layout.AddView(layoutLabel);
            layout.AddView(chart);

            return(layout);
        }
コード例 #7
0
        public override View GetSampleContent(Context context)
        {
            var Data = new ObservableCollection <SunburstModel>();

            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "USA", JobDescription = "Sales", JobGroup = "Executive", EmployeesCount = 50
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "USA", JobDescription = "Sales", JobGroup = "Analyst", EmployeesCount = 40
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "USA", JobDescription = "Marketing", EmployeesCount = 40
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "USA", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 35
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "USA", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Windows", EmployeesCount = 175
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "USA", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Web", EmployeesCount = 70
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "USA", JobDescription = "Management", EmployeesCount = 40
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "USA", JobDescription = "Accounts", EmployeesCount = 60
            });

            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "India", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 33
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "India", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Windows", EmployeesCount = 125
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "India", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Web", EmployeesCount = 60
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "India", JobDescription = "HR Executives", EmployeesCount = 70
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "India", JobDescription = "Accounts", EmployeesCount = 45
            });

            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "Germany", JobDescription = "Sales", JobGroup = "Executive", EmployeesCount = 30
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "Germany", JobDescription = "Sales", JobGroup = "Analyst", EmployeesCount = 40
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "Germany", JobDescription = "Marketing", EmployeesCount = 50
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "Germany", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 40
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "Germany", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Windows", EmployeesCount = 65
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "Germany", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Web", EmployeesCount = 27
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "Germany", JobDescription = "Management", EmployeesCount = 33
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "Germany", JobDescription = "Accounts", EmployeesCount = 55
            });

            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "UK", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 25
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "UK", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Windows", EmployeesCount = 96
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "UK", JobDescription = "Technical", JobGroup = "Developers", JobRole = "Web", EmployeesCount = 55
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "UK", JobDescription = "HR Executives", EmployeesCount = 60
            });
            Data.Add(new SunburstModel()
            {
                Category = "Employees", Country = "UK", JobDescription = "Accounts", EmployeesCount = 30
            });

            chart                 = new SfSunburstChart(context);
            chart.ItemsSource     = Data;
            chart.Radius          = 0.95;
            chart.ValueMemberPath = "EmployeesCount";
            var levels = new SunburstLevelCollection()
            {
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "Country"
                },
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "JobDescription"
                },
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "JobGroup"
                },
                new SunburstHierarchicalLevel()
                {
                    GroupMemberPath = "JobRole"
                }
            };

            chart.Levels = levels;

            chart.Title.IsVisible = true;
            chart.Title.Margin    = new Thickness(10, 5, 5, 5);
            chart.Title.Text      = "Employees Count";
            chart.Title.TextSize  = 20;

            chart.Legend.IsVisible = true;

            chart.DataLabel.ShowLabel = true;

            return(chart);
        }