Andywmm9 wrote at 2012-07-24 03:33:
I have an image and an OxyPlot chart which are inside a canvas. I want to set the position of the image based on the two variables I have, XAxisHostValue and YAxisHostValue. I noticed the Scale property on the linear axes, however no matter what they are always zero. Is there another way to convert the coordinates in my canvas (which is the same size as the chart) to plot coordinates? Thanks
double xScale = PlotModel.Axes.Scale; double yScale = PlotModel.Axes.Scale; mDragCG.SetValue( Canvas.LeftProperty, xScale * XAxisHostValue); mDragCG.SetValue( Canvas.TopProperty, yScale * YAxisHostValue);
Tech_Junkie wrote at 2012-07-26 16:07:
The scale is only set after the element is loaded, so if you set these variables in your constructor it won't work.
Fortunately you can use the InverseTransform function of an axis to convert from a datapoint to a screenpoint. The Transform function does the opposite.
objo wrote at 2012-08-09 00:08:
Yes, the scale is not set before the plot has been rendered (it depends on the size of the control, and the contents of the plot model).
Use the Transform functions to transform from 'data' points to 'screen' points.
Customer support service by UserEcho