This is a migrated thread and some comments may be shown as answers.

Axis label formatting for the Bar chart

3 Answers 200 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Zakk
Top achievements
Rank 1
Zakk asked on 31 Jan 2019, 03:10 PM

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! 

 

3 Answers, 1 is accepted

Sort by
0
Silviya
Telerik team
answered on 05 Feb 2019, 11:47 AM
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
0
Zakk
Top achievements
Rank 1
answered on 06 Feb 2019, 11:48 AM

Hello Silviya!

Thanks for reply!

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

0
Silviya
Telerik team
answered on 06 Feb 2019, 12:21 PM
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
Tags
General Discussions
Asked by
Zakk
Top achievements
Rank 1
Answers by
Silviya
Telerik team
Zakk
Top achievements
Rank 1
Share this question
or