Page 1 of 1

custom levels in contour series in VCL

Posted: Fri Mar 31, 2006 4:04 pm
by 9237980
I just cannot get custom levels to work in contour series in the vcl. I've looked at the sample code in the demo. In fact the demo exe throws the same access errror exception. The workaround given in the forum for the .NET version ( drawing the contours with autolevels and then re-drawing with custom levels ) doesn't work in VCL. I'm trying this with the simplest possible testbed- a form with a single chart and random data fill.
Part of the problem may be that I cannot change the boolean value of autolevels at runtime - the instruction is ignored! ( verified in the debugger ). I can set custom levels at design time but this is obviously of no use. A further clue .. I can READ the uptovalue's without an access error but cannot write to them.

Posted: Mon Apr 03, 2006 8:21 am
by narcis
Hi ditto,

It works fine for me here using the code below (the same as in the demo example). Which TeeChart version are you using? Which error message do you get?

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.FillSampleValues(20);
  AddCustomLevels;
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
  Series1.AutomaticLevels:=not CheckBox1.Checked;
  if not Series1.AutomaticLevels then AddCustomLevels;
end;

Procedure TForm1.AddCustomLevels;
begin
  Series1.NumLevels:=10;
  Series1.CreateAutoLevels;
  With Series1.Levels do
  begin
    Items[0].UpToValue:=-1;
    Items[1].UpToValue:=-0.8;
    Items[2].UpToValue:=-0.6;
    Items[3].UpToValue:=-0.4;
    Items[4].UpToValue:=-0.2;
    Items[5].UpToValue:= 0;
    Items[6].UpToValue:= 0.2;
    Items[7].UpToValue:= 0.4;
    Items[8].UpToValue:= 0.6;
    Items[9].UpToValue:= 0.8;
  end;
end;

Posted: Mon Apr 03, 2006 2:56 pm
by 9237980
Here's my code. I'm using TeeChart 7.05 for Builder 6. I get an access error on read at the line containing Items[0].
The stack shows the error to be in Repaint. I'm running winxp pro with 2G of ram but the error is present on computers with different processor/ram configurations.

If I run your Tee7New.exe in the Examples folder of the distribution and go to "all features/chart styles/extended/contour/custom levels", I get the same access error. I get similar errors in the "smooth segments" example. Again, these errors occur on various machines.


//---------------------------------------------------------------------------
void __fastcall TForm1::AddCustomLevels()
{
Series1->NumLevels = 10;
Series1->CreateAutoLevels();
Series1->Levels->Items[0]->UpToValue = -1.0;
Series1->Levels->Items[1]->UpToValue = -0.8;
Series1->Levels->Items[2]->UpToValue = -0.6;
Series1->Levels->Items[3]->UpToValue = -0.4;
Series1->Levels->Items[4]->UpToValue = -0.2;
Series1->Levels->Items[5]->UpToValue = 0.0;
Series1->Levels->Items[6]->UpToValue = 0.2;
Series1->Levels->Items[7]->UpToValue = 0.4;
Series1->Levels->Items[8]->UpToValue = 0.6;
Series1->Levels->Items[9]->UpToValue = 0.8;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Series1->FillSampleValues(20);
AddCustomLevels();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::CheckBox1Click(TObject *Sender)
{
Series1->AutomaticLevels = !CheckBox1->Checked;
if (!Series1->AutomaticLevels) AddCustomLevels();
}
//---------------------------------------------------------------------------

Posted: Mon Apr 10, 2006 1:09 pm
by narcis
Hi ditto,

Thanks for the information. We have been able to reproduce the issue here. It happens using all BCB versions, not in Delphi. I've added it (TV52011361) to our defect list to be fixed for future releases.