SetDataLabelsTextPr
Sets the text properties to the chart data labels.
Syntax
expression.SetDataLabelsTextPr(textPr);
expression - A variable that represents an ApiChart class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| textPr | Required | ApiTextPr | The text properties to apply to the data labels. |
Returns
boolean
Example
Set the text properties for all chart data labels in a presentation.
const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
slide.RemoveAllObjects();
const chart = Api.CreateChart('bar3D', [
[200, 240, 280],
[250, 260, 280]
], ['Projected Revenue', 'Estimated Costs'], [2014, 2015, 2016], 4051300, 2347595, 24);
chart.SetVerAxisTitle('USD In Hundred Thousands', 20);
chart.SetHorAxisTitle('Year', 22);
chart.SetLegendPos('bottom');
chart.SetShowDataLabels(false, false, true, false);
chart.SetTitle('Financial Overview', 26);
chart.SetSize(Api.MillimetersToEmus(300), Api.MillimetersToEmus(130));
chart.SetPosition(608400, 1267200);
chart.SetSeriesFill(Api.CreateSolidFill(Api.RGB(55, 71, 79)), 0, false);
chart.SetSeriesFill(Api.CreateSolidFill(Api.RGB(21, 101, 131)), 1, false);
const textPr = Api.CreateTextPr();
textPr.SetFontSize(48);
textPr.SetBold(true);
textPr.SetFontFamily('Arial');
textPr.SetColor(Api.ThemeColor('accent1'));
chart.SetDataLabelsTextPr(textPr);
slide.AddObject(chart);