I need to set chart data labels to be bold, but I am having problems achieving this. I am using the following code to format the data labels:
//Series label formatting
foreach (var s in MyChart.ChartData.Series)
{
s.Labels.DefaultDataLabelFormat.ShowValue = true;
s.Labels.DefaultDataLabelFormat.IsNumberFormatLinkedToSource = false;
s.Labels.DefaultDataLabelFormat.NumberFormat = "0%;-0%;0%;";
s.Labels.DefaultDataLabelFormat.Position = LegendDataLabelPosition.OutsideEnd;
var labeltext = s.Labels.DefaultDataLabelFormat.TextFormat.PortionFormat;
labeltext.FillFormat.FillType = FillType.Solid;
labeltext.FontBold = NullableBool.True;
}
The result is that the text is not formatted as bold. However, confusingly when clicking on the label in PowerPoint, the Bold “button” the the Format Text menu is highlighted as if the text is set to bold, so clearly some property related to Bold has been set to true. It’s just not causing the text to actually display as bold. See attached image illustrating the situation. What am I doing wrong? What is the appropriate way to get chart data labels to display as Bold?
image.png (56.2 KB)