Issue setting the z-index of a PointMark in a Line Series Chart

3 posts, 0 answers
  1. Ruby Jean
    Ruby Jean avatar
    9 posts
    Member since:
    Jun 2012

    Posted 11 Feb 2013 Link to this post

    Hi, 

    I have trouble setting the ZIndex of a point mark in my line series chart. I only followed the ones in your sample for the Bubble series. Here is my code:

    private void ChartArea_ItemClick(object sender, ChartItemClickEventArgs e)
    {
       BringToFrontDataPointControl(Chart.DefaultView.ChartArea.ChildrenOfType<PointMark>()
          .ToList<PointMark>().Where(x => x.DataContext == e.DataPoint).SingleOrDefault());
    }
     
    private void BringToFrontDataPointControl(Control ctrl)
    {
       if (ctrl is PointMark)
       {
            var pointMarkList = Chart.DefaultView.ChartArea.ChildrenOfType<PointMark>().ToList<PointMark>();
            pointMarkList.ForEach(delegate(PointMark current)
            {
                 if (current.Equals(ctrl as PointMark))
                    Canvas.SetZIndex(current, 100000);
                 else
                    current.ClearValue(Canvas.ZIndexProperty);
            });
       }
    }

    Hope you could help me on this.

    Cheers,
    Byang
  2. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 14 Feb 2013 Link to this post

    Hi Ruby,

    To make this code work you need to change every occurrence of PointMark with Bubble, because the visual element that represent the BubbleSeries' data points is of type Telerik.Windows.Controls.Charting.Bubble

    I would recommend using a tool for visual debugging such as XAML Spy, or WPF Inspector when, so you can easily examine the visual tree and find the information you need.

    All the best,
    Petar Kirov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Ruby Jean
    Ruby Jean avatar
    9 posts
    Member since:
    Jun 2012

    Posted 14 Feb 2013 Link to this post

    Thanks for the response and the advise on using XamlSpy.

    I am actually using a Line Series not a Bubble Series so for that reason I couldn't change PointMark to Bubble however I used Telerik.Windows.Controls.Charting.Line after seeing in XamlSpy that its a parent of the point mark. After setting the ZIndex of the Line it works. Thanks again and more power.
Back to Top