ComponentOne FlexChart for WinForms
Elements / Axes / Axis Labels
In This Topic
    Axis Labels
    In This Topic

    Axis labels are the text referring to major divisions which appear along an axis. On a category axis, axis labels display category names, while those on a value axis display values. FlexChart, by default, automatically generates the axis labels for both axes depending on the data and displays or hides them according to the available space along the axis line. However, you can set the chart to display axis labels for the maximum and minimum values always while automatic generation and placement, by setting the LabelMax and LabelMin properties respectively to True. You can also choose to hide all the labels of a particular axis by setting the Labels property of Axis class to False. FlexChart also lets you position the data labels with respect to the tick marks on the axis by setting the LabelAlignment property. You can change the format of axis labels by setting the Format property.

    //LabelAlignment property allows specifying label position relative to its axis line
    this.flexChart1.AxisX.LabelAlignment = AxisLabelAlignment.Top;
    this.flexChart1.AxisY.Format = "#,##0,,";
    'LabelAlignment property allows specifying label position relative to its axis line
    Me.flexChart1.AxisX.LabelAlignment = AxisLabelAlignment.Top
    Me.flexChart1.AxisY.Format = "#,##0,,"

    Manage Overlapping Axis Labels

    Overlapping of axis labels, generally, occurs due to long axis label text or a large number of data points plotted on a chart. With FlexChart, you get many options to manage your axis labels. You can choose any of them according to the chart data and your requirement.

    Overlapping label options

    As mentioned earlier, by default, FlexChart automatically places the axis labels and hides the overlapping labels if the space does not allow to display them. However, FlexChart provides various options to handle the overlapping labels. The OverlappingLabels property of Axis class, which is set to Auto by default and is responsible for hiding the overlapping axis labels, also lets you show, trim or wrap the labels in the case of overlapping. This property accepts value from OverlappingLabels enumeration.


    Auto mode


    Show mode


    Trim mode


    Wrap mode
        //Wrap the label text if it exceeds the available width
        this.flexChart1.AxisX.OverlappingLabels = OverlappingLabels.WordWrap;
        ' Wrap the label text if it exceeds the available width
        me.flexChart1.AxisX.OverlappingLabels = OverlappingLabels.WordWrap                   

    Rotate axis labels

    Another option to handle overlapping axis labels could be to rotate them with respect to the axis line by setting the LabelAngle property. This property accepts the numerical values from -90 to 90 in degrees and rotates the axis labels by the specified angle in anti-clockwise direction, thus giving it a more aesthetic look.

    Rotate mode

        //Rotate the labels counter-clockwise by 70 degrees
        this.flexChart1.AxisX.LabelAngle = 70;
        'Rotate the labels counter-clockwise by 70 degrees
        me.flexChart1.AxisX.LabelAngle = 70                  

    Staggered axis labels

    Staggering the axis labels is another effective method of managing the overlapping axis labels. This way, you can arrange the axis labels in multiple lines so that they do not overlap and yet be visible. This can be done by setting value of the StaggeredLines property to a value greater than 1, which is default value of the property.  

    stagger mode

        //Display the axis labels in staggered lines
        this.flexChart1.AxisX.StaggeredLines = 2;
        'Display the axis labels in staggered lines
        me.flexChart1.AxisX.StaggeredLines = 2                  
    Note: WinForms .NET 5 Edition has only runtime assemblies. Due to the new design-time model in VS2019 Preview, which is not complete yet from the Microsoft side, we do not supply any special design-time features as of yet. However, some of the controls might show up at design-time and allow editing few properties in the property grid.