Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Description

Excerpt

The possible positions of a data label relative to its data point.

Signature
C#
C#
public enum DataLabelPlacementType
{signature}
{signature:
}
Signature
vb.net
vb.net
Public Enum DataLabelPlacementType
{signature}
{remarks}
{note}If you attempt to use a DataLabelPlacementType that does not correspond with the series' ChartType, you will receive the error "Error setting Data Label Placement: The data label placement type is not valid for this type of chart".{note}
{remarks}
{example}
{code:csharp|title=C#}
Remarks
Note

If you attempt to use a DataLabelPlacementType that does not correspond with the series' ChartType, you will receive the error "Error setting Data Label Placement: The data label placement type is not valid for this type of chart".

Example
Code Block
csharp
csharp
titleC#

//--- Create chart
Chart chart = ws.Charts.CreateChart(ChartType.Column.Stacked, ws.CreateAnchor(10, 0, 0, 0));

//--- Create data series
Series series = chart.SeriesCollection.CreateSeries("A1:A10");

//--- Set the data label position for the first SeriesDataLabel to OutsideEnd
series[0].Label.DataLabelPlacement = DataLabelPlacementType.OutsideEnd;
{code} {code:
Code Block
vb.net
|title=
vb.net
titlevb.net
}

'--- Create chart
Dim chart As Chart = ws.Charts.CreateChart(ChartType.Column.Stacked, ws.CreateAnchor(10, 0, 0, 0))

'--- Create data series
Dim series As Series = chart.SeriesCollection.CreateSeries("A1:A10")

'--- Set the data label position for the first SeriesDataLabel to OutsideEnd
series(0).Label.DataLabelPlacement = DataLabelPlacementType.OutsideEnd
{code} {example} {values} ||Name||Description|| |{anchor:Default} Default | The default data label position for column, bar, bubble, doughnut, line, and scatter charts | |{anchor:OutsideEnd} OutsideEnd | Places the data label on the outside of the data point in pie, column, and bar charts | |{anchor:InsideEnd} InsideEnd | Places the data label inside the data point, near its edge in column, bar, and pie charts | |{anchor:Center} Center | Places the data label in the center of the data point in bubble, line, and scatter charts | |{anchor:InsideBase} InsideBase | Places the data label on the inside of the data point, near its base in column and bar charts | |{anchor:Above} Above | Places the data label above the data point in bubble, line, and scatter charts | |{anchor:Below} Below | Places the data label below the data point in bubble, line, and scatter charts | |{anchor:Left} Left | Places the data label to the left of the data point in bubble, line, and scatter charts | |{anchor:Right} Right | Places the data label to the right of the data point in bubble, line, and scatter charts | |{anchor:Auto} Auto | Automatically place the data label depending on the space available. This is only available for pie charts, for which it sets the data label placement to "Best Fit" | |{anchor:MovedByUser} MovedByUser | Place the data label at an arbitrary x and y position for any chart type |
Values

Name

Description

Anchor
Default
Default
Default

The default data label position for column, bar, bubble, doughnut, line, and scatter charts

Anchor
OutsideEnd
OutsideEnd
OutsideEnd

Places the data label on the outside of the data point in pie, column, and bar charts

Anchor
InsideEnd
InsideEnd
InsideEnd

Places the data label inside the data point, near its edge in column, bar, and pie charts

Anchor
Center
Center
Center

Places the data label in the center of the data point in bubble, line, and scatter charts

Anchor
InsideBase
InsideBase
InsideBase

Places the data label on the inside of the data point, near its base in column and bar charts

Anchor
Above
Above
Above

Places the data label above the data point in bubble, line, and scatter charts

Anchor
Below
Below
Below

Places the data label below the data point in bubble, line, and scatter charts

Anchor
Left
Left
Left

Places the data label to the left of the data point in bubble, line, and scatter charts

Anchor
Right
Right
Right

Places the data label to the right of the data point in bubble, line, and scatter charts

Anchor
Auto
Auto
Auto

Automatically place the data label depending on the space available. This is only available for pie charts, for which it sets the data label placement to "Best Fit"

Anchor
MovedByUser
MovedByUser
MovedByUser

Place the data label at an arbitrary x and y position for any chart type