Free Support Forum - aspose.com

Data labels on Donuts chart are overlapped in PDF file

When we generate the pdf file with excel template data label of donuts chart are overlapped. However charts label are fine(not overlapped) in template file. Sample template file, screen-shot of pdf file and set of code we used are as follows.
Code:

    FileInputStream io1=new FileInputStream(new File("utilization_dashboard_ea_withData1.xlsx"));
	Workbook workbook1 = new Workbook(io1);
	workbook1.save("utilizationDashboard_ea_templateFile.xlsx");

        FileInputStream io=new FileInputStream(new File("utilizationDashboard_ea_templateFile.xlsx"));
	Workbook workbook = new Workbook(io);
	workbook.calculateFormula();
	
	for (int m = 0; m < workbook.getWorksheets().getCount(); m++) {
		workbook.getWorksheets().get(m).getShapes().updateSelectedValue();
	}

	for (int j = 0; j < workbook.getWorksheets().getCount(); j++) {
		def sheetName=workbook.getWorksheets().get(j).getName();
		if ((sheetName.startsWith("_") || sheetName.contains("staging") ||sheetName.contains("Staging")) {
			workbook.getWorksheets().get(j).setVisible(false);
		}
	}
	
	workbook.save("PDF_Result_file.pdf");

PDF File screen-shot:
pdf_screenShot.png (75.2 KB)
Sample template with raw data:
sample_template_file.zip (57.8 KB)

@brpokharel,

Which version of the product you are using? I tested your scenario/ case using your sample code and template file and it works Ok and as expected. I am using our latest version/fix: Aspose.Cells for Java v19.12.4 (attached). Please try our latest version, it will work fine.

Let us know if you still find the issue with v19.12.x.
aspose-cells-19.12.4-java.zip (6.8 MB)

We are using aspose-cells-19.11 and aspose-pdf-19.5 aspose version.

Thanks for quick response and providing latest jar of aspose-cells. We will check with this and update you.

@brpokharel,

Sure, take your time to evaluate the latest version/fix. In the event of any issue or queries, feel free to write us back, we will happy to assist you soon.

@ Amjad_Sahi

We are still getting same issue even if we used the latest aspose-cell jar file you provided. For reference screen-shot of pdf file is attached. Please look into this here the data-labels (14,3,7) of donuts charts are overlapped but you can see it is fine in template file (display sheet / ‘Utilization Dashboard’) which I have already attached .

labelOverlapped_pdf_screenShot.png (17.8 KB)

@brpokharel,

Thanks for the screenshot.

I tested the following sample code with your template file and it work. Please find attached the output file for your reference. Here is sample code I am using:
e.g
Sample code:

Workbook workbook = new Workbook("e:\\test2\\utilization_dashboard_ea_withData1.xlsx");
		workbook.calculateFormula();
		
		for (int m = 0; m < workbook.getWorksheets().getCount(); m++) {
			workbook.getWorksheets().get(m).getShapes().updateSelectedValue();
		}

		workbook.save("f:\\files\\PDF_Result_file1.pdf"); 

It might be some missiing fonts issue on your end. Please make sure that the following fonts (which are used in the workbook) should be installed on your enviroment:
LucidaSans, Arial, Calibri, Tahoma, etc

Also, you got toset the fonts folder for rendering in your code at the start of the program:

If you still find the issue, kindly do share your output PDF file, we will check it soon.
PDF_Result_file1.pdf (159.3 KB)

@ Amjad_Sahi

Issue still exist. Here our main concern is, pdf file is not generate as its respective template we have.

In template (excel file) data label are not overlapped on donuts chart with name ’ Admissions by Type ’ . That means,when we open up the excel template in MS-Office (I used MS-Office 2016) we found there is no data label overlapping issue in chart. For reference I have attached the screen-shot view of template when open up in MS-Office excel and I have marked with red arrow.
templateView_screen_shot.png (87.0 KB)

When we used the same template for generating the PDF, issue encountered as chart labels are overlapping. We can say chart in pdf was not prepared as it is in template we have. For your reference I have attached a complete pdf file which looks similar as you have provided. But the issue is existed in pdf file you have provided(attached). You can compare the chart with name 'Admissions by Type ’ in template screen-shot view and pdf you have provided. I hope after comparing this you will notice the actual issue.

pdf_result_sampleFiile.pdf (56.4 KB)

Any updates on this?

@brpokharel,

Thanks for providing further details, screenshot and output PDF.

After further evaluation, I am able to observe the issue as you mentioned by converting your template file to PDF file format. I found some data labels in your mentioned Donut chart “Admissions by Type” are overlapped.
e.g
Sample code:

Workbook workbook = new Workbook("e:\\test2\\utilization_dashboard_ea_withData1.xlsx");
        workbook.calculateFormula();

        for (int m = 0; m < workbook.getWorksheets().getCount(); m++) {
            workbook.getWorksheets().get(m).getShapes().updateSelectedValue();
        }

        workbook.save("f:\\files\\PDF_Result_file1.pdf");  

Please also find attached the screenshot to highlight your mentioned issue. I have logged a ticket with an id “CELLSJAVA-43091” for your issue. We will look into it to figure it out soon.

Once we have an update on it, we will let you know.
sc_shot1.png (132.3 KB)

@ Amjad_Sahi

Thanks for update. We are looking forward to fix this issue in near future.

@brpokharel,

Sure, we will try to resolve the issue soon.

Once we have any new information available, we will update you.

@brpokharel,

This is to inform you that we have fixed your issue (logged earlier as “CELLSJAVA-43091”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.