Free Support Forum - aspose.com

Bar is getting displayed only for few values in Clustered bar chart, when the number of values adding to it is more than 2000

Dear team,

I have a clustered bar graph in my excel in which i am trying to add more than 2500 rows of data as a single series to it. But the bar is getting displayed for around 2000 values where it is missing for remaining values.
I am attaching the sample excel sheet below for your reference. Kindly help me to solve this issue as early as possible.

Regards
Yasaswini Challa

BarIssue.zip (62.0 KB)

@YaSaSwini,

Thanks for the template file.

I checked the chart whose series range is “AA2632:AA5242” --> 2610 records is properly set. I think this is MS Excel’s behavior which cannot show all the series data and nothing to do with Aspose.Cells APIs. In fact, MS Excel cannot show more than 1000 labels for a series, so surely, those extra data labels would be omitted. You may check the red bars labels pasted as “0” are approx. 1000. If you still think this can be done in MS Excel manually, kindly do create a sample file which contains your desired chart with data series show 2500 data rows or so, we will check on how to do it via Aspose.Cells APIs.

Dear Amjad,

I tried creating excel sheet with bar chart having a single data series containing 2600 data rows added to it. I could able to get all the bars displayed in the chart. Please find the sample template below and let me know whether we can do it by Aspose.Cells.

Regards
Yasaswini Challa

BarIssue_template.zip (22.3 KB)

@YaSaSwini,

Thanks for the template file.

Please try our latest version/fix: Aspose.Cells for Java v17.8.3.

I have created your desired chart using the following sample code with v17.8.3, it works fine. I used your template file and used the existing data source (for the chart) to create and mimic your existing chart. The output Excel file is also attached:
e.g
Sample code:

	Workbook workbook = new Workbook("f:\\files\\BarIssue.xlsx");

		Worksheet worksheet = workbook.getWorksheets().get(0);
		
		int intChartIndex = worksheet.getCharts().add(ChartType.BAR, 2, 0, 2644, 5);
		Chart chart = worksheet.getCharts().get(intChartIndex);
		chart.setLegendShown(false);
	
		chart.getNSeries().add("L4:L2644", true);
		workbook.save("f:\\files\\out1.xlsx");

Hope, this helps a bit.
file1.zip (23.8 KB)

Hi Amjad,

I tried the latest jar to generate the excel, still I could able to get the above mentioned issue.
For your information I can provide the environment details we are using.
Its a web application using weblogic server version-12130, we are running the application on windows platform and JDK1.7

Please consider the details and let me know if you need any further information.

Regards
Yasaswini Challa

@YaSaSwini,

I do not think using Aspose.Cells for Java in desktop or in web application makes any difference, it should work the same way in both scenarios. Please make sure your are using the latest version/fix v17.8.3 in your environment, you may print the version number of the latest jar for confirmation:
e.g
Sample code:

System.out.println("Aspose.Cells for Java v"+ CellsHelper.getVersion());

First run my sample code to get the generated file using your attached file and check if the chart is fine tuned or not. Could you provide us your sample JAVA program (runnable) you use to create the chart and to reproduce the issue on our end. Also provide your template file (if any), output file via Aspose.Cells APIs, we will check it soon.

Hi Amjad,

I tried printing the version number and it is point to 17.8.3 only. I am getting error like Excel found some problem with the content in the file and when I click on Yes to recover it is displaying “Repaired Records: Drawing from /xl/drawings/drawing1.xml part (Drawing shape)”.
In the generated file there is no graph at all.

I am attaching the file samples and the code I have used. Please find below.

Regards
Yasaswini Challa

Samples.zip (26.2 KB)

@YaSaSwini,

Thanks for the template file and sample code.

Your code (where you are adding chart has wrong parameter(s)). Please change the following line of code:
i.e.,
int intChartIndex = worksheet.getCharts().add(ChartType.BAR, 8, 2, 2000, 1);
to:
int intChartIndex = worksheet.getCharts().add(ChartType.BAR, 8, 2, 2000, 3);

Please note, the last parameter “lowerRightColumn” cannot be less than “upperLeftColumn” (third parameter).

I have tested using the updated line of code and it works fine.

Hope, this helps a bit.

Hi Amjad,

Thanks, now I could able to open the generated excel but still the bar issue exists. I am attaching the samples and the code that I have used. Please find below.

Regards
Yasaswini Challa

New_Samples.zip (118.7 KB)

@YaSaSwini,

Well, there is an error in your line of code,
i.e.,
chart.getNSeries().add("Chart!AB2638:AB5248", true);
please change it to:
chart.getNSeries().add("Chart!AA2638:AA5248", true);
as your data is in AA column and not in AB column.

Now come to your issue for the first few values are not rendered onto charts, it is not the issue with Aspose.Cells rather MS Excel’s behavior. For confirmation, you may create the same chart using the file “Input.xlsx” manually after inserting the data into AA column’s respective cells, you will see in the first part of the chart, data is omitted and empty, so it would be also same as the output chart (you attached the output file) generated by Aspose.Cells APIs.

If you still think other way, kindly do create the chart using the file “Input.xlsx” manually (after inserting the data into AA column’s respective cells), save the file and post us here with steps details and screenshots, we will check on how to do it via Aspose.Cells APIs.

Hi Amjad,

Yes I do agree now that its MS Excel’s behavior that is causing this issue. Thanks a lot for your support.

Regards
Yasaswini Challa

@YaSaSwini,

Good to know that you understand it now. Feel free to contact us any time if you have any other query or issue, we will be happy to assist you soon.

Hi Amjad,

Can you please confirm whether this issue occurs for all types of charts?
If yes, what is the maximum number of bars that gets displayed in a series?

Regards
Yasaswini Challa

@YaSaSwini,

Yes, this issue might occur for other chart types. Moreover, the limiting factors (for chart’s series rendering) are complex a bit and may depend upon underlying data (continuous/non contiguous) and other elements/aspects.