void picker2_SelectedIndexChanged(object sender, EventArgs e) { switch (picker2.SelectedIndex) { case 0: { treeMapColorMapping = rangeMapping; break; } case 1: { treeMapColorMapping = desaturationMapping; break; } case 2: { treeMapColorMapping = uniMapping; break; } case 3: { treeMapColorMapping = paletteMapping; break; } } ApplyChanges(); }
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 GettingStarted() { baritem = new ToolbarItem(); tree = new SfTreeMap(); Title = "GettingStarted"; this.BackgroundColor = Device.OnPlatform(iOS: Color.White, Android: Color.White, WinPhone: Color.White); 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)); 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 }; 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.Gray) }, GroupPath = "Continent", HeaderHeight = 20, GroupGap = 5, ShowHeader = true }; level.GroupBackground = Device.OnPlatform(iOS: Color.White, Android: Color.White, WinPhone: Color.White); tree.Levels.Add(level); tree.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.Text = "Options"; // this.ToolbarItems.Add(baritem); baritem.Clicked += buttonClicked; this.ContentView = tree; this.PropertyView = GetOptionPage(); this.ContentView.BackgroundColor = Color.White; toggleButton.Value = groupPadding; }