Using chart in a touch environment - getting data point when user touch the graph

3 posts, 0 answers
  1. Guy
    Guy avatar
    2 posts
    Member since:
    Aug 2012

    Posted 03 Aug 2012 Link to this post


    First I would like to say that I'm very impressed with level of customization you allow and the easy to understand and quite comprehensive online documentation.

    I don't know whether to post this question under 'Chart' or 'ChartView' yet I attend to use the one that will resolve my current issue.

    I'm developing for a touch environment (wpf pixelsense sdk 2).  

    My goal
    When a user touches anywhere on a graph (stacked area series) - show him information about the data point he touched.

    In a technical aspect:
    1. Use touch down/click/manipulation events to recieve a data point 
    2. Alternative solution - to be able to get the item (data point) in a given position. This way I will be able to trap touch events manually.

    I cannot use any mouse events, only touch events.

    What I've tried:

    experiment  1

    1. Add 'ChartTrackBallBehavior' to my chart
    2. Register to 'TrackInfoUpdated' event
    3. Use 'e.Context.ClosestDataPoint' to get data point of current position

    Since I'm using touch device I need this event to be triggered when touching (touchdown event) but it doesn't. 
    I saw a possible workaround but it seems to be relevant only to wp8 controls and not to wpf (link)

    experiment 2
    1. Register to 'radChart.DefaultView.ChartArea.ItemClick' event.
    2 Use the event arguments which include information on the clicked item.

    void ChartArea_ItemClick(object sender, ChartItemClickEventArgs e)
          // Here I can use e.DataPoint or e.ItemIndex

    It works only if I uses the mouse, when using touch the event is never beng promoted (might be because the chart is hosted inside scatterviewitem) . I have tried to bypass this issue without success.

    Any workaround exists on current version will be much helpful.

  2. Guy
    Guy avatar
    2 posts
    Member since:
    Aug 2012

    Posted 04 Aug 2012 Link to this post


    I just want to clarify my question - How can I get a datapoint given a point relative to the chart? 

    Something which resemble to the following declaration : DataPoint PointToDataPoint(Point point); 

  3. DevCraft R3 2016 release webinar banner
  4. Giuseppe
    Giuseppe avatar
    2363 posts

    Posted 08 Aug 2012 Link to this post

    Hello Guy,

    Unfortunately neither RadChart, nor RadChartView for WPF provide any specific touch support at the moment. We are planning to add touch capabilities to RadChartView for WPF for the Q3 2012 release (around mid-October) but we cannot provide any workaround that would enable touch with the current version of the control.

    As for your last question -- currently only RadChart for WPF exposes such methods through AxisX and AxisY:
    • AxisX.ConvertDataUnitsToPhysical(...) - converts the data units to physical pixels.
    • AxisX.ConvertPhysicalUnitsToData(...) - converts the physical pixels to data units.
    • AxisY.ConvertDataUnitsToPhysical(...) - converts the data units to physical pixels.
    • AxisY.ConvertPhysicalUnitsToData(...) - converts the physical pixels to data units.

    You can find sample usage of these methods in this help topic here.

    We will forward your feedback to our developers so they can consider exposing similar functionality in RadChartView for WPF.

    Kind regards,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top