The localisation quick fix http://www.telerik.com/help/aspnet-ajax/htmlchart-accessibility-and-internationalization-localization.html works fine, but in my master page site it fails and the default $ is displayed.
Does anybody know why a master page site messes this up?
8 Answers, 1 is accepted
I have already replied to the support ticket that was opened by on the matter and I paste my answer below, so that the rest of the forum members can benefit of it.
Placing the script reference and kendo culture change code in the master page works properly for charts in the master page as well as charts in the content page on my side. Can you try the attached VS example and then tell me whether it works as expected?
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.
Hi,
i have a lot of problems with the HTMLChart and the localization stuff. After a few hours of reading topics and forum-posts i still can't get it to work correct.
I have 2 MasterPage-Files. MainPage.master for all main-views, and EditPage.master for all edit Frames (RadWindow-Contents)
I have the same script-setup in those files (see picture 01, 02).
In EditPage everything works as excpected but in MainPage it always chrashes saying "the Object doesnt support the Property or Method 'culture' "
Picture 03 shows how the resources are loaded.
Picture 04 shows how the Object -kendo- looks like in MainPage.Master.
What happens here? Any help appreciated.
It looks like the kendo object is not initialized yet for some reason. I would suggest that you open a support ticket (requires a subscription) where you can attach a runnable sample that reproduces the issue, so that I can investigate it further.
Regards,
Danail Vasilev
Telerik
Hi Danail,
it felt like i messed something up so i removed every single bit and restarted it along with your descritptions about localization.
Right now i have the initialization of the kendo-object right and the resourcefile is loaded correctly. Never the less everything stayed in english, although i inspected the kendo-object at runtime and saw that cultures.current was 'de-DE'. Very strange.
I copied one of your demo chasrts to see if it fails the same way, but it didn't. Again i thought - very strange.
Finally i realised what the problem was. I used ClientTemplates for the LabelsAppearance like this:
<
LabelsAppearance
DataFormatString
=
"N1"
>
<
ClientTemplate
>
#if(value > 0){# #=value# #}#
</
ClientTemplate
>
</
LabelsAppearance
>
This doesn't work with localization on my end. When i remove the clientTemplate-block everything works as expected, with clientTemplate all stays english. Am i missing something here or do a mistake?
Thanks for your support
Hello Phillip,
You can do this via the kendo.format() method:
- http://docs.telerik.com/devtools/aspnet-ajax/controls/htmlchart/appearance-and-styling/format-numbers#formatting-labels-and-tooltips-by-using-their-client-templates.
- http://docs.telerik.com/kendo-ui/api/javascript/kendo#methods-format.
Here is a basic example:
<
LabelsAppearance
>
<
ClientTemplate
>
#if(value > 0){# #= kendo.format(\'{0:C1}\', value)# #}#
</
ClientTemplate
>
</
LabelsAppearance
>
Regards,
Marin BratanovTelerik
Hello Marin,
perfect! Everything fine now. Thank you all for your great support (as always).
Right now i really enjoy the htmlChart-Control as a excellent visualisation tool.
Also the clientExportManager is a nice addition to the the controls (i thought of doing this by myself a year ago but had no time ^^).
Best regards,
Philipp
How to format the yaxis label based on the culture? The following code always renders the yaxis in EN format instead of FR, when the user loaded in FR mode. Y axis will be having amount value.
<script src="js/kendo.all.min.js"></script>
<script src="js/kendo.culture.en-CA.min.js"></script>
<script src="js/kendo.culture.fr-CA.min.js"></script>
kendo.culture("<%=GetCultureString()%>");
<PlotArea>
<YAxis>
<LabelsAppearance DataFormatString="C" />
</YAxis>
I tried this as well, but didnt work
<YAxis> <LabelsAppearance> <ClientTemplate> #if(value > 0){# #= kendo.format(\'{0:C1}\', value)# #}# </ClientTemplate></LabelsAppearance>
Let's keep this in your own thread on this where you already have my answer: https://www.telerik.com/forums/chart-localization-f01f5663f4d3.
Regards,
Marin Bratanov
Progress Telerik