ComponentOne 3D Chart for WinForms
3D Axes / Axes Annotation / Distinct Methods to Label Axes
In This Topic
    Distinct Methods to Label Axes
    In This Topic

    There are three distinct ways to label axes when using the 3D Chart control:

    The axis labeling method in use for a particular axis is specified by the AnnoMethod property. The C1Chart3D.AnnotationMethodEnum specifies valid values for this property.

    If the AnnoMethod property is set to AnnotationMethodEnum.Values, C1Chart3D will automatically annotate the axis based on the range of the data. This is most suitable for the Z-axis, and for surface charts.

    If the AnnoMethod property is set to AnnotationMethodEnum.DataLabels, C1Chart3D uses a list of strings to annotate each grid line or bar. This labeling method can only be used on the X and Y-axes. For the X-axis, the labels are supplied by setting the RowLabels property of the Chart3DGroups object for the chart. For example, the following code specifies three data labels for each of the three rows of a chart:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    With C1Chart3D1
      'assume three rows in chart
      .ChartArea.Axes("X").AnnoMethod = AnnotationMethodEnum.DataLabels
      With .ChartGroups.RowLabels
        .Add(0, "Row 1")
        .Add(1, "Row 2")
        .Add(2, "Row 3")
      End With
    End With
    

    To write code in C#

    C#
    Copy Code
    C1.Win.C1Chart3D.ChartGroups cgs = C1Chart3D1.ChartGroups;
                                            
    //assume three rows in chart
    C1Chart3D1.ChartArea.Axes["X"].AnnoMethod = AnnotationMethodEnum.DataLabels;
    cgs.Add(0, "Row 1");
    cgs.Add(1, "Row 2");
    cgs.Add(2, "Row 3");
    

    Similarly, labels for the Y-axis are supplied by setting the ColumnLabels property of the Chart3DGroups object.

    If the AnnoMethod property is set to AnnotationMethodEnum.ValueLabels, C1Chart3D 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:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    With C1Chart3D1.ChartArea.Axes("X")
      .AnnoMethod = AnnotationMethodEnum.ValueLabels
      With .ValueLabels
        .Add(10#, "Label 1")
        .Add(20#, "Label 2")
        .Add(30#, "Label 3")
      End With
    End With
    

    To write code in C#

    C#
    Copy Code
    C1.Win.C1Chart3D.Chart3DAxis axis = C1Chart3D1.ChartArea.Axes["X"];
    C1.Win.C1Chart3D.Chart3DAxisLabelsCollection valueLabels = axis.ValueLabels;
    axis.AnnoMethod = AnnotationMethodEnum.ValueLabels;
    valueLabels.Add(10#, "Label 1");
    valueLabels.Add(20#, "Label 2");
    valueLabels.Add(30#, "Label 3");
    
    See Also