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

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

2 Answers 109 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Guy
Top achievements
Rank 1
Guy asked on 03 Aug 2012, 12:23 PM
Hello,

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.

Platform
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.

Limitations
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

Result
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
}

Result
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.

Sincerely,
Guy

2 Answers, 1 is accepted

Sort by
0
Guy
Top achievements
Rank 1
answered on 04 Aug 2012, 08:29 PM
Hi,

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); 

Thanks,
Guy.
0
Giuseppe
Telerik team
answered on 08 Aug 2012, 10:03 AM
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,
Giuseppe
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Chart
Asked by
Guy
Top achievements
Rank 1
Answers by
Guy
Top achievements
Rank 1
Giuseppe
Telerik team
Share this question
or