assigning series to customaxis at runtime

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Messie
Newbie
Newbie
Posts: 34
Joined: Wed Apr 13, 2005 4:00 am
Location: Goettingen, Germany

assigning series to customaxis at runtime

Post by Messie » Wed Nov 14, 2007 9:52 am

Hi,

I have a Chart axis added at runtime. Now I fail to assign a series to this axis:
procedure TForm1.TntButton1Click(Sender: TObject);
begin
ca := TChartAxis.Create(Chart1);
ca.Visible := true;
ca.Automatic := true;
ca.Horizontal := true;
ca.PositionPercent := 30;
ca.StartPosition := 20;
ca.EndPosition := 80;
//available Series from designtime
Series1.HorizAxis := THorizAxis(ca);
end;
Is suggest the cast does not work but I saw no alternative while I cannot create a custom THorizAxis at runtime.

Thanks, Messie

bertrod
Advanced
Posts: 151
Joined: Wed Sep 07, 2005 4:00 am

Post by bertrod » Wed Nov 14, 2007 9:58 am

Why you don't use

Code: Select all

ca := THorizAxis.Create(Chart1); 
?

I think creating a TChartAxis creates a vertical axis, and then you cannot assign it as a horizontal axis.

Messie
Newbie
Newbie
Posts: 34
Joined: Wed Apr 13, 2005 4:00 am
Location: Goettingen, Germany

Post by Messie » Wed Nov 14, 2007 10:18 am

Because THorizAxis is a type used for settings propertys
type THorizAxis = (aTopAxis, aBottomAxis, aBothHorizAxis, aCustomHorizAxis);

Unit
TeEngine

Description
Type describes Horizontal Axis type.

See also:
TChartSeries.HorizAxis
TChartSeries.HorizAxis is not the same as setting the "Horizontal Axis" in the Chart Editor. I need the way to set the horizontal axis according to the ChartEditor.

Messie

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 Nov 14, 2007 11:05 am

Hi Messie,

It seems to me you need to do this

Code: Select all

  Series1.CustomHorizAxis:=ca;
As you can see in Tutorial 4 - Axis Control, specially in the Multiple Custom axes section.

You'll find the tutorials at TeeChart's program group.
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