Back to Devexpress

SeriesBase.Label Property

corelibraries-devexpress-dot-xtracharts-dot-seriesbase-7c07c0fa.md

latest13.0 KB
Original Source

SeriesBase.Label Property

Gets series label settings.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
[XtraChartsLocalizableCategory(XtraChartsCategory.Elements)]
public SeriesLabelBase Label { get; set; }
vb
<XtraChartsLocalizableCategory(XtraChartsCategory.Elements)>
Public Property Label As SeriesLabelBase

Property Value

TypeDescription
SeriesLabelBase

A SeriesLabelBase object that provides the series label settings.

|

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:

Show the table

PatternDescription
3D AreaArea3DSeriesLabel
BarBarSeriesLabel
3D BarBar3DSeriesLabel
BubbleBubbleSeriesLabel
DoughnutDoughnutSeriesLabel
3D DoughnutDoughnut3DSeriesLabel
Full-Stacked AreaFullStackedAreaSeriesLabel
3D Full-Stacked AreaFullStackedArea3DSeriesLabel
Full-Stacked BarFullStackedBarSeriesLabel
3D Full-Stacked BarFullStackedBar3DSeriesLabel
FunnelFunnelSeriesLabel
3D FunnelFunnel3DSeriesLabel
3D LineLine3DSeriesLabel
Nested DoughnutNestedDoughnutSeriesLabel
PiePieSeriesLabel
3D PiePie3DSeriesLabel
Radar, PolarRadarPointSeriesLabel
Area, Step Area, Spline AreaPoint, Line, Step LinePointSeriesLabel
Radar Range Area, Polar Range AreaRadarRangeAreaSeriesLabel
Range AreaRangeAreaSeriesLabel
3D Range AreaRangeArea3DSeriesLabel
Side-by-Side Range Bar, Overlapped Range Bar,
Side-by-Side Gantt, Overlapped GanttRangeBarSeriesLabel
Side-by-Side BarSideBySideBarSeriesLabel
3D Stacked AreaStackedArea3DSeriesLabel
Stacked BarStackedBarSeriesLabel
3D Stacked BarStackedBar3DSeriesLabel
Stacked LineStackedLineSeriesLabel
3D Stacked LineStackedLine3DSeriesLabel
Stock, Candle StickStockSeriesLabel

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:

MemberDescription
Series.LabelsVisibilitySpecifies whether to show series labels.
BarSeriesLabelDefines label settings for bar series.
SeriesLabelBase.BackColorGets or sets the label’s background color.
SeriesLabelBase.BorderGets the label’s border settings.
SeriesLabelBase.FontGets or sets the font used to display the label’s content.
BarSeriesLabel.PositionSpecifies the position of series point labels, relative to their corresponding Bars.
SeriesLabelBase.TextOrientationSpecifies the direction of text within the series labels.
SeriesLabelBase.TextPatternGets or sets a string which represents the pattern specifying the text to be displayed within series labels.
csharp
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}";            
}
vb
Private Sub OnFormLoad(ByVal sender As Object, ByVal e As EventArgs)
    chartControl1.Series(0).LabelsVisibility = DevExpress.Utils.DefaultBoolean.[True]

    Dim seriesLabel As BarSeriesLabel = TryCast(chartControl1.Series(0).Label, 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}"
End Sub

See Also

SeriesBase Class

SeriesBase Members

DevExpress.XtraCharts Namespace