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

Click/touch on Datapoints in a chart

1 Answer 88 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nidhi
Top achievements
Rank 1
Nidhi asked on 15 Jun 2011, 08:55 AM
HI Team,

I have created a Line series chart. I want open another window on clicking if any datapoint. Manipulation started event is there. How can we know which Datapint is clicked.

Thanks,
Nidhi

1 Answer, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 16 Jun 2011, 08:03 AM
Hello Nidhi,

Thank you for your interest in RadControls for Windows Phone 7.

In BETA 2 (expected within two weeks) we will introduce a PlotAreaTap event, which will give you the needed context - e.g. which is the closest data point, which is the series that contains it, etc.

Currently you may perform your own loop and find the needed data point:

protected override void OnManipulationStarted(ManipulationStartedEventArgs e)
{
    base.OnManipulationStarted(e);
 
    Point touchPoint = e.ManipulationOrigin;
    CategoricalSeries series = this.radChart1.Series[0] as CategoricalSeries;
 
    foreach (DataPoint dataPoint in series.DataPoints)
    {
        RadRect layoutSlot = dataPoint.LayoutSlot;
 
        // check whether the layout slot of the point contains the touch point
        if (touchPoint.X >= layoutSlot.X && touchPoint.X <= layoutSlot.Right &&
            touchPoint.Y >= layoutSlot.Y && touchPoint.Y <= layoutSlot.Bottom)
        {
            // data point is hit, perform some action
        }
    }
}

I hope this information is useful. Should you have any other questions do not hesitate to contacts us.

Regards,
Georgi
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
Chart
Asked by
Nidhi
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Share this question
or