TColorLineTool with label

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Matt Venkat
Newbie
Newbie
Posts: 16
Joined: Wed May 18, 2005 4:00 am
Location: Sydney, Australia
Contact:

TColorLineTool with label

Post by Matt Venkat » Thu Apr 19, 2012 4:33 am

Hi,

I would like to do something like in the picture.

Image

From my research, it uses TColorLineTool. But I don't know how to add a label on the hori line. The label holds the value of left axis value point. You can move the hori line. You can also type the value in the label and the line moves to that value.

Is that builtin feature from TeeChar pro 2012?
How do i implement it?

Regards,

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: TColorLineTool with label

Post by Narcís » Thu Apr 19, 2012 11:34 am

Hi Matt,

You can use a TColorLineTool in synch with a TAnnotationTool as shown in the attached project. You could also do custom text drawing directly to TeeChart's canvas in the OnAfterDraw event, for example.

Hope this helps!
Attachments
ColorlineWithAnnotation.zip
(2.39 KiB) Downloaded 530 times
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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: TColorLineTool with label

Post by Narcís » Thu Apr 19, 2012 2:33 pm

Hello,

Sorry, I forgot to answer that part:
You can also type the value in the label and the line moves to that value.
Currently there's no built-in functionality to do that. Rectangle tool, similar to Annotation tool, supports editing with TeeChart for .NET. I have added this (TV52016160) to the wish-list to be considered for inclusion in future releases. In the meantime, the only option I can think of is using a TEdit which modifies both the ColorLine.Value and Annotation.Text. You could make that TEdit only visible when clicking in the Annotation tool using the OnClick or OnDblClick events. You could also position it in the Annotation tool position. I already showed you how to get and set its position.
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

Matt Venkat
Newbie
Newbie
Posts: 16
Joined: Wed May 18, 2005 4:00 am
Location: Sydney, Australia
Contact:

Re: TColorLineTool with label

Post by Matt Venkat » Fri Apr 20, 2012 4:54 am

Narcís wrote:Hi Matt,

You can use a TColorLineTool in synch with a TAnnotationTool as shown in the attached project. You could also do custom text drawing directly to TeeChart's canvas in the OnAfterDraw event, for example.

Hope this helps!
Hi Narcis,
The example is perfectly working and great one. But if you zoom-in the graph, the annotation is still hanging on the same place. I tired to work around to get proper position of annotation. But I don't know how to get Top and Left of annotation.

Do you know how to set the annotation on the TColorLineTool when you zoom-in.
Narcís wrote:Hello,
Currently there's no built-in functionality to do that. Rectangle tool, similar to Annotation tool, supports editing with TeeChart for .NET. I have added this (TV52016160) to the wish-list to be considered for inclusion in future releases. In the meantime, the only option I can think of is using a TEdit which modifies both the ColorLine.Value and Annotation.Text. You could make that TEdit only visible when clicking in the Annotation tool using the OnClick or OnDblClick events. You could also position it in the Annotation tool position. I already showed you how to get and set its position.
Thanks for advice and explanation. Thanks again

Regards

Yeray
Site Admin
Site Admin
Posts: 9534
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: TColorLineTool with label

Post by Yeray » Mon Apr 23, 2012 8:36 am

Hi,
Matt Venkat wrote:The example is perfectly working and great one. But if you zoom-in the graph, the annotation is still hanging on the same place. I tired to work around to get proper position of annotation. But I don't know how to get Top and Left of annotation.
To update the annotation position afterzooming/unzooming/scrolling you should use the according event to move it as Narcís did in the example above. For example, you could enhance it with this:

Code: Select all

procedure TForm1.Chart1Zoom(Sender: TObject);
begin
  Chart1.Draw;
  UpdateAnnotationPosition(ChartTool1.Value, ChartTool2);
end;

procedure TForm1.Chart1UndoZoom(Sender: TObject);
begin
  Chart1.Draw;
  UpdateAnnotationPosition(ChartTool1.Value, ChartTool2);
end;

procedure TForm1.Chart1Scroll(Sender: TObject);
begin
  UpdateAnnotationPosition(ChartTool1.Value, ChartTool2);
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Matt Venkat
Newbie
Newbie
Posts: 16
Joined: Wed May 18, 2005 4:00 am
Location: Sydney, Australia
Contact:

Re: TColorLineTool with label

Post by Matt Venkat » Tue Apr 24, 2012 7:17 am

Yeray wrote:Hi,
To update the annotation position afterzooming/unzooming/scrolling you should use the according event to move it as Narcís did in the example above. For example, you could enhance it with this:

Code: Select all

  Chart1.Draw;
Thank alot Yeray. It works fine now.
Chart1.Draw fixes the problem.

Thanks again.

Cheers

Post Reply