public TreeMapCustomization() { InitializeComponent(); this.TreeMap.DataSource = new OlymicMedalsViewModel().OlympicMedalsDetails; UniColorMapping uniMapping = new UniColorMapping() { Color = Color.FromHex("#D21243") }; }
public Form1() { InitializeComponent(); this.MetroColor = Color.White; this.BackColor = Color.White; #region Sample Header Label sampleHeader = new Label(); sampleHeader.Text = "This sample represents TreeMap showing Olympic Medals won by United States in various events."; sampleHeader.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); sampleHeader.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(150)))), ((int)(((byte)(205))))); sampleHeader.ForeColor = System.Drawing.Color.White; sampleHeader.Size = new System.Drawing.Size(970, (int)DpiAware.LogicalToDeviceUnits(35)); sampleHeader.Margin = new System.Windows.Forms.Padding(0); sampleHeader.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; sampleHeader.Dock = DockStyle.Top; this.Controls.Add(sampleHeader); #endregion #region TreeMap Panel sampleLayoutPanel = new Panel(); sampleLayoutPanel.Dock = DockStyle.Fill; sampleLayoutPanel.Padding = new System.Windows.Forms.Padding(10, (int)DpiAware.LogicalToDeviceUnits(35), 0, 0); OlymicMedalsViewModel olymicMedalsViewModel = new OlymicMedalsViewModel(); TreeMap treeMap = new TreeMap(); treeMap.Dock = DockStyle.Fill; treeMap.Margin = new System.Windows.Forms.Padding(0, 0, 10, 10); treeMap.ItemsSource = olymicMedalsViewModel.OlympicMedalsDetails; treeMap.WeightValuePath = "TotalMedals"; treeMap.ColorValuePath = "GoldMedals"; treeMap.ItemsLayoutMode = ItemsLayoutModes.Squarified; treeMap.LeafItemDrawing += treeMap_LeafItemDrawing; ToolTipInfo itemInfo = new ToolTipInfo(); itemInfo.ToolTipHeaderPattern = "<b>{Country} - {GameName}</b>"; itemInfo.ToolTipContentPattern = "GoldMedals \t {GoldMedals} \nSilverMedals \t {SilverMedals} \nBronzeMedals \t {BronzeMedals}"; treeMap.ItemToolTipInfo = itemInfo; treeMap.LeafItemSettings.LabelPath = "GameName"; #region Range ColorMapping UniColorMapping uniColorMapping = new UniColorMapping(); uniColorMapping.Color = Color.FromArgb(215, 48, 40); treeMap.LeafColorMapping = uniColorMapping; #endregion sampleLayoutPanel.Controls.Add(treeMap); this.Controls.Add(sampleLayoutPanel); #endregion }
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.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; }