We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Drawing Rectangular Annotations on Charts in Axis Coordinates

Thread ID:

Created:

Updated:

Platform:

Replies:

104613 Aug 2,2012 01:53 PM Aug 14,2012 03:22 AM WPF 1
loading
Tags: Chart
Administrator [Syncfusion]
Asked On August 2, 2012 01:53 PM

Hi,

I am trying to draw a rectangular annotation over a FastScatter chart using using data binding to a property of my DataContext to get the x and y positions as well as the width and height.  I can see how to draw an annotation with a custom datatemplate, but I don't understand how to set the width in xais coordinates rather than device independent units.  

In other words, if I have a property on the DataContext of DrawingBounds with members X,Y,Width, and Height, I want to draw a rectangle on the chart with these dimensions all in axis coordinates.  This is to highlight a region for the user to see points of interest.

Thanks!

--Jonathan

Rajkumar [Syncfusion]
Replied On August 14, 2012 03:22 AM

Hi Jonathan,

Thank you for choosing Syncfusion products.

We would like to inform you that your requirement can be achieved by using Series Annotation and this will position the annotations in ChartAxis coordinates. Please find the following UG link for ChartSeries annotations (Chart Controls > Chart > Concepts and Features > Annotations > Annotations At X-Y Coordinates).

http://help.syncfusion.com/User%20Interface/WPF/Chart

Also we would like to inform you that we have methods to convert the device coordinates to axis coordinates and vice versa. Please find the code snippet below.

Code Snippet:
[C#]
  //Convert Point to Value
            double valx = chtarea1.PointToValue(chtarea1.PrimaryAxis, mousePoint);
            double valy = chtarea1.PointToValue(chtarea1.SecondaryAxis, mousePoint);

            //Convert Value to Point
            Point pt = new Point(chtarea1.ValueToPoint(chtarea1.PrimaryAxis, valx), chtarea1.ValueToPoint(chtarea1.SecondaryAxis, valy));

The attached sample tooltip shows the result of these method while moving the mouse. 

Please let us know, if you have any queries.

Thanks,
Rajkumar B R


CS_24a2c842.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;