method Notes.Add (ID as Variant, Item as Variant, Key as Variant, Text as String)
Adds a new note/box to the control and returns a reference to the newly created object.

 TypeDescription 
   ID as Variant An Unique identifier that specifies the ID of the note being added. Use this identifier to access later the node or the box.  
   Item as Variant A long expression that specifies the handle of the item where the note is assigned. The ItemFromPoint property retrieves the handle of the item from the cursor.   
   Key as Variant A VARIANT expression that specifies the object to relate the note as follows: 
  • Key parameter is of Date type, it indicates the DATE in the chart to associate the note. By default, the RelativePosition property is 0.5, which indicates the center of the unit where the DATE is ( 0, means the start unit, while the 1 is the end of the unit, and so on ). The DateFromPoint property retrieves the date from the point.  By default, If a note is associated to a DATE, the RelativePostion property is 0.5, it displays only the ending part of the note, and the ending part of the note is not movable.
  • Key parameter is not of Date type, it indicates the Key of the BAR to associate the note ( The Item and the Key indicates the bar to associate the note ). By default, the RelativePosition property is 0, which indicates the starting point of the bar  ( 0, means the starting point of the bar, while the 1 is the ending point of the bar, 0.5 indicates the middle of the bar, and so on ). The BarFromPoint property retrieves the key of the bar from the cursor.  By default, If a note is associated to a BAR, the RelativePostion property is 0, it displays only the ending part of the note, and the ending part of the note is not movable. Also, the direction from start to end part is visible. 

By default, the starting part of the note is not visible, so only the ending part of the note is visible.

 
   Text as String A String expression that specifies the HTML text to be displayed on the ending part of the note. The Text parameter supports HTML tags as well as Chart Tags such as <%dd%> that displays the day in 2 digits, and so on like described bellow. Use the Images method to specify a list of icons that can be displayed in the control using the <img> tag. Use the HTMLPicture property to add custom- size pictures to be used in the HTML captions using the <img> tag.  
 ReturnDescription 
  NoteA Note object being created. Use the NoteFromPoint property to access the Note from the cursor. 
The Add method adds a note or a box associated with a DATE or a BAR in the chart. The type of the Key parameter specifies when a DATE or a BAR is being associated with the note. By default, the starting part of the note is not visible, so use the PartVisible property to show or hide any part of the note. The PartCanMove property specifies whether the use can move the part.  The PartText property indicates the HTML text to display in the part. The RelativePosition property always specifies the position of the starting part of the note relative to the DATE or BAR being associated. Use the PartHOffset / PartVOffset property to specify the horizontal / vertical offset relative to the start or end part. Use the exBarCaption property to specify the caption for a bar. Use the exBarExtraCaption property to assign more extra captions to a bar.

The Text parameter / PartText property supports the following:

The following tags are displayed based on the user's Regional and Language Options:

The Text parameter / PartText property supports the following built-in HTML tags:

Also, newer HTML format supports decorative text like follows:

The following VB sample adds a note associated with the DATE from the cursor, when the user double clicks the chart area:

Private Sub G2antt1_DblClick(Shift As Integer, X As Single, Y As Single)
    With G2antt1
        .BeginUpdate
        Dim h As Long, c As Long, hit As HitTestInfoEnum
        h = G2antt1.ItemFromPoint(-1, -1, c, hit)
        If (h <> 0) Then
            Dim d As Date
            d = .Chart.DateFromPoint(-1, -1)
            If (d <> 0) Then
                .Chart.Notes.Add d, h, d, "<b><%dd%></b>/<%mm%>/<%yyyy%>"
            End If
        End If
        .EndUpdate
    End With
End Sub

The following VB sample adds a note associated with the BAR from the cursor, when the user double clicks the chart area:

Private Sub G2antt1_DblClick(Shift As Integer, X As Single, Y As Single)
    With G2antt1
        .BeginUpdate
        Dim h As Long, c As Long, hit As HitTestInfoEnum
        h = G2antt1.ItemFromPoint(-1, -1, c, hit)
        If (h <> 0) Then
            Dim k As Variant
            k = .Chart.BarFromPoint(-1, -1)
            If (Not IsEmpty(k)) Then
                .Chart.Notes.Add k, h, k, "start"
            End If
        End If
        .EndUpdate
    End With
End Sub

 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.