Hello experts
I want to display measurements from two different data sources in an XY chart in LO Calc. These are energy measurements over time, which are updated daily. I import the two measurement series into different data ranges, with the time values and X-values in separate rows. Therefore, the chart has two separate ranges for the X and Y values for each of the two series. For example, I want to display two measurement series from a specific day. This works perfectly with the Chart Wizard by entering the corresponding data ranges in the “Data Series” fields. Here’s a simplified test example:
The Data Range Register then looks like this:
The chart looks as expected:
The relevant data:

Now I want to change these data ranges using a macro. However, the setRanges method doesn’t work as expected: Changing at least one data range results in:
Then I thought it would be a good idea to use NamedRanges for the “Data Series” in the Chart Wizard (X1Data for $Test.$A$4:$A$10, etc.). Then, change NamedRanges with a macro using range.setContent(). Then, update the chart using the “Calculate Hard” function. That works perfectly.
The disappointment came later: When the ODS file is closed and reopened, the names of the ranges in the “Data Series” in the Chart Wizard are replaced by the addresses (X1Data is replaced by $Test.$A$4:$A$10, etc.).
So that’s not really a solution either.
Does anyone know of another solution? I would be grateful for any suggestions.
Best regards
Peter






