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

[Solved] Changing the text of a single label in a RadChart

2 Answers 137 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
NR
Top achievements
Rank 1
NR asked on 22 Dec 2010, 11:15 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Evgeni "Zammy" Petrov
Telerik team
answered on 23 Dec 2010, 05:49 PM
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
0
NR
Top achievements
Rank 1
answered on 23 Dec 2010, 07:05 PM
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.
Tags
Chart
Asked by
NR
Top achievements
Rank 1
Answers by
Evgeni "Zammy" Petrov
Telerik team
NR
Top achievements
Rank 1
Share this question
or