public override void LayoutSubviews() { base.LayoutSubviews(); parentView.Frame = new CGRect(0, 0, this.Frame.Width, this.Frame.Height); diagram.BeginNodeRender += Dia_BeginNodeRender; diagram.BeginNodeLayout += Dia_GetLayoutInfo; diagram.ItemLongPressed += Dia_ItemLongPressed; diagram.BackgroundColor = UIColor.White; diagram.EnableSelectors = false; diagram.NodeClicked += Dia_NodeClicked; diagram.Loaded += Dia_Loaded; //Initialize Method datamodel = new DataModel(); datamodel.Data(); //To Represent DataSourceSttings Properties DataSourceSettings settings = new DataSourceSettings(); settings.ParentId = "ReportingPerson"; settings.Id = "Name"; settings.DataSource = datamodel.employee; diagram.DataSourceSettings = settings; //To Represent LayoutManager Properties diagram.LayoutManager = new LayoutManager() { Layout = new DirectedTreeLayout() { Type = LayoutType.Organization, HorizontalSpacing = 35, } }; for (int i = 0; i < diagram.Connectors.Count; i++) { diagram.Connectors[i].TargetDecoratorType = DecoratorType.None; diagram.Connectors[i].Style.StrokeBrush = new SolidBrush(UIColor.FromRGB(127, 132, 133)); diagram.Connectors[i].Style.StrokeWidth = 1; } //Set width and height for diagram diagram.Width = (float)parentView.Frame.Width; diagram.Height = (float)parentView.Frame.Height; parentView.AddSubview(diagram); diagram.LayoutSubviews(); this.AddSubview(parentView); foreach (var view in this.Subviews) { verticalLabel.Frame = new CGRect(this.Frame.X + 10, 0, PopoverSize.Width - 20, 30); verticalbutton.Frame = new CGRect(this.Frame.X + 10, 40, PopoverSize.Width - 20, 30); horizontalbutton.Frame = new CGRect(this.Frame.X + 10, 80, PopoverSize.Width - 20, 30); selectionPicker1.Frame = new CGRect(0, PopoverSize.Height / 2, PopoverSize.Width, PopoverSize.Height / 3); doneButton.Frame = new CGRect(0, PopoverSize.Height / 2.5, PopoverSize.Width, 40); } }
public override View GetSampleContent(Context context) { //Create SfDiagram. diagram = new SfDiagram(context); diagram.EnableSelection = false; FillColor = new Dictionary <string, Color>(); FillColor.Add("Managing Director", Color.Rgb(239, 75, 93)); FillColor.Add("Project Manager", Color.Rgb(49, 162, 255)); FillColor.Add("Senior Manager", Color.Rgb(49, 162, 255)); FillColor.Add("Project Lead", Color.Rgb(0, 194, 192)); FillColor.Add("Senior S/W Engg", Color.Rgb(0, 194, 192)); FillColor.Add("Software Engg", Color.Rgb(0, 194, 192)); FillColor.Add("Team Lead", Color.Rgb(0, 194, 192)); FillColor.Add("Project Trainee", Color.Rgb(255, 129, 0)); StrokeColor = new Dictionary <string, Color>(); StrokeColor.Add("Managing Director", Color.Rgb(201, 32, 61)); StrokeColor.Add("Project Manager", Color.Rgb(23, 132, 206)); StrokeColor.Add("Senior Manager", Color.Rgb(23, 132, 206)); StrokeColor.Add("Project Lead", Color.Rgb(4, 142, 135)); StrokeColor.Add("Senior S/W Engg", Color.Rgb(4, 142, 135)); StrokeColor.Add("Software Engg", Color.Rgb(4, 142, 135)); StrokeColor.Add("Team Lead", Color.Rgb(4, 142, 135)); StrokeColor.Add("Project Trainee", Color.Rgb(206, 98, 9)); dataModel = new DataModel(); diagram.BackgroundColor = Color.White; diagram.BeginNodeRender += Dia_BeginNodeRender; diagram.BeginNodeLayout += Dia_GetLayoutInfo; dataModel.Data(); //To Represent DataSourceSttings Properties DataSourceSettings settings = new DataSourceSettings(); settings.ParentId = "ReportingPerson"; settings.Id = "Name"; settings.DataSource = dataModel.employee; diagram.DataSourceSettings = settings; //To Represent LayoutManager Properties diagram.LayoutManager = new LayoutManager() { Layout = new DirectedTreeLayout() { Type = LayoutType.Organization, HorizontalSpacing = 70 * MainActivity.factor, VerticalSpacing = 70 * MainActivity.factor } }; for (int i = 0; i < diagram.Connectors.Count; i++) { diagram.Connectors[i].TargetDecoratorType = DecoratorType.None; diagram.Connectors[i].Style.StrokeBrush = new SolidBrush(Color.Rgb(127, 132, 133)); } diagram.NodeClicked += Diagram_NodeClicked; diagram.ItemLongPressed += Diagram_ItemLongPressed; diagram.Loaded += Diagram_Loaded; return(diagram); }
public override View GetSampleContent(Context context) { Display display = ((Activity)context).WindowManager.DefaultDisplay; DisplayMetrics displayMetrics = new DisplayMetrics(); display.GetMetrics(displayMetrics); var wInches = displayMetrics.WidthPixels / (double)displayMetrics.DensityDpi; var hInches = displayMetrics.HeightPixels / (double)displayMetrics.DensityDpi; double screenDiagonal = Math.Sqrt(Math.Pow(wInches, 2) + Math.Pow(hInches, 2)); isTablet = screenDiagonal >= 7.0; //Create SfDiagram. diagram = new SfDiagram(context); diagram.EnableSelection = false; FillColor = new Dictionary <string, Color>(); FillColor.Add("Managing Director", Color.Rgb(239, 75, 93)); FillColor.Add("Project Manager", Color.Rgb(49, 162, 255)); FillColor.Add("Senior Manager", Color.Rgb(49, 162, 255)); FillColor.Add("Project Lead", Color.Rgb(0, 194, 192)); FillColor.Add("Senior S/W Engg", Color.Rgb(0, 194, 192)); FillColor.Add("Software Engg", Color.Rgb(0, 194, 192)); FillColor.Add("Team Lead", Color.Rgb(0, 194, 192)); FillColor.Add("Project Trainee", Color.Rgb(255, 129, 0)); StrokeColor = new Dictionary <string, Color>(); StrokeColor.Add("Managing Director", Color.Rgb(201, 32, 61)); StrokeColor.Add("Project Manager", Color.Rgb(23, 132, 206)); StrokeColor.Add("Senior Manager", Color.Rgb(23, 132, 206)); StrokeColor.Add("Project Lead", Color.Rgb(4, 142, 135)); StrokeColor.Add("Senior S/W Engg", Color.Rgb(4, 142, 135)); StrokeColor.Add("Software Engg", Color.Rgb(4, 142, 135)); StrokeColor.Add("Team Lead", Color.Rgb(4, 142, 135)); StrokeColor.Add("Project Trainee", Color.Rgb(206, 98, 9)); dataModel = new DataModel(); diagram.BackgroundColor = Color.White; diagram.BeginNodeRender += Dia_BeginNodeRender; dataModel.Data(); //To Represent DataSourceSttings Properties DataSourceSettings settings = new DataSourceSettings(); settings.ParentId = "ReportingPerson"; settings.Id = "Name"; settings.DataSource = dataModel.employee; diagram.DataSourceSettings = settings; //(diagram.LayoutManager.Layout as DirectedTreeLayout).IsDraggable //To Represent LayoutManager Properties diagram.LayoutManager = new LayoutManager() { Layout = new DirectedTreeLayout() { Type = LayoutType.Organization, HorizontalSpacing = 70 * MainActivity.Factor, VerticalSpacing = 70 * MainActivity.Factor } }; for (int i = 0; i < diagram.Connectors.Count; i++) { diagram.Connectors[i].TargetDecoratorType = DecoratorType.None; diagram.Connectors[i].Style.StrokeBrush = new SolidBrush(Color.Rgb(127, 132, 133)); } diagram.NodeClicked += Diagram_NodeClicked; diagram.ItemLongPressed += Diagram_ItemLongPressed; diagram.Loaded += Diagram_Loaded; int width = (int)(context.Resources.DisplayMetrics.WidthPixels - context.Resources.DisplayMetrics.Density) / 3; linearLayout4 = new LinearLayout(context); linearLayout4.Orientation = Android.Widget.Orientation.Vertical; linearLayout4.SetMinimumHeight((int)(190 * currentDensity)); linearLayout4.SetMinimumWidth(width); diagram.LayoutNodeDropped += Diagram_OnLayoutNodeDropped; return(diagram); }
public OrganizationalChart() { selectionPicker1 = new UIPickerView(); this.OptionView = new UIView(); string deviceType = UIDevice.CurrentDevice.Model; overviewLabel = new UILabel(); overviewLabel.Text = "Enable Overview"; overviewLabel.TextColor = UIColor.Black; overviewLabel.TextAlignment = UITextAlignment.Left; overviewLabel.BackgroundColor = UIColor.Clear; overviewLabel.Frame = new CGRect(this.Frame.X + 10, 70, 150, 30); overviewSwitch = new UISwitch(); overviewSwitch.On = true; overviewSwitch.Frame = new CGRect(this.Frame.X + 250, 70, 50, 30); overviewSwitch.TouchUpInside += OverviewSwitch_TouchUpInside; overviewSwitch.BackgroundColor = UIColor.Clear; dragLabel = new UILabel(); dragLabel.Text = "Change Hierarchy"; dragLabel.TextColor = UIColor.Black; dragLabel.TextAlignment = UITextAlignment.Left; dragLabel.BackgroundColor = UIColor.Clear; dragLabel.Frame = new CGRect(this.Frame.X + 10, 10, 150, 30); dragSwitch = new UISwitch(); dragSwitch.On = false; dragSwitch.Frame = new CGRect(this.Frame.X + 250, 10, 50, 30); dragSwitch.TouchUpInside += dragSwitch_TouchUpInside; dragSwitch.BackgroundColor = UIColor.Clear; diagram = new SfDiagram(); //Dictionary collection FillColor = new Dictionary <string, UIColor>(); FillColor.Add("Managing Director", UIColor.FromRGB(239, 75, 93)); FillColor.Add("Project Manager", UIColor.FromRGB(49, 162, 255)); FillColor.Add("Senior Manager", UIColor.FromRGB(49, 162, 255)); FillColor.Add("Project Lead", UIColor.FromRGB(0, 194, 192)); FillColor.Add("Senior S/W Engg", UIColor.FromRGB(0, 194, 192)); FillColor.Add("Software Engg", UIColor.FromRGB(0, 194, 192)); FillColor.Add("Team Lead", UIColor.FromRGB(0, 194, 192)); FillColor.Add("Project Trainee", UIColor.FromRGB(255, 129, 0)); StrokeColor = new Dictionary <string, CGColor>(); StrokeColor.Add("Managing Director", UIColor.FromRGB(201, 32, 61).CGColor); StrokeColor.Add("Project Manager", UIColor.FromRGB(23, 132, 206).CGColor); StrokeColor.Add("Senior Manager", UIColor.FromRGB(23, 132, 206).CGColor); StrokeColor.Add("Project Lead", UIColor.FromRGB(4, 142, 135).CGColor); StrokeColor.Add("Senior S/W Engg", UIColor.FromRGB(4, 142, 135).CGColor); StrokeColor.Add("Software Engg", UIColor.FromRGB(4, 142, 135).CGColor); StrokeColor.Add("Team Lead", UIColor.FromRGB(4, 142, 135).CGColor); StrokeColor.Add("Project Trainee", UIColor.FromRGB(206, 98, 9).CGColor); diagram.BeginNodeRender += Dia_BeginNodeRender; diagram.ItemLongPressed += Dia_ItemLongPressed; diagram.LayoutNodeDropped += Diagram_OnLayoutNodeDropped; diagram.BackgroundColor = UIColor.White; diagram.EnableSelectors = false; diagram.NodeClicked += Dia_NodeClicked; diagram.Loaded += Dia_Loaded; //Initialize Method datamodel = new DataModel(); datamodel.Data(); //To Represent DataSourceSttings Properties DataSourceSettings settings = new DataSourceSettings(); settings.ParentId = "ReportingPerson"; settings.Id = "Name"; settings.DataSource = datamodel.employee; diagram.DataSourceSettings = settings; //To Represent LayoutManager Properties diagram.LayoutManager = new LayoutManager() { Layout = new DirectedTreeLayout() { Type = LayoutType.Organization, HorizontalSpacing = 35, } }; for (int i = 0; i < diagram.Connectors.Count; i++) { diagram.Connectors[i].TargetDecoratorType = DecoratorType.None; diagram.Connectors[i].Style.StrokeBrush = new SolidBrush(UIColor.FromRGB(127, 132, 133)); diagram.Connectors[i].Style.StrokeWidth = 1; } this.AddSubview(diagram); diagram.Width = (float)this.Frame.Width; diagram.Height = (float)this.Frame.Height; OptionView.AddSubview(dragLabel); OptionView.AddSubview(dragSwitch); if (deviceType == "iPad") { OptionView.AddSubview(overviewLabel); OptionView.AddSubview(overviewSwitch); overviewPanel = new OverviewPanel(); overviewPanel.Layer.BorderColor = UIColor.Orange.CGColor; overviewPanel.Layer.BorderWidth = 2; overviewPanel.Frame = new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width / 2, UIScreen.MainScreen.Bounds.Height / 4); diagram.AddSubview(overviewPanel); diagram.OverviewPanel = overviewPanel; } }