0
votes

I use Teechart pro VCL v2018.24.18 32bit. I wrote some code that plots a chart from input data, which the user can save in a file or DB.

I have one problem, however. This process may be repeated several times, and I need create a new project. I reset the series value before receiving new input data:

 if DbChart1.SeriesCount <> 0 then     // clear all series data
 begin
   for dp := 0 to DbChart1.SeriesCount-1   do
   begin
      DbChart1.Series[dp].Clear;
      DbChart1.Series[dp].XValues.FillSequence;
      DbChart1.Series[dp].YValues.FillSequence;
      dbchart1.Series[dp].CleanupInstance;
   end;
 end;
  Dbchart1.BottomWall.EndPosition := 0;
  Dbchart1.LeftWall.EndPosition := 0;
  Dbchart1.DepthAxis.Maximum := 0;

All series points have been removed except the last point! I want the serial to be clean, like the first time the program ran. How do I do this?

1
What isFillSequence intended for ? - MBo
I use it according to some tips. i think it can renumber points - siavosh1
It's enough ti make Clear, seems other operations are redundant - MBo
when i click on button this code clear the chart but after that i want to receive data for the second or third time the last point of previous data is still here - siavosh1
OK, perhaps receiving data gives such behaviour? - MBo

1 Answers

0
votes

problem solved. the last point in series do not remove ( why ? maybe a Bug ).at the first i use another codes for remove points but problem not solved. look at this codes :

With Dbchart1.Series[0] Do
Begin
   dec:=series0.Count;
   if dec<>0 then
   begin
      Series0.Delete(0,dec,true);
   end;
End;

but with repeat the codes the problem solved :

With Dbchart1.Series[0] Do
Begin
   dec:=series0.Count;
   label44.Caption := inttostr(dec);
   if dec<>0 then
   begin
      Series0.Delete(0,dec,true);
      dec:=series0.Count;
      Series0.Delete(0,dec,true);
   end;
End;