Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 324 - [TV52015501] The TColorGridSeries's CreateAutoLevels method seesm to work differen...
Summary: [TV52015501] The TColorGridSeries's CreateAutoLevels method seesm to work dif...
Status: IN_PROGRESS
Alias: None
Product: VCL TeeChart
Classification: Unclassified
Component: Other Components (show other bugs)
Version: unspecified
Hardware: All All
: High major
Target Milestone: ---
Assignee: Steema Issue Manager
URL:
Keywords:
: 121 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-04-15 12:44 EDT by yeray alonso
Modified: 2014-04-22 07:06 EDT (History)
2 users (show)

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yeray alonso 2013-11-20 10:38:33 EST
The TColorGridSeries's CreateAutoLevels method seesm to work different in C++ than in Delphi.
In Delphi one can do as in the demo:
uses TeeSurfa;
procedure TForm1.FormCreate(Sender: TObject);
var ContourSer: TContourSeries;
begin
  Chart1.View3D:=false;
  ContourSer:=Chart1.AddSeries(TContourSeries) as TContourSeries;
  ContourSer.FillSampleValues;
  ContourSer.NumLevels:=10;
  ContourSer.CreateAutoLevels;
  Caption:='num Levels: ' + IntToStr(ContourSer.Levels.Count);
  With ContourSer.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;
But in C++Builder the CreateAutoLevels seems to create no levels and the Items or the Count gives error for me even when the customer says Count gives 0 for him:
At the .h:
#include "TeeSurfa.hpp"
private:	// User declarations
	TContourSeries *ContourSer;

At the .cpp
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  Chart1->View3D=false;
  ContourSer=new TContourSeries(this);
  Chart1->AddSeries(ContourSer);
  ContourSer->FillSampleValues();
  ContourSer->NumLevels=10;
  ContourSer->CreateAutoLevels();
  int c=ContourSer->Levels->Count;
  ContourSer->Levels->Items[0]->UpToValue=-1;
  ContourSer->Levels->Items[1]->UpToValue=-0.8;
  ContourSer->Levels->Items[2]->UpToValue=-0.6;
  ContourSer->Levels->Items[3]->UpToValue=-0.4;
  ContourSer->Levels->Items[4]->UpToValue=-0.2;
  ContourSer->Levels->Items[5]->UpToValue=0;
  ContourSer->Levels->Items[6]->UpToValue=0.2;
  ContourSer->Levels->Items[7]->UpToValue=0.4;
  ContourSer->Levels->Items[8]->UpToValue=0.6;
  ContourSer->Levels->Items[9]->UpToValue=0.8;
}
http://www.teechart.net/support/viewtopic.php?f=3&t=12265 [created:2011-04-15T11:44:08.000+01:00 reported by:yeray@steema.com reported in version:2011.03.30407 (TeeChart VCL)]
Comment 1 david berneda 2013-11-26 05:25:26 EST
Just tested with XE4 C++ and latest sources.
The problem can be fixed by changing this line at top of VCLTee.TeeSurfa.hpp:

OLD:   #pragma pack(push,8)

NEW:   #pragma pack(push,4)


So its a code alignment problem, but don't know why it happens.
All the rest of Delphi units (and their hpp headers) specify 8 bytes global alignment (Quad Word) with no problem.  So why is TContourSeries getting compiled (supposedly by dcc32) with align 4 ?
Comment 2 david berneda 2013-12-19 13:10:02 EST
*** Bug 121 has been marked as a duplicate of this bug. ***