This is a migrated thread and some comments may be shown as answers.

Annotation Relative to RadPolarChart Origin

1 Answer 53 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Reilly
Top achievements
Rank 1
Veteran
Reilly asked on 21 Feb 2019, 04:22 PM

My RadPolarChart represents an antenna radiation pattern. I need to draw an annotation relative to the origin. How can I do this? My radial axis is NumericRadialAxis but I cannot seem to figure out the origin value, and PolarCustomAnnotation wants polar and radial coordinates.

The attached image represents an antenna mounting image. i want to center the small ellipse around the origin. I'm using a DrawingImage in XAML to define the geometry.

Thanks.

-John.

 

 

 

1 Answer, 1 is accepted

Sort by
0
Reilly
Top achievements
Rank 1
Veteran
answered on 22 Feb 2019, 02:17 PM

Never mind. I figured this out.

For anyone else, you can use ConvertPointToData() to find the chart position of any window coordinates. Since I know the origin is at the window center, I get the window center as 1/2 of ActualWidth and ActualHeight, and then call ConvertPointToData() to get me the polar coordinates. From the documentation, "FirstValue" is the polar and "SecondValue" is the radial. (See "Conversion API" in the docs.)

The only "tricky" part is that you have to let the chart do its layout to determine the axis extents BEFORE you call the API. I run the code that draws the annotation using Dispatcher.BeginInvoke() at ApplicationIdle priority AFTER adding the series. There probably is an event, but this works for me.

I also do not do panning or zooming, which adds a layer of complexity.

 

Tags
ChartView
Asked by
Reilly
Top achievements
Rank 1
Veteran
Answers by
Reilly
Top achievements
Rank 1
Veteran
Share this question
or