Label Formatter with DateTimeContinuousAxis

2 posts, 0 answers
  1. Maxence
    Maxence avatar
    1 posts
    Member since:
    Dec 2017

    Posted 28 Dec 2017 Link to this post

    How to use Label Formatter with DateTimeContinuousAxis ?


    I've tried something like that : 

                    <telerikChart:DateTimeContinuousAxis GapLength="0.5" LabelFormatter="{Binding DateLabelFormatter}" PlotMode="BetweenTicks" MajorStepUnit="Day" MajorStep="1" />


    with my formatter just like that :

        public class DateLabelFormatter : LabelFormatterBase<DateTime>
            public override string FormatTypedValue(DateTime value)
                DateTimeFormatInfo dateTimeFormats = new CultureInfo("fr-FR").DateTimeFormat;
                return value.ToString("ddd", dateTimeFormats).ToUpper();


    But nothing work, please I need some help ...

  2. Yana
    Yana avatar
    5044 posts

    Posted 29 Dec 2017 Link to this post

    Hi Maxence,

    You will need to add the DateLabelFormatter to the Resources section of the ContentPage and reference it as a StaticResource instead, please check the following snippet:

                <local:DateLabelFormatter x:Key="DateLabelFormatter" />

    and inside the Chart definition:

        <telerikChart:DateTimeContinuousAxis GapLength="0.5" LabelFormatter="{StaticResource DateLabelFormatter}" PlotMode="BetweenTicks" MajorStepUnit="Day" MajorStep="1" />

    I hope this will be helpful.

    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top