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

Set axis labels manually in barChart

1 Answer 46 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Anne Lyon
Top achievements
Rank 1
Anne Lyon asked on 11 Jan 2011, 12:10 PM
Hi,
maybe a trivial question but... I have a barchart with dateTime as valueX in my DataPoint. I want to display the X Axis labels as "weeknumber" instead of date. But I cannot use week number as valueX as my chart is then automatically sorted so that week number 1 comes way before week number 52 instead of immediately after... So I need the date as ValueX so that my points are sorted correctly.
I add one point at the time using an ASync Web Service, so I cannot assume that the data for each point is returned in the correct order, hence I cannot set the week number as categoryX either, as my bars might then not be sorted in the right week number order.
But how do I change the label for each bar to display the week number while keeping the bars sorted by date?
I have tried something like :
chart.DefaultView.ChartArea.AxisX.TickPoints[4].Label = "52";
chart.DefaultView.ChartArea.AxisX.TickPoints[5].Label = "1";
But this does not change the labels..

thanks,
Anne

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 14 Jan 2011, 02:11 PM
Hi Anne,

What I can suggest you is to use the XCategory property and to use Sorting descriptor for the DateTime as shown in our help topic.  This will ensure the items appear sorted, while you still use categories.

Best wishes,
Evgenia
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
Chart
Asked by
Anne Lyon
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Share this question
or