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(); 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 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); }