Page 1 of 1

Graph Export - Multi Series only want first X range

Posted: Thu Feb 10, 2011 4:49 pm
by 16458506
I am exporting a full range of Series from a chart. My X range in each series is a date field in an ADOQuery.

TSeriesDataXLS *XLSExp= new TSeriesDataXLS(AttendChart, NULL);


I do not want to have the resultant XLS file have....

Date1 Data1 Date2 Data2 Date3 Data3


Question: is there a way to only export the X range for the first series and then the y range data for subsequent series into the single workbook.
e.g.
Date1 Data1 Data2 Data3 Date4

Regards
Shaun

Re: Graph Export - Multi Series only want first X range

Posted: Fri Feb 11, 2011 1:03 pm
by 10050769
Hello MSS,

I don't reproduce your problem here using next code:

Code: Select all

uses Series, TeExport, TeeStore;
procedure TForm1.FormCreate(Sender: TObject);
var Series1,Series2,Series3:TLineSeries;
begin
    Series1 := TLineSeries.Create(self);
    Series2 := TLineSeries.Create(self);
    Series3 := TLineSeries.Create(self);
    Chart1.AddSeries(Series1);
    Chart1.AddSeries(Series2);
    Chart1.AddSeries(Series3);
    Chart1.SeriesList.FillSampleValues(10);
    with TSeriesDataXLS.Create(Chart1,nil) do
    begin
      IncludeIndex:=True;
      IncludeLabels:=True;
      IncludeHeader:=True;
     SaveToFile('c:\Chart1.xls');
     end;
end;
Could you please check if previous code reproduces your problem? If it doesn't reproduce your problem please send us a simple project so we can reproduce your problem here, so we can try to help you.

Thanks,

Re: Graph Export - Multi Series only want first X range

Posted: Mon Feb 14, 2011 11:23 am
by 16458506
Im not using random data,
Each series is date range based.

That is each series shares the same date.

e.g 1 oct to 1 dec.
The Y values for each series are taken from various fields in the TQuery, The x value is the date for all series.

Re: Graph Export - Multi Series only want first X range

Posted: Mon Feb 14, 2011 1:48 pm
by 16458506
Sandra,

If you use an x range label for example to display the date in series 1.

When you export you always get a blank column headed with the word text. It seems to expect labels for each subsequent series. I don't want them.

You example only outputs Y values so only has to export Y values, I need to export some date ranges and indeed some other text using the labels and X range values. However when you do this for the first series the other series seem to expect a value and so place blank columns in the spreadsheet - headed "TEXT" which I don't want as it will confuse my users.

If I need to change the chart type or selected stacked or something to prevent this, please let me know.

Re: Graph Export - Multi Series only want first X range

Posted: Mon Feb 21, 2011 3:33 pm
by 10050769
Hello MSS,

I have added you request in wish-list with number [TV52015404] to be considered inclusion in next maintenance releases of TeeChartVCL. On the other hand, for now, one solution would be converted X values as Labels, as do in next example code:

Code: Select all

uses Series, TeExport, TeeStore;
procedure TForm1.FormCreate(Sender: TObject);
var Series1,Series2,Series3:TLineSeries;
i:Integer;
text: String;
begin
    Series1 := TLineSeries.Create(self);
    Series2 := TLineSeries.Create(self);
    Series3 := TLineSeries.Create(self);
    Chart1.AddSeries(Series1);
    Chart1.AddSeries(Series2);
    Chart1.AddSeries(Series3);
    Chart1.SeriesList.FillSampleValues(10);
    with TSeriesDataXLS.Create(Chart1,nil) do
    begin
      IncludeIndex :=True;
      IncludeLabels:=True;
      IncludeHeader:=True;
    For i:=0 to Series1.Count do
    begin
        Series1.Labels[i] :=FloatToStr(Series1.XValues[i])
    end;
     SaveToFile('Chart1.xls');
    end;
end;
Thanks,