Group: Forum Members
Last Active: 9 Years Ago
Posts: 8,
Visits: 19
|
I use Tree Importer to draw diagram from database and then I use a NTextShape for writing header title in my document. But the diagram covers my TextShape because it's in front of it. How can I move down my Tree so I can see the title into TextShape?
|
Group: Forum Members
Last Active: Last Week
Posts: 3,054,
Visits: 4,009
|
Hi, Create and insert the text shape first and then import the diagram from the database. If the shapes still overlap then you can use one of the tree layouts to layout them, for example: NLayeredTreeLayout layout = new NLayeredTreeLayout(); layout.VertexSpacing = 50; layout.LayerSpacing = 50; layout.Layout(document.ActiveLayer.Children(null), new NDrawingLayoutContext(document));
Best Regards, Nevron Support Team
|
Group: Forum Members
Last Active: 9 Years Ago
Posts: 8,
Visits: 19
|
I've tried with NTipOverTreeTayout but i've still the same problem.
Probably there is an error in my code:
Private Sub InitDocument() m_Dict = New Dictionary(Of NTableShape, clsDipendente)()
' change default document styles NDrawingDocument1.Style.TextStyle.TextFormat = TextFormat.XML NDrawingDocument1.Style.StartArrowheadStyle.Shape = ArrowheadShape.None NDrawingDocument1.Style.EndArrowheadStyle.Shape = ArrowheadShape.None
' configure shadow (inherited by all objects) NDrawingDocument1.Style.ShadowStyle = New NShadowStyle(ShadowType.GaussianBlur, Color.FromArgb(150, Color.Black), New NPointL(3, 3), 1, New NLength(4))
NDrawingDocument1.ShadowsZOrder = ShadowsZOrder.BehindDocument NDrawingDocument1.ActiveLayer.Name = "Org"
' Dim text As NTextShape = New NTextShape("Company Structure", New NRectangleF(NDrawingDocument1.Bounds.Width + 5, NDrawingDocument1.Bounds.Y + 5, 200, 50)) Dim text As NTextShape If p_Funzioni Then text = New NTextShape("ORGANIGRAMMA FUNZIONALE REPARTO " & p_Titolo, New NRectangleF(NDrawingDocument1.Width * 2 / 3, 0, NDrawingDocument1.Width / 3, 100)) Else text = New NTextShape("ORGANIGRAMMA REPARTO " & p_Titolo, New NRectangleF(NDrawingDocument1.Width * 2 / 3, 0, NDrawingDocument1.Width / 3, 100))
End If
text.Style.TextStyle = New NTextStyle(New Font("Times New Roman", 20, FontStyle.Bold)) text.Style.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Right
NDrawingDocument1.ActiveLayer.AddChild(text)
Dim treeLayer As New NLayer() treeLayer.Name = "Organigramma"
NDrawingDocument1.Layers.AddChild(treeLayer) NDrawingDocument1.ActiveLayerUniqueId = treeLayer.UniqueId
' ''Dim layout As NLayeredTreeLayout = New NLayeredTreeLayout() ' ''layout.Direction = LayoutDirection.TopToBottom ' ''layout.VertexSpacing = 50 ' ''layout.LayerSpacing = 50
' use tip over tree layout Dim tipOverLayout As NTipOverTreeLayout = New NTipOverTreeLayout() tipOverLayout.ColRightParentPlacement.Offset = 258 tipOverLayout.HorizontalSpacing = 30 tipOverLayout.LeafsPlacement = TipOverChildrenPlacement.ColRight
' create the data importer Dim treeImporter As NTreeDataSourceImporter = New NTreeDataSourceImporter() treeImporter.Layout = tipOverLayout treeImporter.Document = NDrawingDocument1 treeImporter.DataSource = p_Dati treeImporter.Layout = tipOverLayout
' records are uniquely identified by their Id column ' records link to their parent record by their ParentId column treeImporter.IdColumnName = "org_id" treeImporter.ParentIdColumnName = "org_parent_id" treeImporter.CollapsibleSubtrees = True treeImporter.VertexShapesFactory = New NBasicShapesFactory() treeImporter.VertexShapesName = BasicShapes.Table.ToString()
' import the shapes AddHandler treeImporter.VertexImported, AddressOf treeImporter_VertexImported
Dim ok As Boolean = treeImporter.Import()
' resize document to fit all shapes 'NDrawingDocument1.SizeToContent()
End Sub
|
Group: Forum Members
Last Active: Last Week
Posts: 3,054,
Visits: 4,009
|
By default layouts arrange the drawing relatively to the upper-left corner of the drawing.Bounds. That is why the tree/graph data importers arrange the drawing at the 0,0 origin. - provided that you have not modified the drawing.Bounds . The easiest way to place a header on top of your arranged drawing: 1. Import the data first, 2. Add the header text shape on top of the drawing.Bounds rectangle (for example with bounds new NRectangleF(0, -20, 1000, 20)). 3. Call the document.SizeToContent() method.
Best Regards, Nevron Support Team
|