position property

ChartDataLabelCollection.position property

Gets or sets the position of the data labels.

get position(): Aspose.Words.Drawing.Charts.ChartDataLabelPosition

Remarks

The position can be set for data labels of the following chart series types:

Examples

Shows how to set the position of the data label.

let doc = new aw.Document();
let builder = new aw.DocumentBuilder(doc);

// Insert column chart.
let shape = builder.insertChart(aw.Drawing.Charts.ChartType.Column, 432, 252);
let chart = shape.chart;
let seriesColl = chart.series;

// Delete default generated series.
seriesColl.clear();

// Add series.
let series = seriesColl.add(
  "Series 1",
  [ "Category 1", "Category 2", "Category 3" ],
  [ 4, 5, 6 ]);

// Show data labels and set font color.
series.hasDataLabels = true;
let dataLabels = series.dataLabels;
dataLabels.showValue = true;
dataLabels.font.color = "#FFFFFF";

// Set data label position.
dataLabels.position = aw.Drawing.Charts.ChartDataLabelPosition.InsideBase;
dataLabels.at(0).position = aw.Drawing.Charts.ChartDataLabelPosition.OutsideEnd;
dataLabels.at(0).font.color = "#8B0000";

doc.save(base.artifactsDir + "Charts.labelPosition.docx");

See Also