Format the value (HH:mm:ss) on the top of the bars

2 posts, 0 answers
  1. Luka
    Luka avatar
    7 posts
    Member since:
    Mar 2013

    Posted 05 Apr 2013 Link to this post

    I have the WPF:

    <telerik:RadChart x:Name="reasonChart" ItemsSource="{Binding ReasonChart, Mode=TwoWay}">
            <telerik:SeriesMapping LegendLabel="Devices">
                    <telerik:ItemMapping DataPointMember="Label" FieldName="Value"></telerik:ItemMapping>
                    <telerik:ItemMapping DataPointMember="YValue" FieldName="Value"></telerik:ItemMapping>
                    <telerik:ItemMapping DataPointMember="XCategory" FieldName="Label"/>

    Instead of the Value for the Label I would like to format the seconds in the HH:mm:ss format! See the image attached!
    Excepted result:
    120s => 00:02:00
  2. Petar Kirov
    Petar Kirov avatar
    425 posts

    Posted 09 Apr 2013 Link to this post

    Hi Luka,

    You can introduce a Label property to your data item class like this: 
    public string Label
            return TimeSpan.FromSeconds(this.Value).ToString();
    and then bind the series item labels to it: 
    <telerik:ItemMapping DataPointMember="Label" FieldName="Label"/>

    I hope this helps.
    All the best,
    Petar Kirov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top