Chart for .NET / User's Guide / Panels / Labels

In This Topic
    Labels
    In This Topic

    Labels are represented by the NLabel and are used to display text in the control canvas.

     Label position

    The NLabel derives indirectly from the NDockPanel class meaning that you can position it at an arbitrary position in the control canvas or dock it to the parent panel. The following code creates a new label at the top left corner of the control:

    C#
    Copy Code
    NLabel label = new NLabel();
    
    label.Text = "Hello world";
    label.Location = new NPointL(0, 0);
    label.ContentAlignment = ContentAlignment.BottomRight;
    label.TextStyle.FontStyle.EmSize = new NLength(22, NGraphicsUnit.Point);
    
    chartControl.Panels.Add(label);
    
    Visual Basic
    Copy Code
    Dim label As New NLabel
    
    label.Text = "Hello world"
    label.Location = New NPointL(0, 0)
    label.ContentAlignment = ContentAlignment.BottomRight
    label.TextStyle.FontStyle.EmSize = New NLength(22, NGraphicsUnit.Point)
    
    chartControl.Panels.Add(label)
    
     Label text
    The text displayed by the label is controlled by the Text property of the NLabel object. The NTextStyle object associated to the label allows you to control the text properties like font, color and orientation and can be accessed via the TextStyle property of the label.
     Other
    All labels have an associated NInteractivityStyle object which allows them to display custom tooltips or react to mouse action the user is performing on them. These features are discussed in detail in the Interactivity book in the User's Guide.
     Related Examples

    Windows forms: Labels\General

    Web forms: Labels\General

     

    See Also

    NTextStyle | NBackplaneStyle