Page 1 of 1

Series functions lost datasource on save

Posted: Tue May 06, 2008 2:14 pm
by 10548168
Hi,

when I save chart (SaveChartToStream) it does not save datasource for functions. So when I load same stream back datasource is lost.

Is datasource (Source Series) missing on TCurvefittingfuntion on export?

Code: Select all

  object TLineSeries
    Tag = 1
    Marks.Arrow.Visible = True
    Marks.Callout.Brush.Color = clBlack
    Marks.Callout.Arrow.Visible = True
    Marks.Visible = False
    Title = 'Series 1'
    LinePen.Width = 2
    Pointer.InflateMargins = True
    Pointer.Style = psRectangle
    Pointer.Visible = False
    XValues.DateTime = True
    XValues.Name = 'X'
    XValues.Order = loAscending
    YValues.Name = 'Y'
    YValues.Order = loNone
  end
  object TLineSeries
    Tag = 2
    Marks.Arrow.Visible = True
    Marks.Callout.Brush.Color = clBlack
    Marks.Callout.Arrow.Visible = True
    Marks.Visible = False
    Title = 'Curve fitting for Series1'
    Pointer.InflateMargins = True
    Pointer.Style = psRectangle
    Pointer.Visible = False
    XValues.DateTime = True
    XValues.Name = 'X'
    XValues.Order = loAscending
    YValues.Name = 'Y'
    YValues.Order = loNone
    YValues.ValueSource = 'Y'
    object TeeFunction1: TCurveFittingFunction
      Period = 1.000000000000000000
    end
  end
I'm using TeeChart Pro v8.03.11043 Win32 sources.

Any suggestions how to fix this, this makes functions useless after save (is it fixed on latest sources)?

Thanks,
JES

Posted: Thu May 08, 2008 3:10 pm
by narcis
Hi JES,

This works fine for me here. You may need to call CheckDataSource method after loading data, for example:

Code: Select all

Series2.CheckDataSource;
If problem persists please send us a simple example project we can run "as-is" to reproduce the problem here.

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.

Posted: Fri May 09, 2008 10:52 am
by 10548168
Hi,

I uploaded test project on your server (there is small document inside zip-file to explain what to do).

After save and load function datasource is empty (and function is not following parent trend).

Is there something missing in my code or... ?

Thanks,
JES
narcis wrote:Hi JES,

This works fine for me here. You may need to call CheckDataSource method after loading data, for example:

Code: Select all

Series2.CheckDataSource;
If problem persists please send us a simple example project we can run "as-is" to reproduce the problem here.

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.

Posted: Fri May 09, 2008 12:51 pm
by narcis
Hi JES,

Thanks for the example project, I have been able to reproduce the problem here now and added it (TV52013042) to our bug list to be fixed for next releases.

Posted: Fri May 09, 2008 1:07 pm
by narcis
Hi JES,

Just for completeness, this works fine for me here creating series and function at designtime. I'll send you the project thar works fine for me here.

Posted: Tue Sep 09, 2008 9:45 am
by Pep
H JES,

just inform you that the problem you reported about missing the DataSource exporting the Chart is not a bug. The problem is that , as you create all the series at runtime ( via code ) you have to set any name for each Series, if not, when you call the export, neither the Series name and Series DataSource are saved.
Using the following code should work fine :

Code: Select all

procedure TForm1.btnAddCurveClick(Sender: TObject);
var  ser:TLineSeries;
begin
  ser := TLineSeries.Create(DBChart1);
  ser.Name := 'Series2';
  ser.SetFunction(TCurveFittingFunction.Create(DBChart1));
  ser.datasource:=DBChart1.series[0];
  ser.CheckDataSource;
  DBChart1.AddSeries(ser);
end;

procedure TForm1.btnAddTrendClick(Sender: TObject);
var ser:TLineSeries;
begin
  DBChart1.RemoveAllSeries;
  ser := TLineSeries.Create(DBChart1);
  ser.Name := 'Series1';
  ser.FillSampleValues(50);
  DBChart1.AddSeries(ser);
end;