Jump to content
Software FX Community

Click Event of Annotation


ranjan_rai
 Share

Recommended Posts

I want to trap click event of annotation text. There is a mousedown/mouseup event for annotation list but that also gets for any mouse click on the chart and not necessarily on the annotation.

I want to have similar functionality like google finance where I can click on a annotation on a chart and navigate to a relevant place showing me details about the annotation. Please share a sample code snippet if somebody has tried this kind of feature.

Link to comment
Share on other sites

You can use the URL property of the Annotation:

Annotations annots = new Annotations();

Chart1.Extensions.Add(annots);

 

AnnotationText text = new AnnotationText("My annotation");

text.Attach(2, 3);

text.Color = Color.Red;

text.PlotAreaOnly =

true;text.AllowMove = false;

text.Link.Url =

"http://www.softwarefx.com";

annots.List.Add(text);

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

Hi,The annotation extension provides independent events including MouseDown, you must attach to these events in order to be notified when clicks are madein the annotation objects.For example, if you have:Annotations annots = new Annotations();chart1.Extensions.Add(annots);

you can attach to the event by doing:annotX.MouseDown += new MouseEventHandler(AnnotationMouseDown);and then you need to define the corresponding event handler:private void AnnotationMouseDown (object sender, MouseEventArgs e){   // Your Mouse Down event code goes here. You can use the HitTest method to retrieve the object being hit.}Regards,RandyJ
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...