SeriesBase.Label Property
Gets series label settings.
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v24.2.dll
NuGet Package: DevExpress.Charts
#Declaration
[XtraChartsLocalizableCategory(XtraChartsCategory.Elements)]
public SeriesLabelBase Label { get; set; }
#Property Value
Type | Description |
---|---|
Series |
A Series |
#Remarks
The Label property provides access to the settings that specify the appearance, content, and position of series point labels.
Note that you cannot set the Label property. It is available to be set for serialization purposes only.
The label type depends on the series view. The following table lists series views and appropriate label types:
#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. |
Specifies whether to show series labels. |
Bar |
Defines label settings for bar series. |
Series |
Gets or sets the label’s background color. |
Series |
Gets the label’s border settings. |
Series |
Gets or sets the font used to display the label’s content. |
Bar |
Specifies the position of series point labels, relative to their corresponding Bars. |
Series |
Specifies the direction of text within the series labels. |
Series |
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}";
}