Hi,
If I do the following things :
- put a new TeeChart (version 6.01 pro) on a form
- add a new point series to this TeeChart, with only two points which coordinates are (2, 2) and (5, 5)
When I execute my program and look at my chart, on the left axis I see a lot of axis values (2, 2.2, 2.4, 2.6, 2.8, 3, 3.2 ... 5) but on the bottom axis, I only see a few values (2, 3, 4 and 5). Why the two axis have not the same behaviour ?
How can I see more values on my bottom axis, especially after having doing a zoom (after a zoom, often I don't see any value on the bottom axis, whereas I see plenty of them on the left one) ?
Thank you for any help,
Verane.
Axis values display is different betwen left and bottom axis
Hi Verane,
>How can I see more values on my bottom axis, especially after having >doing a zoom (after a zoom, often I don't see any value on the bottom >axis, whereas I see plenty of them on the left one) ?
This can be changed setting an increment for the bottom axis like :
Chart1.Axes.bottom.Increment := 0.1;
>How can I see more values on my bottom axis, especially after having >doing a zoom (after a zoom, often I don't see any value on the bottom >axis, whereas I see plenty of them on the left one) ?
This can be changed setting an increment for the bottom axis like :
Chart1.Axes.bottom.Increment := 0.1;
Pep Jorge
http://support.steema.com
http://support.steema.com
Hi,
I have tried to do what Pep suggested, but I still have some problems.
If I set an increment of 0.1, it is not precise enough when I zoom very deep. But If I put a smaller increment (0.001 for example), label values are overlaping on my bottom axis.
I think that what I need is that the increment adapts to the current zoom.
To achieve this, I tried to change the increment in the OnAfterDraw event with code like that :
procedure TForm1.FormCreate(Sender: TObject);
begin
Series2.Pointer.Style := psTriangle;
Series2.Pointer.HorizSize := 6;
Series2.Pointer.VertSize := 6;
Series2.Pointer.Pen.Color := clRed;
Series2.AddXY(2,2,'',clRed);
Series2.AddXY(3,3);
Series2.AddXY(4,4);
Series2.AddXY(5,5);
OrlandoChart1.OnAfterDraw := AfterDrawOrlandoChart;
With OrlandoChart1.BottomAxis do
begin
Automatic := False ;
Maximum:= 5 ;
Minimum:= 0 ;
end;
end;
procedure TForm1.AfterDrawOrlandoChart(Sender: TObject);
begin
With OrlandoChart1.BottomAxis do
begin
increment := (Maximum - Minimum) / 10;
end;
end;
The result is almost what I want except one thing :
if I zoom on my chart and then undo zoom (by double clicking on the chart) to go back to the largest scale, bottom axis label are overlaping a lot. If I then double click a second time, the scale does not change (it was already the largest possible), but the label overlap disappears.
I would like to have this result the first time I double click...
Is there something wrong in my code ? Or is this a bug of the teeChart ??
Is there another way to achieve what I want to do ??
Thank you by advance,
Verane.
I have tried to do what Pep suggested, but I still have some problems.
If I set an increment of 0.1, it is not precise enough when I zoom very deep. But If I put a smaller increment (0.001 for example), label values are overlaping on my bottom axis.
I think that what I need is that the increment adapts to the current zoom.
To achieve this, I tried to change the increment in the OnAfterDraw event with code like that :
procedure TForm1.FormCreate(Sender: TObject);
begin
Series2.Pointer.Style := psTriangle;
Series2.Pointer.HorizSize := 6;
Series2.Pointer.VertSize := 6;
Series2.Pointer.Pen.Color := clRed;
Series2.AddXY(2,2,'',clRed);
Series2.AddXY(3,3);
Series2.AddXY(4,4);
Series2.AddXY(5,5);
OrlandoChart1.OnAfterDraw := AfterDrawOrlandoChart;
With OrlandoChart1.BottomAxis do
begin
Automatic := False ;
Maximum:= 5 ;
Minimum:= 0 ;
end;
end;
procedure TForm1.AfterDrawOrlandoChart(Sender: TObject);
begin
With OrlandoChart1.BottomAxis do
begin
increment := (Maximum - Minimum) / 10;
end;
end;
The result is almost what I want except one thing :
if I zoom on my chart and then undo zoom (by double clicking on the chart) to go back to the largest scale, bottom axis label are overlaping a lot. If I then double click a second time, the scale does not change (it was already the largest possible), but the label overlap disappears.
I would like to have this result the first time I double click...
Is there something wrong in my code ? Or is this a bug of the teeChart ??
Is there another way to achieve what I want to do ??
Thank you by advance,
Verane.
Hi Verane,
which code are you using in the DblClick event ? Maybe is a repaint problem ?
which code are you using in the DblClick event ? Maybe is a repaint problem ?
Pep Jorge
http://support.steema.com
http://support.steema.com
Hi,
In fact we have herited the TChart to create a custom component. When doing a dbl click on this custom component, it is the same behaviour as doing a 'undozoom' with the mouse (by dragging the mouse from bottom right to up left).
So I have made the same test as described previously with a original TChart (and not our custom version), and instead of doing a dble click, I do a 'undozoom' as explained before.
I always see the same problem (overlaping on bottom axis).
Do you want me to send you a sample code to show you this ?
My project is very simple. Just a TChart and the code mentionned on my previous post.
Regards,
Verane.
In fact we have herited the TChart to create a custom component. When doing a dbl click on this custom component, it is the same behaviour as doing a 'undozoom' with the mouse (by dragging the mouse from bottom right to up left).
So I have made the same test as described previously with a original TChart (and not our custom version), and instead of doing a dble click, I do a 'undozoom' as explained before.
I always see the same problem (overlaping on bottom axis).
Do you want me to send you a sample code to show you this ?
My project is very simple. Just a TChart and the code mentionned on my previous post.
Regards,
Verane.
Hi.
Yes, sending test application wold help a lot. You can send it to marjan@steema.com email address.
Yes, sending test application wold help a lot. You can send it to marjan@steema.com email address.
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
I think the solution in your case is to use char OnUndoZoom event to reset axis scale. Something like this:
It also might be good idea to move the code from OnAfterDraw event to OnZoom event.
Code: Select all
procedure TForm1.Chart1UndoZoom(Sender: TObject);
begin
with Chart1.BottomAxis do
begin
Automatic := False;
Maximum := 5;
Minimum := 0;
Increment := 0.5;
end;
end;
It also might be good idea to move the code from OnAfterDraw event to OnZoom event.
Marjan Slatinek,
http://www.steema.com
http://www.steema.com