Hi,
I have to create a Silverlight client, and one of the key requirements is to show the exact X and Y chart-coordinates of the cursor when it's hovering above a chart.
I searched the forum for this, but only found answers saying this isn't possible yet. (like in thread http://www.telerik.com/community/forums/silverlight/chart/coordinates-within-radchart.aspx)
Is this still the case in version 2011 Q1?
I tried using this code, but the chartarea also includes the drawing space for the axis and labels, so the calculation is incorrect.
I think the problem would be solved if the plotarea was accessible, so I could get the position relative to it.
Like so: var position = e.GetPosition(ChartArea.PlotArea);
kind regards,
Peter
I have to create a Silverlight client, and one of the key requirements is to show the exact X and Y chart-coordinates of the cursor when it's hovering above a chart.
I searched the forum for this, but only found answers saying this isn't possible yet. (like in thread http://www.telerik.com/community/forums/silverlight/chart/coordinates-within-radchart.aspx)
Is this still the case in version 2011 Q1?
I tried using this code, but the chartarea also includes the drawing space for the axis and labels, so the calculation is incorrect.
I think the problem would be solved if the plotarea was accessible, so I could get the position relative to it.
Like so: var position = e.GetPosition(ChartArea.PlotArea);
private void OnChartMouseMove(object sender, MouseEventArgs e)
{
var position = e.GetPosition(ChartArea);
var pctY = 1 - (position.Y / ChartArea.ActualHeight);
var pctX = position.X / ChartArea.ActualWidth;
var x = ChartArea.AxisX.MinValue * (1 - pctX) + ChartArea.AxisX.MaxValue * pctX;
var y = ChartArea.AxisY.MinValue * (1 - pctY) + ChartArea.AxisY.MaxValue * pctY;
X.Text = x.ToString("f2");
Y.Text = y.ToString("f2");
}
kind regards,
Peter