ComponentOne Chart 8.0 for ActiveX
Axis Labeling Programming Considerations

 

Axis Labeling Programming Considerations

If the AnnotationMethod property is set to oc2dAnnotateValueLabels, the chart places labels at explicit locations along an axis. The ValueLabels property, which is a ValueLabels collection, supplies this list of strings and their locations. For example, the following code sets chart labels at the locations 10, 20 and 30:

With Chart2D1.ChartArea.Axes("X")

       .AnnotationMethod = oc2dAnnotateValueLabels

       With .ValueLabels

              .Add 10#, "Label 1"

              .Add 20#, "Label 2"

              .Add 30#, "Label 3"

       End With

End With

The ValueLabels collection can be indexed either by subscript or by value:

' this retrieves the label for the second Value-label

Value = Chart2D1.ChartArea.Axes("X").ValueLabels(2).Value;

' this retrieves the label at chart coordinate 2.0

Value = Chart2D1.ChartArea.Axes("X").ValueLabels(2.0).Value;

If the AnnotationMethod property is set to oc2dAnnotatePointLabels, the chart evenly spaces the points across the axis, and annotates them with a list of strings. This labeling method can only be used on the X-axis. The labels are supplied by setting the PointLabels property of the ChartGroupobject for this chart. For example, the following code specifies labels for each of the three points on the X-axis:

With Chart2D1

' assume three points on X-axis

.ChartArea.Axes("X").AnnotationMethod = oc2dAnnotatePointLabels

       With ChartGroups(1).PointLabels

       .Add "Point 1"

              .Add "Point 2"

              .Add "Point 3"

End With

End With

If the AnnotationMethod property is set to oc2dAnnotateTimeLabels, the chart treats the axis as a Time-axis. This labeling method can only be used on the X-axis. To define the values to appear on a Time-axis, access the TimeScale property, which is a TimeScaleobject, and set its properties as follows:

·      Set the Base property to the starting date and/or time.

·      Set the Unit property to the time unit to be used. This property must be set to a TimeUnit constant.

·      Set the Format property to the format string to use when generating the time labels. See Annotating With TimeLabels for details on the contents of this format string.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback