Logarithmic Axis labels overlaps

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
fnn
Newbie
Newbie
Posts: 10
Joined: Fri Nov 15, 2002 12:00 am

Logarithmic Axis labels overlaps

Post by fnn » Thu Feb 23, 2006 7:57 am

Fill a candle series as below:

var
i:integer;
h,cl,open,low:double;
begin

for i:=0 to 600 do
begin
low:=1+i/100;
open:=low+0.2;
cl:=low+0.4;
h:=cl+0.2;
series1.AddCandle(date+i,open,h,low,cl);
end;

LeftAxis.Logarithmic is true;
Also min and max is auto.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Feb 23, 2006 10:10 am

Hello,

I've been able to reproduce this issue when scrolling down the series and added the defect (TV52011275) to our bug list to be fixed for future releases. Can you please confirm this is the behaviour you get?

In the meantime, you can solve that problem by not displaying all labels using OnGetAxisLabel event and something like this:

Code: Select all

var
  Form1: TForm1;
  count: Integer;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
  i:integer;
  h,cl,open,low:double;
begin
  for i:=0 to 600 do
  begin
    low:=1+i/100;
    open:=low+0.2;
    cl:=low+0.4;
    h:=cl+0.2;
    series1.AddCandle(date+i,open,h,low,cl);
  end;

  Chart1.Axes.Left.Logarithmic:=true;

  count:=0;
end;

procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis;
  Series: TChartSeries; ValueIndex: Integer; var LabelText: String);
begin
  if ((Sender=Chart1.Axes.Left) and
      ((count mod 2=0) or (count mod 3=0) or (count mod 5=0))) then
    LabelText:='';

  inc(count);
end;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

fnn
Newbie
Newbie
Posts: 10
Joined: Fri Nov 15, 2002 12:00 am

Logarithmic Labels overlaps

Post by fnn » Thu Feb 23, 2006 11:08 am

Problem occurs in

TChartAxis.CalcLabelsIncrement


if LabelsSeparation>0 then
Repeat
tmp:=IRange/result;
if Abs(tmp)<MaxLongint then
begin
{ TempNumLabels:=Round(tmp);
if TempNumLabels>MaxNumLabels then
if Logarithmic then
result:=result*LogarithmicBase
else
result:=TeeNextStep(result);
}
TempNumLabels:=Round(tmp);
if TempNumLabels>MaxNumLabels then
if Logarithmic then
result:=result*LogarithmicBase
else
result:=TeeNextStep(result);

end
else
if Logarithmic then
result:=result*LogarithmicBase
else
result:=TeeNextStep(result);

tmpInf:=IsInfinite(result);

Until (TempNumLabels<=MaxNumLabels) or (result>IRange) or tmpInf;
{
let FDesiredIncrement =0.01
let LogarithmicBase=10

CalcLabelsIncrement may result in 10 multiple of FDesiredIncrement
So CalcLabelsIncrement may result 10 times less or more.
and labels' frequency 10 times more or less.

}

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Feb 23, 2006 3:09 pm

Hello,

Thanks for your suggestion. I've added it to the issue I opened to be considered.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply