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

Formatting Dates in ToolTip Client Template

2 Answers 323 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Jenn
Top achievements
Rank 1
Jenn asked on 11 Nov 2014, 06:32 PM
In a Column Chart, I am trying to format a date in a Tooltip's ClientTemplate and  I can't seem to figure it out.

On the Y-Axis I have dollar amounts, on the X-Axis I have the 24 hours of the day (12am, 1am, 2am, ... 11pm). The X-Axis labels work fine (well, I wish I could lowercase the AM/PM, but that's another issue) using the following:

<LabelsAppearance DataFormatString="htt" RotationAngle="0" />

Unfortunately, when I use the following ToolTips template the X-Axis value renders as a long format date like "Tue Nov 11 2014 03:00:00 GMT-0600 (Central Standard Time)" rather than "3AM":

<TooltipsAppearance BackgroundColor="#ffffff" Color="#5ab7de">
  <ClientTemplate>
    <div><b>#=category#</b></div>
    <div>$#=value#</div>
  </ClientTemplate>
</TooltipsAppearance>

How do I get #=category= to format my date like this: 4PM?

2 Answers, 1 is accepted

Sort by
0
Jenn
Top achievements
Rank 1
answered on 12 Nov 2014, 10:08 PM
Well, to answer my own question. This took me forever to find in the documentation... because it's not in the documentation, rather it is on a demo page for Date Axis:

#= kendo.format(\'{0:htt}\', category) #
0
Danail Vasilev
Telerik team
answered on 14 Nov 2014, 09:16 AM
Hello Jenn,

You may also find useful the following help article that shed more light on the matter:
  • Formatting Dates - List of standard and custom date formats.
  • Formatting Numbers- The section "Formatting Labels and Tooltips by using their Client Templates" provides an example on how to format values in templates.
  • Overview - Shows how to configure templates.

Regards,
Danail Vasilev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Chart (Obsolete)
Asked by
Jenn
Top achievements
Rank 1
Answers by
Jenn
Top achievements
Rank 1
Danail Vasilev
Telerik team
Share this question
or