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

angular expression not compiled in chart templates

2 Answers 34 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Anna
Top achievements
Rank 1
Anna asked on 01 Oct 2015, 08:24 PM

Hi,

Angular expression in template 

I found in quiet a few places in kendo charts, angular expressions in templates are not compiled like in other widget, like grid. Few places I found are:

  1. valueAxis label template: 
  2. series tooltip template

I want to use angular expression to scale the value by thousands, or millions depending on selected option​. So $23,000 scale by thousands become $23k. But now, the angular expression is ignored.

live example: http://plnkr.co/edit/oe6Hzr92VARij1jOtUV6?p=preview

Scaling Specifier in string format 

I don't really need angular expression if the kendo's default string format support the Scaling Specifier (,) like in c#.

"," serves as both a group separator and a number scaling specifier. As a group separator, it inserts a localized group separator character between each group. As a number scaling specifier, it divides a number by 1000 for each comma specified.

Group separator specifier:
2147483647 ("##,#", en-US) -> 2,147,483,647
2147483647 ("##,#", es-ES) -> 2.147.483.647
Scaling specifier:
2147483647 ("#,#,,", en-US) -> 2,147
2147483647 ("#,#,,", es-ES) -> 2.147

Can you get the templates to read angular expression or match the scaling specifier in c# string format? Or better yet make both them work? 

Best,

Ama

 

2 Answers, 1 is accepted

Sort by
0
Accepted
T. Tsonev
Telerik team
answered on 06 Oct 2015, 07:52 AM
Hello,

Please accept my apologies for the delayed response.

Angular expressions are not expected to work in the context of the Chart widget. This is due to the fact that it supports multiple rendering modes.
Only one of them (SVG) is actually part of the DOM. Even then it's in a nested document.

A full list of the widgets that support templates is available in the documentation.

As for the second question, I'm afraid we don't support scaling. For the moment I can only recommend setting the template directly:
template: '#= "$" + (value / 1000.0) + "k" #'

Or even:
template: function(data) {
  return $scope.scaleByThousands(data.value);
}

I hope this helps.

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Anna
Top achievements
Rank 1
answered on 06 Oct 2015, 05:38 PM

Hi T.

Thanks for replying. It's unfortunate to hear that the scaling specifier is not supported in kendo string format. But thanks for letting me know about the template function. It solves most of my needs to use angular expression in template.

template: function(data) {
  return $scope.scaleByThousands(data.value);
} 

Best,

 

Ama

Tags
Charts
Asked by
Anna
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Anna
Top achievements
Rank 1
Share this question
or