Hello,
is there any way to insert in a LineSeries a NullValue if the value of a BarSeries is null? Both used similar ADOQuery as Datasource and the xChartValues.ValueSource are identical for both series.
If the ValueSource aren't from a Datasource the code can look like:
For i:= 0 to Barseries. XValues.count -1 do
if Barseries.isnull(i) then LineSeries.setnull(i,true);
your sincerely
Willi Ebert
TLineSeries and TBarSeries with DataSource := ADOQuery
-
- Newbie
- Posts: 28
- Joined: Tue Jan 15, 2008 12:00 am
- Contact:
-
- Newbie
- Posts: 28
- Joined: Tue Jan 15, 2008 12:00 am
- Contact:
Hello,
my first try was:
procedure TEpiMonitorForm.Series2BeforeDrawValues(Sender: TObject);
var xmin,xmax,i,x : integer;
hoehe : double;
alabel : string;
begin
xmin := round (Series1.MinXValue) ;
xmax := round(Series1.MaxXValue );
for x := xmin to xmax do
begin
hoehe := 0;
alabel := inttostr(x);
for i := 0 to Series1.Count - 1 do
if round(Series1.XValue ) = x then
begin
hoehe := Series1.YValue ;
alabel := inttostr(x);
end;
if hoehe = 0 then
begin
Series1.AddNullXY(x,0,alabel);
Series2.AddNullXY(x,0,alabel);
end;
end;
end;
This adds the right NullValues to Series2, but Series2. count is now highter than Series1.count. Some points of series2 are now not painted
Series1 is a TBarSeries with x and no., Series2 is a TlineSeries with x and mean duration
Here are the data:
Text X no. X mean duration
-4 -4 1 -4 0
96 96 33 96 3.675757576
97 97 35 97 3.617142857
98 98 35 98 3.888571429
99 99 0 99 0
100 100 0 100 0
101 101 19 101 3.605263158
102 102 38 102 3.434210526
The points (99,0) (100,0) are added with Series2.AddNullXY(x,0,alabel). The old points (101,3.605263158) and (102,3.434210526) of Series2 are now not drawn after I had added two new points.
Can you help me?
your sincerely
Willi Ebert
my first try was:
procedure TEpiMonitorForm.Series2BeforeDrawValues(Sender: TObject);
var xmin,xmax,i,x : integer;
hoehe : double;
alabel : string;
begin
xmin := round (Series1.MinXValue) ;
xmax := round(Series1.MaxXValue );
for x := xmin to xmax do
begin
hoehe := 0;
alabel := inttostr(x);
for i := 0 to Series1.Count - 1 do
if round(Series1.XValue ) = x then
begin
hoehe := Series1.YValue ;
alabel := inttostr(x);
end;
if hoehe = 0 then
begin
Series1.AddNullXY(x,0,alabel);
Series2.AddNullXY(x,0,alabel);
end;
end;
end;
This adds the right NullValues to Series2, but Series2. count is now highter than Series1.count. Some points of series2 are now not painted
Series1 is a TBarSeries with x and no., Series2 is a TlineSeries with x and mean duration
Here are the data:
Text X no. X mean duration
-4 -4 1 -4 0
96 96 33 96 3.675757576
97 97 35 97 3.617142857
98 98 35 98 3.888571429
99 99 0 99 0
100 100 0 100 0
101 101 19 101 3.605263158
102 102 38 102 3.434210526
The points (99,0) (100,0) are added with Series2.AddNullXY(x,0,alabel). The old points (101,3.605263158) and (102,3.434210526) of Series2 are now not drawn after I had added two new points.
Can you help me?
your sincerely
Willi Ebert
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Willi Ebert,
Could you 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.
Could you 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.
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 |
-
- Newbie
- Posts: 28
- Joined: Tue Jan 15, 2008 12:00 am
- Contact:
Hello,
i have uploaded a demo test.zip. Like in your demo the link to the file with the data is c:\test2.txt. We use Delphi 7 sp1 with TeeChart Pro V8. If the routine added the new points in Series2.BeforeDrawValues the error exists (three ponts of series1 are not drawn). If the points are added manually with Button1Click series1 is ok.
your sincerely
Willi Ebert
i have uploaded a demo test.zip. Like in your demo the link to the file with the data is c:\test2.txt. We use Delphi 7 sp1 with TeeChart Pro V8. If the routine added the new points in Series2.BeforeDrawValues the error exists (three ponts of series1 are not drawn). If the points are added manually with Button1Click series1 is ok.
your sincerely
Willi Ebert
Hi Willi,
as you're using the AddNullXY method, the correct way would be to do it after the points has been added (for example into the OnAfterDraw event), instead of the OnBeforeDrawSeries event.
It works fine with :
In case you want to use the OnBeforeDrawEvent, you could se the point as null by using the SetNull method :
as you're using the AddNullXY method, the correct way would be to do it after the points has been added (for example into the OnAfterDraw event), instead of the OnBeforeDrawSeries event.
It works fine with :
Code: Select all
procedure TForm1.Chart2AfterDraw(Sender: TObject);
var xmin,xmax,i,x : integer;
hoehe : double;
alabel : string;
begin
xmin := round (Series1.MinXValue) ;
xmax := round(Series1.MaxXValue );
for x := xmin to xmax do
begin
hoehe := 0;
alabel := inttostr(x);
for i := 0 to Series1.Count - 1 do
if round(Series1.XValue [i]) = x then
begin
hoehe := Series1.YValue [i];
alabel := inttostr(x);
end;
if hoehe = 0 then
begin
Series1.AddNullXY(x,0,alabel);
Series2.AddNullXY(x,0,alabel);
end;
end;
end;
Code: Select all
procedure TForm1.Series2BeforeDrawValues(Sender: TObject);
var xmin,xmax,i,x : integer;
hoehe : double;
alabel : string;
begin
xmin := round (Series1.MinXValue) ;
xmax := round(Series1.MaxXValue );
for x := xmin to xmax do
begin
hoehe := 0;
alabel := inttostr(x);
for i := 0 to Series1.Count - 1 do
if round(Series1.XValue [i]) = x then
begin
hoehe := Series1.YValue [i];
alabel := inttostr(x);
end;
if hoehe = 0 then
begin
Series1.setnull(x,true);
Series2.setnull(x,true);
end;
end;
end;
Pep Jorge
http://support.steema.com
http://support.steema.com
-
- Newbie
- Posts: 28
- Joined: Tue Jan 15, 2008 12:00 am
- Contact: