B4J Question XLUtils: chart with unknown number of data series

Chris2

Active Member
Licensed User
Longtime User
I am using XLUtils (excellent library, thank you!) with a template xlsx file, adding data and populating a chart using the dynamic named ranges as explained in the 'Templates and Charts' tutorial.

My problem is that the number of series' of data is variable, so I can not know how many named ranges are needed:
For example:
DateData Set 1Data Set 2other data sets......
2022-02-01587552254
2022-02-02965658758
: other dates

Until the report is created I don't know how many data sets there will be.
To populate the chart, I need to create named ranges for date, and all the data sets. But without knowing how may data sets there will be, I can't.

I can get around this to some extent by creating more data set named ranges there there will ever possibly be. But obviously there's the question of how many to create, and doing that means that the key on the chart will have a lot of unused entries:
chart.PNG


Is there a better way to solve this?
 
Top