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

MouseEvent with LineSeries

1 Answer 11 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Johnny
Top achievements
Rank 1
Johnny asked on 18 Nov 2013, 08:08 AM
public void test()
        {
            LineSeries line1 = new LineSeries() { };
            for (int i = 0; i < 10; i++)
            {
                line1.DataPoints.Add(new Telerik.Charting.CategoricalDataPoint() { Value = i });
            }
 
            line1.MouseLeftButtonDown += (sender, args) => MouseLeftDown(sender, args, chart1);
 
            chart1.Series.Add(line1);
        }
 
        public void MouseLeftDown(object sender,MouseButtonEventArgs args,RadCartesianChart chart)
        {
         
        }

Can I use MouseEvent to get the  datapoint of line?


I set  MouseDown in LineSeries and I want to add datapoint where I trigger this event.

But I can't find any data about  the position of line. 

1 Answer, 1 is accepted

Sort by
0
Accepted
Yavor
Telerik team
answered on 20 Nov 2013, 04:00 PM
Hi Johnny,

We have a method that does just that. You can use the RadCartesianChart.ConvertPointToData method. Here is how:

System.Windows.Point position = e.GetPosition(this);
var data = this.chart.ConvertPointToData(position);


Regards,
Yavor
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
Chart
Asked by
Johnny
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or