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. Image for the cookie policy date
close icon

Drawing Rectangular Annotations on Charts in Axis Coordinates

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

1 Reply

RA Rajkumar Syncfusion Team August 14, 2012 07:22 AM UTC

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

Loader.
Live Chat Icon For mobile
Up arrow icon