MouseEvent with LineSeries

2 posts, 1 answers
  1. Johnny
    Johnny avatar
    4 posts
    Member since:
    Sep 2013

    Posted 18 Nov 2013 Link to this post

    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. 
  2. Answer
    Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 20 Nov 2013 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top