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

ClientTemplate - Math Round \ String Format with no decimals

2 Answers 370 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Yaniv
Top achievements
Rank 1
Yaniv asked on 06 Mar 2014, 01:10 PM
Hi,
I can get any data with the client template and it works fine, but i cannot find a way to round a 'Double' value as math round or in string.Format("C0")
in the client template. I want to round the dataItem.QuoteSumDollars which is a 'Double' with no decimal digits.
Here is my HtmlChart Series:

                           <Series>
                            <telerik:LineSeries Name="Quote" DataFieldY="QuoteSumDollars">
                                <LabelsAppearance>
                                    <ClientTemplate>
                                         #=dataItem.QuoteSumDollars#
                                    </ClientTemplate>
                                </LabelsAppearance>
                                <TooltipsAppearance>
                                    <ClientTemplate>
                                        Quote #=dataItem.QuoteID#
                                    </ClientTemplate>
                                </TooltipsAppearance>
                            </telerik:LineSeries>
                        </Series>

Many thanks.

2 Answers, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 10 Mar 2014, 12:06 PM
Hello Yaniv,

You can use the kendo.format() method in order to format values in templates. More information on the matter is available in Formatting Numbers help article, in the section called Formatting Labels and Tooltips by using their Client Templates.

Regards,
Danail Vasilev
Telerik

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

0
Yaniv
Top achievements
Rank 1
answered on 18 Mar 2014, 09:01 AM
Thanks!
It worked by doing:

 #=dataItem.QuoteSumDollars.format("N0")#
Tags
Chart (HTML5)
Asked by
Yaniv
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Yaniv
Top achievements
Rank 1
Share this question
or