Board index » delphi » Setting XValues for SeriesCollections

Setting XValues for SeriesCollections


2005-03-03 07:04:15 PM
delphi126
Hi all,
I'm trying to create a chart in Excel. But whenever I try to set a
range for a series I am getting the following error message "Die
XValues-Eigenschaft des Series-Objektes kann nicht festgelegt werden" /
"The xvalues property of the series object could not be defined" ???
Here is the code I am using.
xChart := xXL.Charts.Add;
xChart.ChartType := xlXYScatterLines;
xNewSeries := xChart.SeriesCollection.NewSeries;
xNewSeries.Name := 'Series 1';
xNewSeries.XValues := '=Daten!A5:A100'; // <-- here the error occurs
xNewSeries.Values := '=Daten!B5:B100';
I've tried early binding, late binding and the Delphi server components
but the result is always the same.
Any help appreciated,
Thanks in advance
Peter
 
 

Re:Setting XValues for SeriesCollections

<<Peter worbis:
xNewSeries.XValues := '=Daten!A5:A100'; // <-- here the
error occurs
Quote
>
You have to pass the range itself, not a string:
ASeriesCollection.Item(1).XValues :=
WkSheet.Range['A2','A10'];
--
Deborah Pate (TeamB) delphi-jedi.org
TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
www.borland.com/newsgroups/genl_faqs.html
 

Re:Setting XValues for SeriesCollections

Quote
You have to pass the range itself, not a string:
ASeriesCollection.Item(1).XValues :=
WkSheet.Range['A2','A10'];
--
Deborah Pate (TeamB) delphi-jedi.org
Hi,
if above would not work, try:
LRange := WkSheet.Range['A5:A100'];
xNewSeries.XValues := LRange;
where LRange is OLEVariant or Variant
hth,
Mariusz