CalcIncrement problem

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Damian
Newbie
Newbie
Posts: 4
Joined: Thu May 12, 2005 4:00 am

CalcIncrement problem

Post by Damian » Tue Aug 30, 2005 2:33 pm

Hi,

I'm using Delphi 5 and TeeChart V7.04 Pro Vcl.

When I create a horizontal bar chart with values from 0 to 1 then the increment for bottom axis is calculated wrongly i.e. axis labels overlap.

To see the problem just create a new application, put Chart on the form and fill in OnCreate event:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
  bar: TChartSeries;
begin
  Chart1.Legend.Visible := False;
  bar := Chart1.AddSeries(THorizBarSeries);
  bar.Add(1.00, 'Bar 1', clRed);
  bar.Add(0.50, 'Bar 2', clBlue);
  bar.Add(0.75, 'Bar 3', clGreen);
  bar.Marks.Visible := False;
end;
I'd rather not change the Increment (to keep the axis in autoincrement mode).

Maybe someone knows a workaround.

Thanks.

Damian.

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

Post by Narcís » Tue Aug 30, 2005 3:05 pm

Hi Damian,

I've been able to reproduce that and added the issue to our defect list to be fixed for future releases. In the meantime you could use any of the workarounds in the code snippet below.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
  bar: TChartSeries;
begin
  Chart1.Legend.Visible := False;
  bar := Chart1.AddSeries(THorizBarSeries);
  With bar do
  begin
    Add(1.00, 'Bar 1', clRed);
    Add(0.50, 'Bar 2', clBlue);
    Add(0.75, 'Bar 3', clGreen);
    Marks.Visible := False;
  end;

  With Chart1.Axes.Bottom do
  begin
    //Workaround 1
    //LabelStyle:=talMark;

    //Workaround 2
    LabelsSeparation:=500;

    //Workaround 3
    //LabelsAngle:=90;
  end;
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

Damian
Newbie
Newbie
Posts: 4
Joined: Thu May 12, 2005 4:00 am

Post by Damian » Wed Aug 31, 2005 9:22 am

Hi Narcís

LabelsSeparation seems to be a pretty good workaraound.

Thanks a lot.

Damian.

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

Post by Narcís » Wed Aug 31, 2005 9:29 am

You're welcome Damian. I'm glad to hear this fits your needs.
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