Set axis labels manually in barChart

2 posts, 0 answers
  1. Anne Lyon
    Anne Lyon avatar
    90 posts
    Member since:
    Jan 2010

    Posted 11 Jan 2011 Link to this post

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

  2. Evgenia
    Evgenia avatar
    1437 posts

    Posted 14 Jan 2011 Link to this post

    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,
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top