Hello,
In the attached sample project I have 2 chart with 2 Annotation tools with a custom position.
Following advise in this forum the position of the Annotation tool is set in the OnAfterDraw event of the chart.
With the checkbox Chart1 can be made (in)visible. In the following OnAfterDraw event the Annotation tool is not drawn in the correct position, only after a second OnAfterDraw event.
What do I have to do to draw the Annotion tool in the correct place after (un)checking the checkbox?
Regards,
Bert
Annotation Tool drawing problem
Annotation Tool drawing problem
- Attachments
-
- TeeChartAnnotationTool.rar
- (1.94 KiB) Downloaded 536 times
Re: Annotation Tool drawing problem
Hello Bert,
I've found a quite ugly workaround:
Or another one maybe a little bit prettier:
I've found a quite ugly workaround:
Code: Select all
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
Chart1.Visible := CheckBox1.Checked;
Chart2.Draw;
ChartTool2.Repaint;
end;
Code: Select all
var Annotation2OldVal: Integer;
procedure TForm1.FormShow(Sender: TObject);
begin
LabelVersion.Caption := TeeMsg_Version;
Annotation2OldVal:=-1;
end;
procedure TForm1.Chart2AfterDraw(Sender: TObject);
begin
with ChartTool2 do
begin
Top := ParentChart.Height - Shape.Height - 10;
if (Annotation2OldVal=-1) or (Top<>Annotation2OldVal) then
begin
Annotation2OldVal:=Top;
Chart2.Draw;
end;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Annotation Tool drawing problem
Hello Yeray,
Thanks for the workaround. I suppose that this will get fixed in an official release eventually?
Regards,
Bert
Thanks for the workaround. I suppose that this will get fixed in an official release eventually?
Regards,
Bert
Re: Annotation Tool drawing problem
Hello Bert,
I don't think we can consider it as a bug, but a per design behaviour.
Note that, when the code in your AfterDraw event is executed, the chart is already drawn and so is the annotation. So, changing the position of an element that has already been drawn, the new element position will logically be applied in the next repaint.
I'm not sure if my explanation has been clarifying... Don't hesitate to ask for another one if you get confused!
I don't think we can consider it as a bug, but a per design behaviour.
Note that, when the code in your AfterDraw event is executed, the chart is already drawn and so is the annotation. So, changing the position of an element that has already been drawn, the new element position will logically be applied in the next repaint.
I'm not sure if my explanation has been clarifying... Don't hesitate to ask for another one if you get confused!
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Annotation Tool drawing problem
Hello Yeray,
I understand your explanation.
In TeeChart there are several options to place the annotation tool.
And we have the choice for a custom position.
In my situation I want the annotation in the bottom left corner, but not exactly in the position it is placed by TeeChart.
It would be cool if TeeChart would treat the custom values as offsets regarding to the chosen position. This would remove the need for my OnAfterDraw code.
Regards,
Bert
I understand your explanation.
In TeeChart there are several options to place the annotation tool.
And we have the choice for a custom position.
In my situation I want the annotation in the bottom left corner, but not exactly in the position it is placed by TeeChart.
It would be cool if TeeChart would treat the custom values as offsets regarding to the chosen position. This would remove the need for my OnAfterDraw code.
Regards,
Bert
Re: Annotation Tool drawing problem
Hello Bert,
I've added it to the wish list to be implemented in future releases (TV52015825)
This would affect other customers who already are using the actual absolute custom coordinates. But we could add a property, for example named useRelativeCoords, that would be false by default. And setting it to true the Top and Left positions would count from the Auto alignment position set.Bert B. wrote:It would be cool if TeeChart would treat the custom values as offsets regarding to the chosen position. This would remove the need for my OnAfterDraw code.
I've added it to the wish list to be implemented in future releases (TV52015825)
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |