TeeChart 7 VCL and nulls

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
betterbyte
Newbie
Newbie
Posts: 1
Joined: Fri Nov 15, 2002 12:00 am

TeeChart 7 VCL and nulls

Post by betterbyte » Sat Mar 06, 2004 11:27 pm

Hi,
Can you please tell me if Teechart 7 VCL for Delphi Pro 6 displays values that are null as zeros in the charts, or has this been fixed?

Thanks.
pl

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Mon Mar 08, 2004 9:54 pm

Hi.
eros in the charts, or has this been fixed?
I'm affraid not as you'd like it <gg>. The values are ommited, but internally they are still treated as normal points with color set to clNone. One problem which migt arise is the automatic axis range might be wrong if null points are in series. For this case, the following workaround can be used:

Code: Select all

procedure NoNullsMinMax(Series: TChartSeries);
var i: Integer;
  aminx, amaxx: double;
  aminy, amaxy: double;
begin
  aminx := Series.MaxXValue;
  amaxx := Series.MinXValue;
  aminy := Series.MaxYValue;
  amaxy := Series.MinYValue;
  for i := 0 to Series.Count -1 do
    if Not (Series.IsNull(i)) then
    begin
      if Series.XValue[i] < aminx then aminx := Series.XValue[i];
      if Series.XValue[i] > amaxx then amaxx := Series.XValue[i];
      if Series.YValue[i] < aminy then aminy := Series.YValue[i];
      if Series.YValue[i] > amaxy then amaxy := Series.YValue[i];
    end;
  Series.GetHorizAxis.SetMinMax(aminx,amaxx);
  Series.GetVertAxis.SetMinMax(aminy,amaxy);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.Add(10);
  Series1.Add(3);
  Series1.AddNull;
  Series1.Add(5);
  Series1.Add(7);
  NoNullsMinMax(Series1);
end;
Hopefully we'll be able to implement something similar in next maintenance release.
Marjan Slatinek,
http://www.steema.com

Post Reply