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

select PointMarks on a line graph

6 Answers 49 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Yimi
Top achievements
Rank 1
Yimi asked on 22 Mar 2011, 11:30 AM
Hi,

I'm using the example of Chart SimpleFiltering. I want to select on datapoint and I  
try to use the "ChartArea_SelectionChanged" event to do it. But the event doesn't work.

My questions as below:

1) Why the ChartArea_SelectionChanged event doesn't work ?
2) How to select one datapoint?

Thanks

6 Answers, 1 is accepted

Sort by
0
Missing User
answered on 25 Mar 2011, 09:18 AM
Hello Yimi,

When the ChartArea_SelectionChanged event is used for line series it gives information only for the selected series. This is because the InteractivityScope.Item is not supported for series that do not render separate items (Line, Spline, Area, Range, and all their stacked versions). In order to be able to select a PointMark on the line you need to use ChartArea_ItemClick event. More information about Interactivity Effects can be found here.

Greetings,
Polina
the Telerik team
0
Yimi
Top achievements
Rank 1
answered on 25 Mar 2011, 10:26 AM
Hi,
Thank you for your help. When I use the ChartArea_ItemClick event and my problem resolved. Now I get a new problem. When I use the  ChartArea_ItemClick evnet  , I can click any point on the line and I only want to click some pointMarks rather than a whole line. 
So, my question is:

1. How to click a specified PointMark to trigger ChartArea_ItemClick  event rather than click any point on the line ?
2. Which event I can use when I click one specified PointMark ?

Many Thanks  
0
Missing User
answered on 30 Mar 2011, 05:28 PM
Hi Yimi,

At present, this feature is not supported in RadChart out of the box. However, you can take advantage of our UIElement.ChildrenOfType<T>() extension method and directly access the PointMark visuals after the chart data is loaded. For example:
var pointMarks = radChart.ChildrenOfType<PointMark>();

After you get the PointMarks collection, you can attach MouseLeftButtonDown event handler to the desired point:
pointMarks[2].AddHandler(MouseLeftButtonDownEvent,
      new MouseButtonEventHandler(MouseLeftButtonDownEventHandler), true);

Note that, in order to use ChildrenOfType<T>() you need to include Telerik.Windows.Controls namespace.

Regards,
Polina
the Telerik team
0
Will
Top achievements
Rank 1
answered on 07 Feb 2012, 04:46 AM
Hi,
when i attch event to pointmark,the pontmarkCollections is null ,how can i know pointMark is loaded? 
0
Nikolay
Telerik team
answered on 09 Feb 2012, 09:42 AM
Hello,

In order to ensure the pointmarks are loaded you can wire to DataBound event in the following manner :
this.RadChart1.DataBound += new EventHandler<ChartDataBoundEventArgs>(RadChart1_DataBound);
void RadChart1_DataBound(object sender, ChartDataBoundEventArgs e)
        {
            Dispatcher.BeginInvoke(new Action(() => RadChart1.ChildrenOfType<PointMark>()));
        }

Hope this helps.

Greetings,
Nikolay
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Will
Top achievements
Rank 1
answered on 10 Feb 2012, 10:39 AM
Thank you for your help
Tags
Chart
Asked by
Yimi
Top achievements
Rank 1
Answers by
Missing User
Yimi
Top achievements
Rank 1
Will
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or