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

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

2 Answers 75 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Ruby Jean
Top achievements
Rank 1
Ruby Jean asked on 11 Feb 2013, 06:16 PM
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 Answers, 1 is accepted

Sort by
0
Petar Kirov
Telerik team
answered on 14 Feb 2013, 04:54 PM
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.

0
Ruby Jean
Top achievements
Rank 1
answered on 14 Feb 2013, 05:53 PM
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.
Tags
Chart
Asked by
Ruby Jean
Top achievements
Rank 1
Answers by
Petar Kirov
Telerik team
Ruby Jean
Top achievements
Rank 1
Share this question
or