TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
-
Narcís
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Tue May 12, 2009 7:54 am
Hi johnnix,
The fix I made works fine for me here using series which have YMandatory=true, for example:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var Bar:TBarSeries;
Line:TLineSeries;
begin
Bar:=TBarSeries.Create(self);
Chart1.AddSeries(Bar);
Bar.FillSampleValues(10);
Line:=TLineSeries.Create(self);
Chart1.AddSeries(Line);
With Line do
begin
SetFunction(TSmoothingFunction.Create(self));
DataSources.Clear;
DataSources.Add(Chart1[0]);
Title:='Smoothing';
end;
end;
Actually, I didn't change anything on this branch of the if statement, just changed the else branch.
Could you please check if code above works fine at your end? Could you please modify it so that we can reproduce the issue here?
BTW: In the project we have attached to the issue I've seen a THorizLineSeries is being used for the smoothing function. Using a horizontal series for plotting a function of a vertical series doesn't work fine. This may be the problem at you are having.
Thanks in advance.
-
johnnix
- Advanced
- Posts: 192
- Joined: Tue Jul 10, 2007 12:00 am
Post
by johnnix » Tue May 12, 2009 8:03 am
Hello Narcis,
This is my case exactly. I have 3 plots where I placed THorizLineSeries but for some strange reason one plot has YMandatory = false and the other 2 have YMandatory set to true. The latest piece of code I send you works ok for my project. In my free time I will check and see if my edit works ok in other Series types also.
Regards
-
Narcís
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Tue May 12, 2009 8:09 am
Hi johnnix,
Thanks for your feedback. If you can find a way to reproduce this in a consistent way please let us know. We are interested on any flaws this fix can have or other existent bugs.
Thanks in advance.
-
johnnix
- Advanced
- Posts: 192
- Joined: Tue Jul 10, 2007 12:00 am
Post
by johnnix » Tue May 12, 2009 8:24 am
Hello Narcis,
I just uploaded a test project for you to test in the attachments newsgroup. I copied the original charts I have from my project and I tested it with your code and as you may see the second chart does not calculate the smoothing line correctly. I guess that the smoothing technique should apply to YValues only? My edit works ok for me
Regards
-
Narcís
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Tue May 12, 2009 9:06 am
Hi johnnix,
The problem in your example project is that source series is horizontal but function series is vertical. You should not mix horizontal and vertical series for that.
Having said that, if you implement Button1Click in your project as shown below it will also work fine.
Code: Select all
procedure TForm10.Button1Click(Sender: TObject);
var tmpSeries: TChartSeries;
begin
chart6.Series[9].FillSampleValues(50);
chart7.Series[9].FillSampleValues(50);
tmpSeries:=chart7[8];
ChangeSeriesType(tmpSeries, THorizLineSeries);
end;
-
johnnix
- Newbie
- Posts: 5
- Joined: Mon Jun 18, 2007 12:00 am
Post
by johnnix » Tue May 12, 2009 10:52 am
Hello Narcis,
Thank you very much for your information!!!!! I will try to be more careful in the future.
Regards