Labels different from MajorStep

6 posts, 1 answers
  1. Håkan
    Håkan avatar
    183 posts
    Member since:
    May 2011

    Posted 24 Jan 2013 Link to this post

    Hi,

    I have a chart that displays time on the horizontal axis.
    I have MajorStep set to 15 minutes.
    But is it possible to display the label for each hour instead?

    I show 24 hours, and when having a label for each quarter they will overlap, even though I rotate them.
    It would be nice to have labels for 00:00, 01:00, 02:00 and so on instead of 00:00, 00:15, 00:30, 00:45...
    But i still want the ticks for each quarter.

    The ScheduleView for example has both MajorTicks and MinorTicks, but I can't seem to find a similar Major/MinorStep for the ChartView.
    A nice feature in this case would be that the labels follow the MajorStep and the ticks follow a MinorStep property.

    Regards,
    Håkan
  2. Answer
    Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 29 Jan 2013 Link to this post

    Hi Håkan,

    You can achieve this effect by setting the LabelInterval property of the DateTimeContinuousAxis to 4. Basically this property will make the chart place a label on every 4 major steps.

    I hope this was helpful.

    Regards,
    Petar Kirov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Håkan
    Håkan avatar
    183 posts
    Member since:
    May 2011

    Posted 29 Jan 2013 Link to this post

    Hi Petar!

    Thanks for the reply, it works just fine!
    I thought I hade looked at all Label properties, but it seems I missed this one :-)

    Just one more question, the LabelInterval is not a dependency property right?
    I tried to bind it to my ViewModel, since the user can select different intervals in a drop down.
    But that generates a binding error saying:
    "Object of type 'System.Windows.Data.Binding' cannot be converted to type 'System.Int32'."

    Not a big deal, I just have to do it in code behind, but it would have been cleaner to bind it.

    Regards,
    Håkan
  5. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 31 Jan 2013 Link to this post

    Hi Håkan,

    I'm glad to hear that my last post was helpful.

    All RadChartView axes inherit from the Axis class, which exposes the LabelInterval property which is in fact a DependencyProperty. I'm not quite sure why you could not bind it successfully to your ViewModel. I've made a simple project to test it and I am attaching it below for reference.
     
    All the best,
    Petar Kirov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Håkan
    Håkan avatar
    183 posts
    Member since:
    May 2011

    Posted 14 May 2013 Link to this post

    Hi,

    I get the same exception running your example code.

    Is this changed recently?
    I'm unfortunately stuck with Silverlight 4 at the moment so I'm running the 2012 Q2 SP2 version.

    Regards,
    Håkan
  7. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 17 May 2013 Link to this post

    Hi Håkan,

    We changed the Axis.ShowLabelsAxis.LabelInterval and
    Axis.LabelFitMode properties to dependency properties with the Q3 2012 release (ver. 2012.3.1017). I am afraid that with the version that you are using, you will not be able to bind them.
     
    Regards,
    Petar Kirov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
DevCraft banner