Hi !
We use Tannotaiotn with Callouts to mark positions in the chart. Works ok so far.
But if you save the chart to a tee file, resize the application (and the chart) and load the tee file back the callout x/y value is wrong.
The X / Y values of the callout are stored as pixel values. And they are used after loading the tee to set the callout position. But if you resize the chart before loading the tee it ends up with a wrong position.
What can I do to fix this?
Callout - wrong position after Tee loading
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dominik,
Yes, even though your code sets relative positions they are saved in pixels. So you should run the code for positioning annotation and its callout after loading the .tee file.
Yes, even though your code sets relative positions they are saved in pixels. So you should run the code for positioning annotation and its callout after loading the .tee file.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Hi Narcis,
So lets say you have a chart size from 800*600. You place a callout at position x200 y250. Then you store it within a tee file.
Now you close your application, restart it and resize the form. Letzs say your chart is now 600 * 400 only. Now load the tee file and the callout has the wrong position. It stays at position 200 / 250.
But it must be at the following position:
200 / (800 / 600) = 150
250 / (600 / 400) = 166,67
I use this code for setting the callouts. But it wont work after resizing the chart:
Any idea what I can do ?
I do this. But there is one problem left. This only works if you chart doesn´t resize.So you should run the code for positioning annotation and its callout after loading the .tee file
So lets say you have a chart size from 800*600. You place a callout at position x200 y250. Then you store it within a tee file.
Now you close your application, restart it and resize the form. Letzs say your chart is now 600 * 400 only. Now load the tee file and the callout has the wrong position. It stays at position 200 / 250.
But it must be at the following position:
200 / (800 / 600) = 150
250 / (600 / 400) = 166,67
I use this code for setting the callouts. But it wont work after resizing the chart:
Code: Select all
procedure TForm1.SetAnnoPos;
var I : Integer;
_Count : Integer;
begin
MainChart.Draw;
_Count := 0;
for i := 0 to MainChart.Tools.Count - 1 do begin
if ((MainChart.Tools[i] is TRectangleTool) and
(MainChart.Tools[i].Tag > 19999) and
(MainChart.Tools[i].Tag < 30000) and
(Length(AnnoPos) > 0)) then begin
Inc(_Count);
TRectangleTool(MainChart.Tools[i]).Left := MainChart.Axes.Bottom.CalcXPosValue(AnnoPos[_Count - 1].ToolPosX);
TRectangleTool(MainChart.Tools[i]).Top := MainChart.CustomAxes[0].CalcYPosValue(AnnoPos[_Count - 1].ToolposY);
if TRectangleTool(MainChart.Tools[i]).Callout.Visible = True then begin
TRectangleTool(MainChart.Tools[i]).Callout.XPosition := MainChart.Series[0].CalcXPosValue(AnnoPos[_Count - 1].ArrowPosX);
TRectangleTool(MainChart.Tools[i]).Callout.YPosition := MainChart.Series[0].CalcYPosValue(AnnoPos[_Count - 1].ArrowPosY); // Series1
end;
end;
end;
end;
Greetz Dominik
http://www.logview.info
http://www.logview.info
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dominik,
Do you call this code after resizing the chart as well?
Do you call this code after resizing the chart as well?
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Hi Narcis,
But that´s not the problem. Normal resizing works great if the callout is visible in the chart.
You only get a problem if you clear the chart, resize the form/chart and reload the tee file with the annotaion.
The old chart size should be calculated as shown above. This would fix the problem. But I have no idea how to do this.
Yesprocedure TForm1.MainChartResize(Sender: TObject);
begin
// Marker neu positionieren
SetAnnoPos;
end;
But that´s not the problem. Normal resizing works great if the callout is visible in the chart.
You only get a problem if you clear the chart, resize the form/chart and reload the tee file with the annotaion.
The old chart size should be calculated as shown above. This would fix the problem. But I have no idea how to do this.
Greetz Dominik
http://www.logview.info
http://www.logview.info
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dominik,
In that case you should run that code after loading the .tee file. If the problem persists please send us a simple example project we can run "as-is" to reproduce the problem here.
Thanks in advance.
In that case you should run that code after loading the .tee file. If the problem persists please send us a simple example project we can run "as-is" to reproduce the problem here.
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Greetz Dominik
http://www.logview.info
http://www.logview.info