How to tell if a Chart Object has data

I want to be able to hide a chart on a spreadsheet if it has no data? How would I go about detecting of a chart has no data? For some charts, we need to pre-populate it with some place holder Series pointing to ranges, so that during runtime, we populate those ranges - thus populating the chart with data.


Thanks in advance.
Hi,

Well, I am afraid, there is no specific APIs in Aspose.Cells that could determine if the chart has data or not and accomplish your task well. I think you have to write your own code to do it by yourself using the following API accordingly:
E.g
i) To get Chart data for a series --> you may use Series.getValues() to obtain the values in String or get the source range (e.g B2:C10 etc.) in the sheet, so that you could evaluate the cells manually in the range if it has data or not.
ii) To get category data area of the chart --> you may use SeriesCollection.getCategoryData() accordingly.

Moreover, this is also not straight forward and simple one as different charts have different attributes and options regarding data and its storage.

Could you please provide us some sample charts, so what we may look into it whether we can provide the relevant API or not to detect chart's data.

Thank you.