Skip to main content
A newer version of this page is available. .

BarSeriesLabel.Position Property

Specifies the position of series point labels, relative to their corresponding Bars.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v20.1.dll

NuGet Packages: DevExpress.Charts, DevExpress.WindowsDesktop.Charts

Declaration

[XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)]
public BarSeriesLabelPosition Position { get; set; }

Property Value

Type Description
BarSeriesLabelPosition

A BarSeriesLabelPosition enumeration value that specifies the label position.

Available values:

Name Description
Auto

Enables the algorithm which calculates the label position inside bars with respect to chart size.

Top

Labels are displayed above Bars.

BarSeriesLabelPosition_Top

Center

Labels are displayed in the center of Bars.

BarSeriesLabelPosition_Cent

TopInside

Labels are displayed inside Bars, at the top.

BarSeriesLabelPosition_TopInside

BottomInside

Labels are displayed inside Bars, at the bottom.

BarSeriesLabelPosition_BottomInside

Remarks

When the Position property is set to Top, the lines that connect labels with their corresponding points become visible, and the following properties become available: SeriesLabelBase.LineColor, SeriesLabelBase.LineLength, SeriesLabelBase.LineStyle and SeriesLabelBase.LineVisible.

When the Position property is set to TopInside or BottomInside, the BarSeriesLabel.Indent property specifies an indent between a label and the corresponding side of a Bar.

Example

This example demonstrates how to customize the Side-by-Side Bar series label position and appearance.

Use the following API members to customize bar series labels:

Member Description
Series.LabelsVisibility Specifies whether to show labels for a series.
BarSeriesLabel Defines label settings for bar series.
SeriesLabelBase.BackColor Gets or sets the label’s background color.
SeriesLabelBase.Border Gets the label’s border settings.
SeriesLabelBase.Font Gets or sets the font used to display the label’s contents.
BarSeriesLabel.Position Specifies the position of series point labels, relative to their corresponding Bars.
SeriesLabelBase.TextOrientation Specifies the direction of text within the series labels.
SeriesLabelBase.TextPattern Gets or sets a string which represents the pattern specifying the text to be displayed within series labels.
private void OnFormLoad(object sender, EventArgs e) {
    chartControl1.Series[0].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;

    BarSeriesLabel seriesLabel = chartControl1.Series[0].Label as BarSeriesLabel;
    seriesLabel.BackColor = Color.White;
    seriesLabel.Border.Color = Color.DarkSlateGray;
    seriesLabel.Font = new Font("Tahoma", 10, FontStyle.Regular);
    seriesLabel.Position = BarSeriesLabelPosition.TopInside;
    seriesLabel.TextOrientation = TextOrientation.Horizontal;
    seriesLabel.TextPattern = "{V:F1}";            
}
See Also