Hi, I need to get screen display position of a scatterseries datapoint say (3,5) in windows form. I am unable to find any conversion api similar to wpf which has methods to do that. How to get actual position on screen for a point. Any help will be greatly appreciated.
4 Answers, 1 is accepted
0
Hello,
You can get screen coordinates of the ScatterDataPoint by using the HitTest method:
private void RadChartView1_MouseMove(object sender, MouseEventArgs e)
{
var point = this.radChartView1.Area.View.Renderer.HitTest(e.X, e.Y);
if (point is ScatterDataPoint)
{
Console.WriteLine("Coordinates: X: {0}, Y: {1} ", e.X, e.Y);
}
}
I hope this helps. If you have further questions do not hesitate to contact me.
Regards,
Nadya
Progress Telerik
Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Our thoughts here at Progress are with those affected by the outbreak.
0
rk
Top achievements
Rank 1
answered on 15 Jun 2020, 06:40 AM
Hi, My requirement is not on mouse events. I want these locations just as these points are created very first time.So which event to use for that purpose is my problem.
0
rk
Top achievements
Rank 1
answered on 15 Jun 2020, 06:41 AM
Hi, My requirement is not on mouse events. I want these locations just as these points are created very first time.So which event to use for that purpose is my problem.
0
Hello,
You can use the CreatePointElement event that occurs when a DataPointElement is created. You can get the data point location and convert it to screen coordinates with the PointToScreen method. Please refer to the following code snippet:
private void ChartElement_CreatePointElement(object sender, ChartViewCreatePointElementEventArgs e)
{
ScatterDataPoint point = e.DataPoint as ScatterDataPoint;
RadPoint location = point.LayoutSlot.Location;
Point pointScreen = radChartView1.PointToClient(new Point((int)location.X, (int)location.Y));
Console.WriteLine(pointScreen);
}
I hope this helps. Let me know if you have other questions.
Regards,
Nadya
Progress Telerik
Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Our thoughts here at Progress are with those affected by the outbreak.