ChartPoints.getChartPoint(int index) how to use?

Hello,

from time to time I’ve got strange problems when I need to obtain ChartPoint objects from ASeries (I mean when I do this: ASeries.getChartPoints().getChartPoint(int index)).

1) What is the right way to iterate through chartPoints? Because there is no iterator object or size() method and when I use some high random value as a index value (eg.: ChartPoints.getChartPoint(1337)) it still returns an ChartPoint object (although my ASeries is serie with much less count of values) - what are these ChartPoint objects? I thought that one value in ASeries is just one ChartPoint object…

2) in some really random constellations just calling of this code:

ASeries aserie = …
aserie.getChartPoints().getChartPoint(0); // 1, 1000… whatever

cause the generated excel is corrupted - when I try to open it by MS Excel, error message box (in Excel) appears with text “file error: data could be lost” (translated freely - I’ve got czech version of Excel) or another kind of dialog with something like “data are corrupted, want to repair it ? [YES/NO]” . When I comment that piece of code off it starts to work. I really don’t understand how is that possible, when I do not modify anything… Note that in some parts of my code it works ok, but there are another parts, where the only solution is to comment it off…

Hi,

Thank you for considering Aspose.

We will look into your mentioned issues and get back to you soon.

Thank You & Best Regards,

ok… by the way I tried several versions namely - 2.0.1, 2.0.0, 2.0.0.12 (some hotfix version from you) and it was the same all the time

Hi,

Thank you for considering Aspose.

Please try the attached latest version of Aspose.Cells.

For your issue 1), from version 2.1.0 we have provided ChartPoints.size(). For ChartPoints.getChartPoint(int index), if you have a custom ChartPoint object for given index, this method will return the customed one; Otherwise it will create a new ChartPoint object for given index and return it(that is why you can get a ChartPoint object even when give a very large index when we did not check the range). Now in the new fix we have added check for ChartPoints.getChartPoint(int index) to limit given index less than size(). We also added another API: ChartPoints.getCustomedPointIterator() for you to iterate all customed ChartPoints in the collection. And there is a new API: ChartPoint.getPointIndex() to check which point is this ChartPoint object for when user iterates customed ChartPoint from the collection.

For your issue 2), we have done some testing but cannot reproduce it. Would you please try this new fix and check whether it can fix your issue. If the issue persists, please send us your sample code to reproduce it so we can figure it out.

Thank You & Best Regards,