select PointMarks on a line graph

7 posts, 0 answers
  1. Yimi
    Yimi avatar
    3 posts
    Member since:
    Mar 2011

    Posted 22 Mar 2011 Link to this post

    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
  2. Missing user
    Missing user avatar

    Posted 25 Mar 2011 Link to this post

    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
  3. DevCraft banner
  4. Yimi
    Yimi avatar
    3 posts
    Member since:
    Mar 2011

    Posted 25 Mar 2011 Link to this post

    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  
  5. Missing user
    Missing user avatar

    Posted 30 Mar 2011 Link to this post

    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
  6. Will
    Will avatar
    2 posts
    Member since:
    Feb 2012

    Posted 06 Feb 2012 Link to this post

    Hi,
    when i attch event to pointmark,the pontmarkCollections is null ,how can i know pointMark is loaded? 
  7. Nikolay
    Admin
    Nikolay avatar
    385 posts

    Posted 09 Feb 2012 Link to this post

    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 >>
  8. Will
    Will avatar
    2 posts
    Member since:
    Feb 2012

    Posted 10 Feb 2012 Link to this post

    Thank you for your help
Back to Top
DevCraft banner