Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Mon Nov 15, 2021 9:10 pm

I use Spire.Office for Java 4.10.5

I've noticed that it is not possible to get the size of a ChartDataPointsCollection.

So it is not possible to access get() without potentialy throwing an Exception...

Code: Select all
chart.getSeries().get(0).getDataPoints().get(1); // Could trigger an Exception because we don't know the size of the collection

QuentinSup
 
Posts: 46
Joined: Mon Oct 18, 2021 9:18 am

Tue Nov 16, 2021 6:23 am

Hello,

Thanks for your inquiry.
Please use the following code to get the size of "ChartDataPointsCollection". If there is any question, please feel free to contact us.
Code: Select all
int counts = chart.getSeries().get(0).getPointNumber();

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1647
Joined: Wed Apr 07, 2021 2:50 am

Tue Nov 30, 2021 8:37 am

Hi,

Greetings from E-iceblue!
Did the code we provided work for you? Any feedback will be greatly appreciated.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1647
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.XLS