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 Android.Views.View GetSampleContent(Android.Content.Context context) { handler = new Handler(); LinearLayout layout = new LinearLayout(context); layout.Orientation = Orientation.Vertical; TextView textView = new TextView(context); textView.TextSize = 16; textView.SetPadding(10, 20, 0, 0); textView.SetHeight(90); textView.Text = "Top 40 countries population"; layout.AddView(textView); textView.Gravity = Android.Views.GravityFlags.Top; maps = new SfMaps(context); ShapeFileLayer layer = new ShapeFileLayer(); layer.ShowItems = true; layer.Uri = "world1.shp"; layer.DataSource = GetDataSource(); layer.ShapeIdPath = "Country"; layer.ShowItems = true; layer.ShapeIdTableField = "NAME"; layer.ShapeSettings = new ShapeSetting(); layer.ShapeSettings.ShapeFill = Color.LightGray; BubbleMarkerSetting marker = new BubbleMarkerSetting(); marker.ValuePath = "Population"; marker.ColorValuePath = "Population"; BubbleCustomTooltipSetting tooltipSetting = new BubbleCustomTooltipSetting(context); tooltipSetting.ShowTooltip = true; tooltipSetting.ValuePath = "Country"; marker.TooltipSettings = tooltipSetting; RangeColorMapping rangeColorMapping = new RangeColorMapping(); rangeColorMapping.Color = Color.ParseColor("#2E769F"); rangeColorMapping.To = 1400000000; rangeColorMapping.From = 325000000; rangeColorMapping.LegendLabel = "Above 4%"; marker.ColorMapping.Add(rangeColorMapping); RangeColorMapping rangeColorMapping1 = new RangeColorMapping(); rangeColorMapping1.Color = Color.ParseColor("#D84444"); rangeColorMapping1.To = 325000000; rangeColorMapping1.From = 180000000; rangeColorMapping1.LegendLabel = "4% - 2%"; marker.ColorMapping.Add(rangeColorMapping1); RangeColorMapping rangeColorMapping2 = new RangeColorMapping(); rangeColorMapping2.Color = Color.ParseColor("#816F28"); rangeColorMapping2.To = 180000000; rangeColorMapping2.From = 100000000; rangeColorMapping2.LegendLabel = "2% - 1%"; marker.ColorMapping.Add(rangeColorMapping2); RangeColorMapping rangeColorMapping3 = new RangeColorMapping(); rangeColorMapping3.Color = Color.ParseColor("#7F38A0"); rangeColorMapping3.To = 100000000; rangeColorMapping3.From = 5000000; rangeColorMapping3.LegendLabel = "Below 1%"; marker.ColorMapping.Add(rangeColorMapping3); layer.BubbleMarkerSetting = marker; LegendSetting legendSetting = new LegendSetting(); legendSetting.ShowLegend = true; legendSetting.LegendType = LegendType.Bubbles; legendSetting.IconHeight = 15; legendSetting.IconWidth = 15; legendSetting.LegendPosition = new Point(50, 5); legendSetting.HorizontalAlignment = HorizontalAlignment.Center; layer.LegendSetting = legendSetting; maps.Layers.Add(layer); SfBusyIndicator sfBusyIndicator = new SfBusyIndicator(context); sfBusyIndicator.IsBusy = true; sfBusyIndicator.AnimationType = AnimationTypes.SlicedCircle; sfBusyIndicator.ViewBoxWidth = 50; sfBusyIndicator.ViewBoxHeight = 50; sfBusyIndicator.TextColor = Color.ParseColor("#779772"); layout.AddView(sfBusyIndicator); Java.Lang.Runnable run = new Java.Lang.Runnable(() => { layout.RemoveView(sfBusyIndicator); layout.AddView(maps); }); handler.PostDelayed(run, 100); 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; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SfTreeMap treeMap = new SfTreeMap(this); treeMap.ColorValuePath = "Growth"; treeMap.WeightValuePath = "Population"; treeMap.LayoutType = Com.Syncfusion.Treemap.Enums.LayoutType.Squarified; treeMap.ShowTooltip = true; LeafItemSetting leafItemSetting = new LeafItemSetting(); leafItemSetting.ShowLabels = true; leafItemSetting.Gap = 2; leafItemSetting.LabelPath = "Country"; treeMap.LeafItemSettings = leafItemSetting; TreeMapFlatLevel flatLevel = new TreeMapFlatLevel(); flatLevel.HeaderHeight = 20; flatLevel.GroupPath = "Continent"; flatLevel.GroupGap = 5; flatLevel.ShowHeader = true; flatLevel.GroupStrokeColor = Color.Gray; flatLevel.GroupStrokeWidth = 1; flatLevel.HeaderStyle = new Style() { TextColor = Color.Black }; treeMap.Levels.Add(flatLevel); LegendSetting legendSettings = new LegendSetting(); legendSettings.ShowLegend = true; legendSettings.LegendSize = new Size(700, 45); legendSettings.LabelStyle = new Style() { TextColor = Color.Black }; treeMap.LegendSettings = legendSettings; RangeColorMapping rangeColorMapping = new RangeColorMapping(); Range range1 = new Range(); range1.From = 0; range1.To = 1; range1.Color = Color.ParseColor("#77D8D8"); range1.LegendLabel = "1 % Growth"; Range range2 = new Range(); range2.From = 0; range2.To = 2; range2.Color = Color.ParseColor("#AED960"); range2.LegendLabel = "2 % Growth"; Range range3 = new Range(); range3.From = 0; range3.To = 3; range3.Color = Color.ParseColor("#FFAF51"); range3.LegendLabel = "3 % Growth"; Range range4 = new Range(); range4.From = 0; range4.To = 4; range4.Color = Color.ParseColor("#F3D240"); range4.LegendLabel = "4 % Growth"; rangeColorMapping.Ranges.Add(range1); rangeColorMapping.Ranges.Add(range2); rangeColorMapping.Ranges.Add(range3); rangeColorMapping.Ranges.Add(range4); treeMap.LeafItemColorMapping = rangeColorMapping; treeMap.DataSource = GetDataSource(); SetContentView(treeMap); }
public override Android.Views.View GetSampleContent(Android.Content.Context context) { handler = new Handler(); frameLayout = new FrameLayout(context); frameLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); LinearLayout linearLayout = new LinearLayout(context); linearLayout.Orientation = Orientation.Vertical; linearLayout.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent); sampleContext = context; LinearLayout layout = new LinearLayout(context); layout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); layout.Orientation = Orientation.Horizontal; layout.SetHorizontalGravity(GravityFlags.Center); TextView textView = new TextView(context); textView.TextSize = 16; textView.SetPadding(2, 2, 2, 2); textView.SetHeight(90); textView.Gravity = Android.Views.GravityFlags.Top; textView.Text = "Top 40 countries population"; layout.AddView(textView); frameLayout.AddView(layout); maps = new SfMaps(context); maps.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent); ShapeFileLayer layer = new ShapeFileLayer(); layer.ShowItems = true; layer.Uri = "world1.shp"; layer.DataSource = GetDataSource(); layer.ShapeIdPath = "Country"; layer.ShowItems = true; layer.ShapeIdTableField = "NAME"; layer.ShapeSettings = new ShapeSetting(); layer.ShapeSettings.ShapeFill = Color.LightGray; BubbleMarkerSetting marker = new BubbleMarkerSetting(); marker.ValuePath = "Percent"; marker.ColorValuePath = "Percent"; RangeColorMapping rangeColorMapping = new RangeColorMapping(); rangeColorMapping.Color = Color.ParseColor("#2E769F"); rangeColorMapping.From = 4; rangeColorMapping.To = 20; rangeColorMapping.LegendLabel = "Above 4%"; marker.ColorMapping.Add(rangeColorMapping); RangeColorMapping rangeColorMapping1 = new RangeColorMapping(); rangeColorMapping1.Color = Color.ParseColor("#D84444"); rangeColorMapping1.From = 2; rangeColorMapping1.To = 4; rangeColorMapping1.LegendLabel = "4% - 2%"; marker.ColorMapping.Add(rangeColorMapping1); RangeColorMapping rangeColorMapping2 = new RangeColorMapping(); rangeColorMapping2.Color = Color.ParseColor("#816F28"); rangeColorMapping2.From = 1; rangeColorMapping2.To = 2; rangeColorMapping2.LegendLabel = "2% - 1%"; marker.ColorMapping.Add(rangeColorMapping2); RangeColorMapping rangeColorMapping3 = new RangeColorMapping(); rangeColorMapping3.Color = Color.ParseColor("#7F38A0"); rangeColorMapping3.From = 0; rangeColorMapping3.To = 1; rangeColorMapping3.LegendLabel = "Below 1%"; marker.ColorMapping.Add(rangeColorMapping3); layer.BubbleMarkerSetting = marker; LegendSetting legendSetting = new LegendSetting(); legendSetting.ShowLegend = true; legendSetting.LegendType = LegendType.Bubbles; legendSetting.LegendPosition = new Point(50, 10); legendSetting.ItemMargin = 15; layer.LegendSetting = legendSetting; maps.Layers.Add(layer); frameLayout.AddView(maps); frameLayout.SetClipChildren(false); LinearLayout linear = new LinearLayout(context); linear.Orientation = Orientation.Horizontal; linear.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); linear.SetHorizontalGravity(GravityFlags.End); linear.SetVerticalGravity(GravityFlags.Bottom); TextView textView1 = new TextView(context); textView1.Text = "Source:"; textView1.SetBackgroundColor(Color.White); textView1.SetTextColor(Color.Black); textView1.SetPadding(2, 2, 2, 2); linear.AddView(textView1); TextView textView2 = new TextView(context); textView2.Text = "en.wikipedia.org"; textView2.SetTextColor(Color.DeepSkyBlue); textView2.SetPadding(0, 2, 3, 2); textView2.SetBackgroundColor(Color.White); textView2.Clickable = true; textView2.Click += TextView2_Click; linear.AddView(textView2); frameLayout.AddView(linear); SfBusyIndicator sfBusyIndicator = new SfBusyIndicator(context); sfBusyIndicator.IsBusy = true; sfBusyIndicator.AnimationType = AnimationTypes.SlicedCircle; sfBusyIndicator.ViewBoxWidth = 50; sfBusyIndicator.ViewBoxHeight = 50; sfBusyIndicator.TextColor = Color.ParseColor("#779772"); linearLayout.AddView(sfBusyIndicator); Java.Lang.Runnable run = new Java.Lang.Runnable(() => { linearLayout.RemoveView(sfBusyIndicator); linearLayout.AddView(frameLayout); }); handler.PostDelayed(run, 100); return(linearLayout); }
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; }