PieChart Title overlap with piechart body (Java)

I have the following code to generate a pie chart.

    IChart chart = sld.getShapes().addChart(ChartType.Doughnut, x, y, width, height);

	chart.getChartTitle().addTextFrameForOverriding(" ");

	if (null != strategyValue && strategyValue.length() > 0) {
		ITextFrame titleTextFrame = chart.getChartTitle().addTextFrameForOverriding("Sample title for PieChart");
		for (IParagraph paragraph : titleTextFrame.getParagraphs()) {
			for (IPortion portion : paragraph.getPortions()) {
				portion.getPortionFormat().setLatinFont(new FontData("Arial"));
				portion.getPortionFormat().setFontHeight(8);
			}
		}
		
		chart.getChartTitle().getTextFrameForOverriding().getTextFrameFormat().setMarginBottom(300);
		chart.setTitle(true);
		chart.setLegend(false);
		chart.getChartTitle().setX(0.63f);
		chart.getChartTitle().setY(0.07f);
	}

	chart.getChartData().getSeries().get_Item(0).getLabels().getDefaultDataLabelFormat().setShowValue(true);

	int defaultWorksheetIndex = 0;

	IChartDataWorkbook fact = chart.getChartData().getChartDataWorkbook();

	chart.getChartData().getSeries().clear();
	chart.getChartData().getCategories().clear();

	IChartSeries iChartSeries = chart.getChartData().getSeries().add(fact.getCell(defaultWorksheetIndex, 0, 1, "series"), chart.getType());

	// Setting hole size and colors of the series
	iChartSeries.getParentSeriesGroup().setColorVaried(true);
	iChartSeries.getParentSeriesGroup().setDoughnutHoleSize((byte) 55);

	for (int i = 0; i < listData.size(); i++) {
		Map<String, BigDecimal> data = listData.get(i);
		for (Entry<String, BigDecimal> l1EntrySet : data.entrySet()) {
			iChartSeries.getDataPoints().addDataPointForDoughnutSeries(fact.getCell(defaultWorksheetIndex, i + 1, 1, l1EntrySet.getValue()));

			IChartSeries series = chart.getChartData().getSeries().get_Item(0);

			series.getDataPoints().get_Item(i).getFormat().getFill().setFillType(FillType.Solid);
			series.getDataPoints().get_Item(i).getFormat().getFill().getSolidFillColor().setColor(colorMap.get(l1EntrySet.getKey()) != null ? Color.decode(colorMap.get(l1EntrySet.getKey())) : Color.WHITE);

			chart.setLegend(false);
		}
	}

The title overlaps with the body of the piechart generated.
Is there a way to solve this issue.
I’m using aspose 18.12.

@agarwalsarthak121,

I have tried using the sample code and unable to use this owing to custom declarations and data. I suggest you to please provide a working sample example along with generated output reproducing the issue. Please also first try using latest Aspose.Slides for Java 20.5 on your end before sharing the information as you are using a fairly older version.

Hi,

Can you tell me how to wrap title in chart ?
So that the title will use 2 lines instead of one.

@agarwalsarthak121,

titleTextFrame.getTextFrameFormat().setWrapText((byte)1);

The above line can be used for wrapping text. But I am not sure whether it will work in your case or not unless you provide us with requested inforamtion.