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

2 posts, 0 answers
  1. Arpit
    Arpit avatar
    10 posts
    Member since:
    Jun 2009

    Posted 30 Nov 2010 Link to this post

     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.
  2. Evgenia
    Evgenia avatar
    1437 posts

    Posted 06 Dec 2010 Link to this post

    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;
                       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.

    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
Back to Top