Modifying Series in TDBChart
Modifying Series in TDBChart
Hello,
I use Teechart Pro 7.12 VCL and I have a TDBChart connected to a DB.
If I want to display the values of the DB for example in p.u. I have to divide each y-value by a certain constant.
How can I do this?
thanks + regards
Reinhard
I use Teechart Pro 7.12 VCL and I have a TDBChart connected to a DB.
If I want to display the values of the DB for example in p.u. I have to divide each y-value by a certain constant.
How can I do this?
thanks + regards
Reinhard
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Reinhard,
Sorry but I don't understand what are you trying to achieve exactly. You could try doing something like the code below after populating your series.
If that's not what you are looking for please give us some more details about your requirement.
Thanks in advance.
Sorry but I don't understand what are you trying to achieve exactly. You could try doing something like the code below after populating your series.
Code: Select all
for i:=0 to Series1.Count-1 do
begin
Series1.YValue[i] := Series1.YValue[i] / MyConst;
end;
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Hi Reinhard,
what about using the OnBeforeDrawValues event :
?
Another way would be to add the data values directly to your series by iterating through your Dataset by using the AddXY method. This way you will be able to add the modified data values too.
what about using the OnBeforeDrawValues event :
Code: Select all
procedure TForm1.Series1BeforeDrawValues(Sender: TObject);
var i : integer;
begin
for i:=0 to Series1.Count do
Series1.YValue[i] := Series1.YValue[i] - (Series1.YValue[i] / 2);
end;
Another way would be to add the data values directly to your series by iterating through your Dataset by using the AddXY method. This way you will be able to add the modified data values too.
Pep Jorge
http://support.steema.com
http://support.steema.com
Hi, Pep!
What you suggested is a recursive scheme.
Don't you think such approach will result in dissapearing the whole series after several iterations with, say, zoom-unzoom?
What you suggested is a recursive scheme.
Don't you think such approach will result in dissapearing the whole series after several iterations with, say, zoom-unzoom?
Regards, Alexander
=================
TeeChart Pro v8.05, Delphi 5 & Turbo Delphi Professional for Win32., Delphi & C++Builder 2009
=================
TeeChart Pro v8.05, Delphi 5 & Turbo Delphi Professional for Win32., Delphi & C++Builder 2009
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Alexander,
No, I don't think so if axes are set to automatic as they would automatically set their scales according to series values.
No, I don't think so if axes are set to automatic as they would automatically set their scales according to series values.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Hi, Narcís!
I meant
I meant
Code: Select all
limit ( Series1.YValue[i]) -> 0
Regards, Alexander
=================
TeeChart Pro v8.05, Delphi 5 & Turbo Delphi Professional for Win32., Delphi & C++Builder 2009
=================
TeeChart Pro v8.05, Delphi 5 & Turbo Delphi Professional for Win32., Delphi & C++Builder 2009
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Alexander,
Yes, that's what I understood as well. However, if you divide all series points by the same ratio the ratio between them will be preserved too. So, if instead of being from 0 to 100 it's from 0 to 0.0001, axes will be automatically scaled to represent this.
Moreover, if Reinhard only wants this to happen the very first time the series are plotted then he could use a boolean flag to determine whether this code should be executed or not.
Yes, that's what I understood as well. However, if you divide all series points by the same ratio the ratio between them will be preserved too. So, if instead of being from 0 to 100 it's from 0 to 0.0001, axes will be automatically scaled to represent this.
Moreover, if Reinhard only wants this to happen the very first time the series are plotted then he could use a boolean flag to determine whether this code should be executed or not.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Thanks Narcis, I appreciate your valuable comments.narcis wrote:Hi Alexander,
Yes, that's what I understood as well. However, if you divide all series points by the same ratio the ratio between them will be preserved too. So, if instead of being from 0 to 100 it's from 0 to 0.0001, axes will be automatically scaled to represent this.
Moreover, if Reinhard only wants this to happen the very first time the series are plotted then he could use a boolean flag to determine whether this code should be executed or not.
In't it possible to use OnAfterAdd event for scaling Series?
Regards, Alexander
=================
TeeChart Pro v8.05, Delphi 5 & Turbo Delphi Professional for Win32., Delphi & C++Builder 2009
=================
TeeChart Pro v8.05, Delphi 5 & Turbo Delphi Professional for Win32., Delphi & C++Builder 2009
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Alexander,
OnAfterAdd event doesn't work, you could do that in the chart's OnAfterDraw event, for example:
OnAfterAdd event doesn't work, you could do that in the chart's OnAfterDraw event, for example:
Code: Select all
procedure TForm1.Chart1AfterDraw(Sender: TObject);
var i : integer;
begin
for i:=0 to Series1.Count do
Series1.YValue[i] := Series1.YValue[i] - (Series1.YValue[i] / 2);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.Draw;
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |