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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Drawing Rectangular Annotations on Charts in Axis Coordinates

Thread ID:





104613 Aug 2,2012 05:53 PM UTC Aug 14,2012 07:22 AM UTC WPF 1
Tags: Chart
Administrator [Syncfusion]
Asked On August 2, 2012 05:53 PM UTC


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.



Rajkumar [Syncfusion]
Replied On 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).


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:
  //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.

Rajkumar B R



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon