Type | Description | |||
Caption as String | A string expression that identifies the node's caption. The Caption supports built-in HTML tags. | |||
Parent as Variant | A string expression that specifies the key of the parent node, a long expression that indicates the index of the parent node, a Node object that specifies the parent node | |||
Key as Variant | A string expression that defines the key of the node. | |||
Image as Variant | A long expression that indicates the index of the icon being assigned to the node. | |||
Picture as Variant | A string expression that indicates the path to the picture file being loaded by the node, a IPictureDisp object that specifies the picture of the node |
Return | Description | |||
Node | A Node object being created. |
Use the Add method to add new nodes to the chart. Use the Remove method to remove a specific node. Use the Item property to find a node in the Nodes collection. By default, the Nodes collection includes the Root object. Use the BeginUpdate and EndUpdate methods to maintain performance while adding new nodes. Use the AddAssistant method to add an assistant node. An assistant node is displayed between child node and its parent. The Node being returned by the Add method has the IsAssistant property on False. Use the Image property to assign an icon to a node. Use the Picture property to assign a custom size picture to a node. Use the UserData property to associate an extra data to a node. Use the LoadXML/SaveXML methods to load/save the control's data from/to XML documents. Use the LinkCaption property to specify a caption on the line that links the parent with the current node.
The Caption parameter supports the following built-in HTML tags:
The control supports expandable HTML captions feature which allows you to expand(show)/collapse(hide) different information using <a ;exp=> or <a ;e64=> anchor tags. The exp/e64 field of the anchor stores the HTML line/lines to show once the user clicks/collapses/expands the caption.
Any ex-HTML caption can be transformed to an expandable-caption, by inserting the anchor ex-HTML tag. For instance, <solidline><b>Header</b></solidline><br>Line1<r><a ;exp=show lines>+</a><br>Line2<br>Line3 shows the Header in underlined and bold on the first line and Line1, Line2, Line3 on the rest. The show lines is shown instead of Line1, Line2, Line3 once the user clicks the + sign.
or <font ;31><sha 404040;5;0><fgcolor=FFFFFF>outline anti-aliasing</fgcolor></sha></font> gets:
Using ADO, you can load a hierarchical table, if you have a table that contains a field that identifies the key of the record ( "EmployeeID" ), and a field that holds the key to the parent record ( "ReportsTo" ), like in the following VB sample:
Option Explicit Private Sub Form_Load() On Error GoTo error Dim i As Long Dim rs As Object, t As IPictureDisp Set rs = CreateObject("ADODB.Recordset") rs.Open "Select * From Employees", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\sample.mdb", 3 With ChartView1 .BeginUpdate While Not rs.EOF() With .Nodes With .Add(getInfo(rs), rs("ReportsTo").Value, rs("EmployeeID").Value) .ToolTip = rs("Notes") + "<br><upline><dotline><r><b>" + rs("FirstName") + " " + rs("LastName") + "<b>" End With End With rs.MoveNext Wend .EndUpdate End With Exit Sub error: Label1 = "The ""ADODB.Recordset"" object is missing. Please make sure that you have installed properly the ADO files." End Sub Private Function getInfo(ByVal r As Object) As String getInfo = r("TitleOfCourtesy") + " <b><fgcolor=000080>" + r("FirstName") + " " + r("LastName") + "</fgcolor></b><br>" + _ r("Title") + "<br><upline><dotline>" + _ r("City") + "<br> " + r("Address") End Function Private Sub Form_Resize() On Error Resume Next With ChartView1 .Width = Me.ScaleWidth - 2 * .Left .Height = Me.ScaleHeight - (Label1.Height + 3 * Label1.Top) End With End Sub
The following VB sample adds two nodes to the Nodes collection:
With ChartView1 .BeginUpdate .BackColor = vbWhite With .Nodes With .Add("<r><dotline><b><fgcolor=0000FF>Andrew Fuller</fgcolor></b><br><solidline><b>Title</b>:<r><fgcolor=FF0000>Vice President Sales</fgcolor><br>USA, Tacoma, WA, 98401, 908 W. Capital Way<br><dotline><upline><b>Phone:</b><r>(206) 555-9482", , "andrewKey", 1, "c:\temp\sample\andrew.gif") .Position = 0 .BackColor = vbWhite .ToolTip = "<dotline><r><b><fgcolor=0000FF>Andrew Fuller</fgcolor></b><br>Andrew received his BTS commercial in 1974 and a Ph.D. in international marketing from the University of Dallas in 1981. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager." .ToolTipTitle = "Information" End With With .Add("<r><dotline><b><fgcolor=0000FF>Steven Buchanan</fgcolor></b><br><solidline><b>Title</b>:<r>Sales Manager<br>UK, London, SW1 8JR, 14 Garrett Hill<br><dotline><upline><b>Phone:</b><r>(71) 555-4848<br><dotline><upline>Hire Date:<r>17-Oct-1993", "andrewKey", "stevenKey", , "c:\temp\sample\steven.gif") End With End With .EndUpdate End With
The following VB sample adds few nodes to the control like shown above:
With ChartView1 .BeginUpdate With .Nodes .Add "Item 1", "root", "Key1" .Add "Item 2", "root" .Add "Sub Item 1", "Key1" .Add "Sub Item 2", "Key1" End With .EndUpdate End With
The following C++ sample adds few nodes to the control like shown above:
#include "nodes.h" COleVariant vtMissing; V_VT( &vtMissing ) = VT_ERROR; m_chartview.BeginUpdate(); CNodes nodes = m_chartview.GetNodes(); nodes.Add( "Item 1", COleVariant( "root" ), COleVariant("Key1"), vtMissing, vtMissing ); nodes.Add( "Item 2", COleVariant( "root" ), vtMissing, vtMissing, vtMissing ); nodes.Add( "Sub Item 1", COleVariant( "Key1" ), vtMissing, vtMissing, vtMissing ); nodes.Add( "Sub Item 2", COleVariant( "Key1" ), vtMissing, vtMissing, vtMissing ); m_chartview.EndUpdate();
The following VB.NET sample adds few nodes to the control like shown above:
With AxChartView1 .BeginUpdate() With .Nodes .Add("Item 1", "root", "Key1") .Add("Item 2", "root") .Add("Sub Item 1", "Key1") .Add("Sub Item 2", "Key1") End With .EndUpdate() End With
The following C# sample adds few nodes to the control like shown above:
axChartView1.BeginUpdate(); EXORGCHARTLib.Nodes nodes = axChartView1.Nodes; nodes.Add("Item 1", "root", "Key1", null, null); nodes.Add("Item 2", "root", null, null, null); nodes.Add("Sub Item 1", "Key1", null, null, null); nodes.Add("Sub Item 2", "Key1", null, null, null); axChartView1.EndUpdate();
The following VFP sample adds few nodes to the control like shown above:
With thisform.ChartView1 .BeginUpdate With .Nodes .Add("Item 1", "root", "Key1") .Add("Item 2", "root") .Add("Sub Item 1", "Key1") .Add("Sub Item 2", "Key1") EndWith .EndUpdate EndWith