Hi
I have a line chart in a spreadsheet that has two ranges and I am writing a macro to update the data ranges when more data is added.
I can update the data range, but can’t see how to set the name of each range and how to set the categories (that is, the values on the x axes). I can’t find any useful documentation for this anywhere.
This is a snippet my code so far
oChart = oOutSheet.getCharts().getByIndex(0)
oData = Array (oOutSheet.getCellRangeByName( "D2:D69").getRangeAddress(),_
oOutSheet.getCellRangeByName( "E2:E69").getRangeAddress( ),
oChart.setRanges(oData)
the categories for the x axis are in cells A2:A69
When I run this code it labels the two dataseries as “Column D” and “column E” and the x-axis labels are just 1 to 68.
I’ve tried adding the range with the categories to the array but that just adds it as another data line.
I’ve run out of ideas. Can anyone help?
Thanks
Samo