I have an excel sheet with a graph. I write the data to the correct columns, but sometimes there is a bit more and sometimes a bit less data. How would I extend the Series range using the API?
There are currently 2 ways to do this:
1. One way is to insert the rows where the chart is, so the chart range expands automatically. Take a look at the "Advanced API" demo: http://www.tmssoftware.biz/flexcel/doc/vcl/samples/delphi/api/advanced-api/index.html
Look at the "AddChart" method, where we insert rows and then fill the data. The chart data will expand to what is needed. If you prefer a simpler example, you can look at http://www.tmssoftware.biz/flexcel/samples/chart1.zip
2. Currently only for xls files, you can also use the API to set the series directly, using SetSeries/AddSeries. But please note that this method might change a little when we introduce v7/v7.1, since the old API was targeted to xls files, and charts in xlsx are completely different beasts with different features, and while we are trying to keep the old API working as much as possible, some changes had to be made to accommodate the completely different xlsx Excel chart engine. Today this way would still work, but I am not 100% sure we won't break it for v7 release. As said a lot of stuff changed, from the way axis and series are organized, and we are trying to get the API to be more "xlsx-like" than "xls-like" since xls is quite old already.
But well, SetSeries is simple to use, and if we do change it probably there will be a replacement as simple to use. The only real drawback for now is that SetSeries only works in xls charts. You can see an example using SetSeries here:
This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.