Page 1 of 1

TeeChart 7 VCL and nulls

Posted: Sat Mar 06, 2004 11:27 pm
by 8438597
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

Posted: Mon Mar 08, 2004 9:54 pm
by Marjan
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.