Chart / Charts / Series Labels Appearance
In This Topic
    Series Labels Appearance
    In This Topic

    Data labels are descriptive texts displayed over data points. Each series derived from NSeries has an associated instance of a NDataLabelStyle object controlling the default data label style. It is accessible through the DataLabelStyle property of the NSeries class. In addition, each data point has a DataLabelStyle property allowing you to specify a data label style per individual data point. The following sections describe common tasks performed with data labels.

     Labels Visibility

    The visibility of a data labels is controlled through the Visible property of the NDataLabelStyle object. By default it is set to true and series data labels are visible. The following code hides all data labels for a specific series:

    C#
    Copy Code
    NDataLabelStyle dataLabelStyle = new NDataLabelStyle();
    dataLabelStyle.Visible = false;
    someSeries.DataLabelStyle = dataLabelStyle;
    
     Labels Format

    The user can control what information is displayed in each data label with the help of a simple formatting string. It is specified from the Format property. The following example demonstrates how to display the value and the label of the data points in the data labels.

    C#
    Copy Code
    series.DataLabelStyle.Format = "<value> <label>";
    
    For more information check out the Label Formatting topic.
     Appearance of the data label

    The data label text appearance is controlled through the TextStyle property of the NDataLabelStyle object. It exposes a NTextStyle object. The data label arrow appearance is controlled through the ArrowLength, ArrowPointerLength, and ArrowStrokeStyle properties. The following code modifies some properties of the data label style:

    C#
    Copy Code
    NDataLabelStyle dataLabelStyle = new NDataLabelStyle();dataLabelStyle.Visible = false;dataLabelStyle.ArrowPointerLength = 11;dataLabelStyle.TextStyle.Fill = new NColorFill(NColor.Blue);dataLabelStyle.TextStyle.Font = new NFont("Times New Roman", 12);bar.DataLabelStyle = dataLabelStyle;
    

     

    See Also