Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Remarks

Set the position of each SeriesDataLabel using the DataLabelPlacementType enum.
Only certain combinations of Placement types and chart types go together. Any invalid combinations will result in an ArgumentException.

 

Area

Bar

Bubble

Column

Doughnut

Line

Pie

Radar

Scatter

Above

 

 

X

 

 

X

 

 

X

Auto

 

 

 

 

 

 

X

 

 

Below

 

 

X

 

 

X

 

 

X

Center

 

X

X

X

 

X

X

 

X

Default

 

X

X

X

 

X

X

 

X

InsideBase

 

X

 

X

 

 

 

 

 

InsideEnd

 

X

 

X

 

 

X

 

 

Left

 

 

X

 

 

X

 

 

X

MovedByUser

X

X

X

X

X

X

X

X

X

Right

 

 

X

 

 

X

 

 

X

OutsideEnd

 

X

 

X

 

 

X

 

 

If the X or Y property of the DataLabel are set, then the DataLabelPlacement is also set to 'MovedByUser'.

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 Block
vb.net
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

...