Setting chart data label font as Bold not working (C# .NET)

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)

@StevenF97,

I have observed the issue shared by you. The provided piece of code is fine. I request you to please share the source file, working sample code and generated output presentation for reference. It seems to be an issue and I will log issue in our issue tracking system based on provided information.

@StevenF97,

We have included the support for setting custom chart data labels. You can modify the textual properties including font, height, color, text bold and text italicizing using Aspose.Slides API. In the following example, you can verify the usage of the mentioned properties.

	public static void CustomizeChartLabel()
	{
		String dataDir = @"C:\Aspose Data\";

		Presentation presentation = new Presentation();

		ISlide slide = presentation.Slides[0];
		IChart chart = slide.Shapes.AddChart(ChartType.StackedColumn, 20, 20, 400, 400);
		IChartSeries series = chart.ChartData.Series[0];
		IChartCategory cat;
		double[] total_for_Cat = new double[chart.ChartData.Categories.Count];
		for (int k = 0; k < chart.ChartData.Categories.Count; k++)
		{
			cat = chart.ChartData.Categories[k];

			for (int i = 0; i < chart.ChartData.Series.Count; i++)
			{
				total_for_Cat[k] = total_for_Cat[k] + Convert.ToDouble(chart.ChartData.Series[i].DataPoints[k].Value.Data);
			}
		}

		double dataPontPercent = 0f;

		for (int x = 0; x < chart.ChartData.Series.Count; x++)
		{
			series = chart.ChartData.Series[x];
			series.Labels.DefaultDataLabelFormat.ShowLegendKey = false;

			for (int j = 0; j < series.DataPoints.Count; j++)
			{
				IDataLabel lbl = series.DataPoints[j].Label;
				dataPontPercent = (Convert.ToDouble(series.DataPoints[j].Value.Data) / total_for_Cat[j]) * 100;

				IPortion port = new Portion();
				port.Text = String.Format("{0:F2} %", dataPontPercent);
				port.PortionFormat.FontHeight = 10f;
				//Setting label font to bold and italic
				port.PortionFormat.FontBold = NullableBool.True;
				port.PortionFormat.FontItalic = NullableBool.True;
				port.PortionFormat.LatinFont= new FontData("Times New Roman");
				//set color
				port.PortionFormat.FillFormat.FillType = FillType.Solid;
				port.PortionFormat.FillFormat.SolidFillColor.Color = Color.Red;

				lbl.TextFrameForOverriding.Text = "";
				IParagraph para = lbl.TextFrameForOverriding.Paragraphs[0];
				para.Portions.Add(port);

				lbl.DataLabelFormat.ShowSeriesName = false;
				lbl.DataLabelFormat.ShowPercentage = false;
				lbl.DataLabelFormat.ShowLegendKey = false;
				lbl.DataLabelFormat.ShowCategoryName = false;
				lbl.DataLabelFormat.ShowBubbleSize = false;

			}

		}

		// Save presentation with chart
		presentation.Save(dataDir + "DisplayPercentageAsLabels_out.pptx", SaveFormat.Pptx);

	}

DisplayPercentageAsLabels_out.zip (32.1 KB)