Changing the text of a single label in a RadChart

3 posts, 1 answers
  1. NR
    NR avatar
    17 posts
    Member since:
    Oct 2009

    Posted 22 Dec 2010 Link to this post

    I have a RadChart that has 2 series in it. I'm using a DefaultLabelFormat on my AxisX set to HH:MM currently (hourly data), but sometimes the data goes past 1 day. In these cases, I get 00:00 through 11:00 then it goes back to 00:00, etc. I would like to rename all labels on my X-Axis at the spots that say 00:00 to say 21-Dec (dd-MMM).

    In the Telerik RadChart for ASP.NET, you could just override the PrePaint event and get access to all the points I wanted to change.

    How can I do this in the Silverlight version of RadChart?
  2. Answer
    Evgeni "Zammy" Petrov
    Admin
    Evgeni "Zammy" Petrov avatar
    168 posts

    Posted 23 Dec 2010 Link to this post

    Hi NR,

     You can change the labels on the AxisX on LayoutUpdate:

    public MainPage()
    {
        InitializeComponent();
        ...
        radChart.LayoutUpdated += new EventHandler(RC1_LayoutUpdated);
    }
     
    void RC1_LayoutUpdated(object sender, EventArgs e)
    {
        var tickPoints = radChart.DefaultView.ChartArea.AxisX.TickPoints;
        for (int i = 0; i < tickPoints.Count; i++)
        {
            if (tickPoints[i].Label == "00:00")
            {
     
            }
        }
    }

    I hope this will help you out.

    Best wishes,
    Evgeni "Zammy" Petrov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. NR
    NR avatar
    17 posts
    Member since:
    Oct 2009

    Posted 23 Dec 2010 Link to this post

    While that didn't exactly work as I needed it because of the way I'm using the RadChart in a template, I was able to adapt it properly. Thank you for the quick response. That is exactly what I was looking for to get me going.
Back to Top