Page 1 of 1

CalcIncrement problem

Posted: Tue Aug 30, 2005 2:33 pm
by 9341865
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.

Posted: Tue Aug 30, 2005 3:05 pm
by narcis
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;

Posted: Wed Aug 31, 2005 9:22 am
by 9341865
Hi NarcĂ­s

LabelsSeparation seems to be a pretty good workaraound.

Thanks a lot.

Damian.

Posted: Wed Aug 31, 2005 9:29 am
by narcis
You're welcome Damian. I'm glad to hear this fits your needs.