Page 1 of 1

TChartShape and automatic scale

Posted: Tue Jun 29, 2010 7:36 am
by 16556067
Hello,

I have a TChart composed of a few TLineSeries and using automatic scaling. I added a TChartShape serie, set X0-1/Y0-1 to the correct values but the bottom axis range is now 0-3000 instead of 2600-3000 before I added the TChartShape.

Am I missing something ? Do I need to force the scale ?

Re: TChartShape and automatic scale

Posted: Wed Jun 30, 2010 9:43 am
by yeray
Hi Ael,

Note that the axes will be auto scaled to show both the shape series and the line series completely.
The following code seems to work fine here:

Code: Select all

uses Series, TeeShape;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Chart1.View3D:=false;
  Chart1.AddSeries(TLineSeries);

  Chart1[0].AddXY(2600,random*100);
  for i:=1 to 400 do
    Chart1[0].AddXY(2600+i,Chart1[0].YValue[i-1] + random*10 - 5);

  with Chart1.AddSeries(TChartShape) as TChartShape do
  begin
    X0:=Chart1[0].XValues.MinValue;
    X1:=Chart1[0].XValues.MaxValue;
    Y0:=Chart1[0].YValues.MinValue;
    Y1:=Chart1[0].YValues.MaxValue;
    Transparency:=50;
  end;
end;