Axis label formatting for the Bar chart

4 posts, 0 answers
  1. Zakk
    Zakk avatar
    2 posts
    Member since:
    May 2018

    Posted 31 Jan Link to this post

    Hello!

    I have one problem with creating custom formatting for axis label of the bar chart.

    I have time in Seconds (int) as Data Source for X Axis but I need to display this in format HH:MM  (and HH can be more than 24).

     

    My project with build-in csv data: https://dropmefiles.com/pWr9e

    I will appreciate any help! Thanks! 

     

  2. Silviya
    Admin
    Silviya avatar
    354 posts

    Posted 05 Feb Link to this post

    Hello Eugene,

    You can use an user function to convert the integer (seconds) into DateTime or correctly formatted string. For example check out the following code snippet:
    public static string ConvertToFormat(int seconds)
    {
        TimeSpan t = TimeSpan.FromSeconds(seconds);
        return string.Format("{0:D2}:{1:D2}:{2:D2}",
            (int)t.TotalHours,
            t.Minutes,
            t.Seconds);
     
    }

    You could refer to What is the best way to convert seconds into (Hour:Minutes:Seconds:Milliseconds) time? and/or How to convert seconds to HH:MM:ss format public threads.

    Regards,
    Silviya
    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
  3. Zakk
    Zakk avatar
    2 posts
    Member since:
    May 2018

    Posted 06 Feb in reply to Silviya Link to this post

    Hello Silviya!

    Thanks for reply!

    Can I use\create an user functions in reports created by "Telerik Report Designer (.trdp)" ? 

  4. Silviya
    Admin
    Silviya avatar
    354 posts

    Posted 06 Feb Link to this post

    Hi Zakk,

    Basically, there is no difference when using custom user functions in Type (.CS) and Declarative (.TRDP) reports. 
    The custom function could be any public static method that resides in a loaded assembly can be invoked from an expression by its fully qualified name, including the full namespace and the name of the type it belongs to, and specifying the necessary parameters in the braces - check User Functions article.

    In order the custom function to be accessible in Standalone Designer, it would be necessary to register the corresponding assembly in the designer's config file, as explained in the Extending Report Designer article. The custom functions appear under Functions->Misc section.

    Regards,
    Silviya
    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