Page 1 of 1

method Clear() on Series does not work

Posted: Thu May 28, 2009 2:04 pm
by 8574811
I am using C++Builder6 and TeeChartPro6 for Builder6.

I have a problem using the Clear() method on a Series : it does not work.
The Series is never cleared.
If I try to add new Values after clearing the Series, I have the old values + the new values.

Delete() does not work either.

There is something wrong but I dont know where.

Thanks for your help.

Following very simple code with a button that clear the Series and Add new Values.

//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
Series1->Clear();

for(int i=0;i<8;i++) {
Series1->AddBar(random(20), i ,clBlue);
}

}

Thanks,

Bernard.

Posted: Thu May 28, 2009 2:25 pm
by yeray
Hi Bernard,

I've tested with the following code and everything seems to work as expected. Could you please try it?

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
    series1: TBar3DSeries;
begin
  series1 := TBar3DSeries.Create(self);
  Chart1.AddSeries(series1);

  for i:=1 to 50 do
    Series1.AddBar(random(20),i,clBlue);

  Series1.Clear;

  for i:=1 to 3 do
    Series1.AddBar(random(20),i,clBlue);
end;