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

How can we Edit XAxis labels and highlight the peak in line or spline graph?

1 Answer 81 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Arpit
Top achievements
Rank 1
Arpit asked on 30 Nov 2010, 07:14 PM
 I have a requirement where I have to edit the label of XAxis at runtime by right clicking on XAxis label. Also, I want to highlight the particular peak on mouse over which rises from XAxis 0 value and end's at XAxis 0 value. see the attached image for the reference.

If this thing suffice by telerik I am ready to buy the telerik controls.

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 06 Dec 2010, 10:10 AM
Hello Arpit,

At present, RadChart does not provide such functuonality - to have colored Border around its Axis Items Labels by right clicking Axis Labels. The problem is that Border is not defined in Axis Labels Template. What you can do is to change Axis Labels Foreground on Right Mouse button click like this:

private void ChartArea_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
      {
          AxisLabel2D clickedLabel = GetParent<AxisLabel2D>(e.OriginalSource as DependencyObject);
          if (clickedLabel != null)
          {
              clickedLabel.Foreground = new SolidColorBrush(Colors.Red);
          }
      }
       private static T GetParent<T>(DependencyObject obj) where T : DependencyObject
       {
           T parent = null;
           if (obj != null)
           {
               if (obj is T)
               {
                   parent = (T)obj;
               }
               else
               {
                   DependencyObject nextParent = VisualTreeHelper.GetParent(obj);
                   parent = GetParent<T>(nextParent);
               }
           }
           return parent;
       }

By looping through the visual three you can change the AxisLabel2D Foreground to Red for example.
We are planning to change the Template of the Axis Labels in future so that you will be able to set Border Thickness and BorderBrush.

As for the highlighting the particular peak on mouse over - this can not be done with RadChart for Silverlight.

Regards,
Evgenia
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
Chart
Asked by
Arpit
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Share this question
or