public TreeMapGettingStarted() { InitializeComponent(); baritem = new ToolbarItem(); this.BindingContext = this; this.TreeMap.LegendSettings.Size = new Size(300, 70); ObservableCollection <Range> ranges = new ObservableCollection <Range>(); ranges.Add(new Range() { LegendLabel = "1 % Growth", From = 0, To = 1, Color = Color.FromHex("#77D8D8") }); ranges.Add(new Range() { LegendLabel = "2 % Growth", From = 0, To = 2, Color = Color.FromHex("#AED960") }); ranges.Add(new Range() { LegendLabel = "3 % Growth", From = 0, To = 3, Color = Color.FromHex("#FFAF51") }); ranges.Add(new Range() { LegendLabel = "4 % Growth", From = 0, To = 4, Color = Color.FromHex("#F3D240") }); this.TreeMap.LeafItemColorMapping = rangeMapping = new RangeColorMapping() { Ranges = ranges }; treeMapColorMapping = rangeMapping; desaturationMapping = new DesaturationColorMapping() { From = 1, To = 0.2, Color = Color.FromHex("#02AEDC") }; this.TreeMap.DataSource = new PopulationViewModel().PopulationDetails; uniMapping = new UniColorMapping() { Color = Color.FromHex("#D21243") }; paletteMapping = new PaletteColorMapping(); paletteMapping.Colors.Add(Color.FromHex("#BD8EC2")); paletteMapping.Colors.Add(Color.FromHex("#FFD34E")); paletteMapping.Colors.Add(Color.FromHex("#55B949")); paletteMapping.Colors.Add(Color.FromHex("#00B2DA")); paletteMapping.Colors.Add(Color.FromHex("#744A94")); paletteMapping.Colors.Add(Color.FromHex("#A1A616")); paletteMapping.Colors.Add(Color.FromHex("#0753A1")); DrawOptionsPage(); baritem.Clicked += buttonClicked; this.PropertyView = GetOptionPage(); toggleButton.Value = groupPadding; }
public override View GetSampleContent(Context context) { DisplayMetrics displayMetrics = context.Resources.DisplayMetrics; int screenHeight = displayMetrics.HeightPixels; LinearLayout layout = new LinearLayout(context); layout.Orientation = Orientation.Vertical; TextView textView = new TextView(context); textView.TextAlignment = TextAlignment.Center; textView.TextSize = 18; textView.Gravity = GravityFlags.CenterHorizontal | GravityFlags.CenterVertical; textView.SetHeight((int)(screenHeight * 0.05)); textView.Text = "Continents by population"; layout.AddView(textView); treeMap = new SfTreeMap(context); treeMap.WeightValuePath = "Population"; treeMap.ColorValuePath = "Population"; treeMap.HighlightOnSelection = false; treeMap.LeafItemSettings = new LeafItemSetting() { ShowLabels = true, Gap = 5, LabelPath = "Region", StrokeColor = Android.Graphics.Color.Gray, StrokeWidth = 1 }; TreeMapFlatLevel level = new TreeMapFlatLevel { ShowHeader = true, GroupPath = "Continent", GroupStrokeColor = Android.Graphics.Color.Gray, GroupStrokeWidth = 1, GroupPadding = 5, LabelPath = "Continent", HeaderStyle = new Style() { TextColor = Android.Graphics.Color.Black }, HeaderHeight = 25 }; TreeMapFlatLevel level1 = new TreeMapFlatLevel { ShowHeader = true, GroupPath = "States", GroupStrokeColor = Android.Graphics.Color.Gray, GroupStrokeWidth = 1, GroupPadding = 5, LabelPath = "States", HeaderStyle = new Style() { TextColor = Android.Graphics.Color.Black }, HeaderHeight = 25 }; treeMap.Levels.Add(level); treeMap.Levels.Add(level1); PaletteColorMapping colorMapping = new PaletteColorMapping(); colorMapping.Colors.Add(Color.ParseColor("#C044A5")); colorMapping.Colors.Add(Color.ParseColor("#665197")); colorMapping.Colors.Add(Color.ParseColor("#FF4652")); colorMapping.Colors.Add(Color.ParseColor("#8B2286")); colorMapping.Colors.Add(Color.ParseColor("#448FC0")); treeMap.LeafItemColorMapping = colorMapping; treeMap.DataSource = GetDataSource(); treeMap.EnableDrilldown = true; treeMap.ShowTooltip = true; layout.AddView(treeMap); return(layout); }
public GettingStarted() { baritem = new ToolbarItem(); tree = new SfTreeMap(); Title = "GettingStarted"; this.BackgroundColor = Device.OnPlatform(iOS: Color.White, Android: Color.White, WinPhone: Color.Black); tree.WeightValuePath = "Population"; tree.ColorValuePath = "Growth"; tree.LeafItemSettings = new LeafItemSettings(); tree.LeafItemSettings.BorderColor = Device.OnPlatform(iOS: Color.Gray, Android: Color.White, WinPhone: IsDarkTheme ? Color.White : Color.Gray); tree.LeafItemSettings.BorderWidth = Device.OnPlatform(iOS: 1, Android: 2, WinPhone: 2); tree.LeafItemSettings.Gap = Device.OnPlatform(iOS: 1, Android: 5, WinPhone: 3); tree.LeafItemSettings.LabelStyle = new Syncfusion.SfTreeMap.XForms.Style() { Font = Font.SystemFontOfSize(18), Color = Color.White }; tree.LeafItemSettings.LabelPath = "Country"; ObservableCollection <Range> ranges = new ObservableCollection <Range>(); ranges.Add(new Range() { LegendLabel = "1 % Growth", From = 0, To = 1, Color = Color.FromHex("#77D8D8") }); ranges.Add(new Range() { LegendLabel = "2 % Growth", From = 0, To = 2, Color = Color.FromHex("#AED960") }); ranges.Add(new Range() { LegendLabel = "3 % Growth", From = 0, To = 3, Color = Color.FromHex("#FFAF51") }); ranges.Add(new Range() { LegendLabel = "4 % Growth", From = 0, To = 4, Color = Color.FromHex("#F3D240") }); tree.LeafItemColorMapping = rangeMapping = new RangeColorMapping() { Ranges = ranges }; Size legendSize = Device.OnPlatform(iOS: new Size(300, 60), Android: new Size(200, 60), WinPhone: new Size(420, 75)); Size iconSize = Device.OnPlatform(iOS: new Size(17, 17), Android: new Size(25, 25), WinPhone: new Size(15, 15)); treeMapColorMapping = rangeMapping; desaturationMapping = new DesaturationColorMapping() { From = 1, To = 0.2, Color = Color.FromHex("#02AEDC") }; TreeMapFlatLevel level = new TreeMapFlatLevel() { HeaderStyle = new Syncfusion.SfTreeMap.XForms.Style() { Color = Device.OnPlatform(iOS: Color.Gray, Android: Color.Gray, WinPhone: Color.White) }, GroupPath = "Continent", HeaderHeight = 20, GroupGap = 5, ShowHeader = true }; level.GroupBackground = Device.OnPlatform(iOS: Color.White, Android: Color.White, WinPhone: Color.Black); tree.Levels.Add(level); tree.DataSource = new PopulationViewModel().PopulationDetails; if (Device.Idiom == TargetIdiom.Phone && Device.OS == TargetPlatform.Windows) { tree.LegendSettings = new LegendSettings() { Size = new Size(0, 0), ShowLegend = false }; } else { tree.LegendSettings = new LegendSettings() { LabelStyle = new Syncfusion.SfTreeMap.XForms.Style() { Font = Device.OnPlatform(iOS: Font.SystemFontOfSize(12), Android: Font.SystemFontOfSize(14), WinPhone: Font.SystemFontOfSize(12)), Color = Color.Gray }, IconSize = iconSize, ShowLegend = true, Size = legendSize }; if (Device.Idiom == TargetIdiom.Tablet) { tree.LegendSettings.Size = new Size(500, 30); } } uniMapping = new UniColorMapping() { Color = Color.FromHex("#D21243") }; paletteMapping = new PaletteColorMapping(); paletteMapping.Colors.Add(Color.FromHex("#BD8EC2")); paletteMapping.Colors.Add(Color.FromHex("#FFD34E")); paletteMapping.Colors.Add(Color.FromHex("#55B949")); paletteMapping.Colors.Add(Color.FromHex("#00B2DA")); paletteMapping.Colors.Add(Color.FromHex("#744A94")); paletteMapping.Colors.Add(Color.FromHex("#A1A616")); paletteMapping.Colors.Add(Color.FromHex("#0753A1")); DrawOptionsPage(); this.PropertyView = GetOptionPage(); this.ContentView = tree; this.ContentView.BackgroundColor = Color.White; }
public GettingStarted () { baritem = new ToolbarItem(); tree = new SfTreeMap(); Title = "GettingStarted"; this.BackgroundColor = Device.OnPlatform(iOS: Color.White, Android: Color.White, WinPhone: Color.Black); tree.WeightValuePath = "Population"; tree.ColorValuePath = "Growth"; tree.LeafItemSettings = new LeafItemSettings(); tree.LeafItemSettings.BorderColor = Device.OnPlatform(iOS: Color.Gray, Android: Color.White, WinPhone:IsDarkTheme ? Color.White : Color.Gray); tree.LeafItemSettings.BorderWidth = Device.OnPlatform(iOS: 1, Android:2, WinPhone:2); tree.LeafItemSettings.Gap = Device.OnPlatform(iOS:1 , Android: 5, WinPhone: 3); tree.LeafItemSettings.LabelStyle = new Syncfusion.SfTreeMap.XForms.Style() { Font = Font.SystemFontOfSize(18), Color = Color.White }; tree.LeafItemSettings.LabelPath = "Country"; ObservableCollection<Range> ranges = new ObservableCollection<Range>(); ranges.Add(new Range() { LegendLabel = "1 % Growth", From = 0, To = 1, Color = Color.FromHex("#77D8D8") }); ranges.Add(new Range() { LegendLabel = "2 % Growth", From = 0, To = 2, Color = Color.FromHex("#AED960") }); ranges.Add(new Range() { LegendLabel = "3 % Growth", From = 0, To = 3, Color = Color.FromHex("#FFAF51") }); ranges.Add(new Range() { LegendLabel = "4 % Growth", From = 0, To = 4, Color = Color.FromHex("#F3D240") }); tree.LeafItemColorMapping = rangeMapping = new RangeColorMapping() { Ranges = ranges }; Size legendSize = Device.OnPlatform(iOS: new Size(300, 60), Android: new Size(200, 60), WinPhone: new Size(420, 75)); Size iconSize = Device.OnPlatform(iOS: new Size(17, 17), Android: new Size(25, 25), WinPhone: new Size(15, 15)); treeMapColorMapping = rangeMapping; desaturationMapping = new DesaturationColorMapping (){ From = 1, To = 0.2, Color = Color.FromHex ("#02AEDC") }; TreeMapFlatLevel level = new TreeMapFlatLevel() { HeaderStyle = new Syncfusion.SfTreeMap.XForms.Style() { Color= Device.OnPlatform(iOS: Color.Gray, Android: Color.Gray, WinPhone: Color.White) }, GroupPath = "Continent", HeaderHeight = 20, GroupGap = 5, ShowHeader = true }; level.GroupBackground = Device.OnPlatform(iOS: Color.White, Android: Color.White, WinPhone: Color.Black); tree.Levels.Add (level); tree.DataSource = new PopulationViewModel ().PopulationDetails; if (Device.Idiom == TargetIdiom.Phone && Device.OS == TargetPlatform.Windows) { tree.LegendSettings = new LegendSettings() { Size = new Size(0, 0),ShowLegend = false }; } else { tree.LegendSettings = new LegendSettings() { LabelStyle = new Syncfusion.SfTreeMap.XForms.Style() { Font = Device.OnPlatform(iOS: Font.SystemFontOfSize(12), Android: Font.SystemFontOfSize(14), WinPhone: Font.SystemFontOfSize(12)), Color = Color.Gray }, IconSize = iconSize, ShowLegend = true, Size = legendSize }; if (Device.Idiom == TargetIdiom.Tablet) { tree.LegendSettings.Size = new Size(500, 30); } } uniMapping = new UniColorMapping (){ Color = Color.FromHex ("#D21243") }; paletteMapping = new PaletteColorMapping (); paletteMapping.Colors.Add (Color.FromHex ("#BD8EC2")); paletteMapping.Colors.Add (Color.FromHex ("#FFD34E")); paletteMapping.Colors.Add (Color.FromHex ("#55B949")); paletteMapping.Colors.Add (Color.FromHex ("#00B2DA")); paletteMapping.Colors.Add (Color.FromHex ("#744A94")); paletteMapping.Colors.Add (Color.FromHex ("#A1A616")); paletteMapping.Colors.Add (Color.FromHex ("#0753A1")); DrawOptionsPage (); this.PropertyView = GetOptionPage (); this.ContentView = tree; this.ContentView.BackgroundColor = Color.White; }