Page 1 of 1
Can I adjust TeeChart's y-axis like this attachment?
Posted: Mon Jul 13, 2009 5:53 am
by 9244052
when i have data like attachment image
can i adjust y - axis value like chart below?
i need that the space between value 300 and 800 is displayed rather upper chart than bottom.
TeeChart has some property that i could do?
Re: Can I adjust TeeChart's y-axis like this attachment?
Posted: Mon Jul 13, 2009 8:36 am
by yeray
Hi HCLab,
The easiest solution could be using a custom axis to separate the two parts. The above with the default left axis and the below part with the custom axis. This could be an example:
Code: Select all
uses series;
procedure TForm1.FormCreate(Sender: TObject);
var i, j: Integer;
begin
Chart1.View3D := false;
for i:=0 to 2 do
begin
Chart1.AddSeries(TFastLineSeries.Create(self));
if i <> 2 then
begin
Chart1[i].Add(random*300+800);
for j:=1 to 25 do
Chart1[i].Add(random*50 + Chart1[i].YValue[j-1] - 25);
end
else
for j:=0 to 25 do
Chart1[i].Add(200);
end;
Chart1.CustomAxes.Add;
Chart1[2].CustomVertAxis := Chart1.CustomAxes.Items[0];
Chart1.Axes.Left.EndPosition := 59;
Chart1.CustomAxes.Items[0].StartPosition := 61;
end;
Re: Can I adjust TeeChart's y-axis like this attachment?
Posted: Mon Jul 13, 2009 9:01 am
by 9244052
Thanks you Yeray.
Im gonna try with it.
Hav nice day :3
Re: Can I adjust TeeChart's y-axis like this attachment?
Posted: Tue Jul 14, 2009 4:29 am
by 9244052
Code: Select all
Chart1.Axes.Left.EndPosition := 59;
Chart1.CustomAxes.Items[0].StartPosition := 61;
end;
Thanks for your reply but I cant understand what this codes means ...
Can you Explain what these property means ?
I cant read Teechart Help File on Vista ...
Re: Can I adjust TeeChart's y-axis like this attachment?
Posted: Tue Jul 14, 2009 9:46 am
by yeray
Hi HCLab,
You can download
WinHlp32.exe for Windows Vista from microsoft website to continue viewing hlp files.
Here is what the help says:
TChartAxis.StartPosition wrote:property StartPosition: Double;
Unit
TeEngine
Description
Default = 0
The StartPosition property defines the position, as a percentage of Chart width or height (depending on whether it is applied to a Horizontal Axis or a Vertical Axis) of the Start position of the Axis to which it is applied. Left and Top are 0,0 positions.
Use with PositionPercent and EndPosition properties to define the Axis position on a Chart.
TChartAxis.EndPosition wrote:property EndPosition: Double;
Unit
TeEngine
Description
Default = 0
The EndPosition property defines the position, as a percentage of Chart width or height (depending on whether it is applied to a Horizontal Axis or a Vertical Axis) of the End position of the Axis to which it is applied. Left and Top are 0,0 positions.
Use with StartPosition and PositionPercent properties to define the Axis position on a Chart.
TChartAxis.PositionPercent wrote:property PositionPercent: Double;
Unit
TeEngine
Description
Default = 0
The PositionPercent property defines the position, (as a percentage of Chart width or height or as pixels) (depending on whether it is applied to a Horizontal Axis or a Vertical Axis) of the Position of the Axis to which it is applied.
Left and Top axis are at 0,0 positions.
Use with StartPosition and EndPosition properties to define the Axis position on a Chart.
You may use these properties with default and additional Axis, see the example below:
Example - Create a Custom Axis
Code: Select all
//Creates a new Vertical Axis and defines a position for it.
procedure TForm1.BitBtn2Click(Sender: TObject);
Var MyAxis : TChartAxis ;
begin
MyAxis := TChartAxis.Create( Chart1 );
Series2.CustomVertAxis := MyAxis;
//You can modify any property of the new created axes, such as the axis color or axis title
With MyAxis do
begin
Axis.Color:=clGreen ;
Title.Caption := 'Extra axis' ;
Title.Font.Style:=[fsBold];
Title.Angle := 90;
PositionPercent := 20; //percentage of Chart rectangle
StartPosition:=50;
EndPosition:=100;
end;
end;
Re: Can I adjust TeeChart's y-axis like this attachment?
Posted: Tue Jul 14, 2009 10:21 am
by 9244052
Thank you very much
It was very useful comment :3