Hi,
we are using several charts in our application. Due to internatiolaisation we want to change the label formatters for dates and other automatically rendered values.
As we don't want to edit every single chart instance by hand, we are looking for a way to set the default formatters and renderers globally.
How can we do it? Why ist it not described in the culture packages?
Thanks
we are using several charts in our application. Due to internatiolaisation we want to change the label formatters for dates and other automatically rendered values.
As we don't want to edit every single chart instance by hand, we are looking for a way to set the default formatters and renderers globally.
How can we do it? Why ist it not described in the culture packages?
Thanks
6 Answers, 1 is accepted
0
Hello Andreas,
I am afraid it is not possible to globally change the labels and other formatting options of the Chart widget.
However you can extend a widget like shown here with the options that you want and then use your own widget to initialize it with your predefined options (you can extend existing widget the same way as demonstrated to extend a Base Widget).
Or you can simply use an object literal with all predefined settings and then extend it with particular options before creating a Chart widget.
Kind Regards,
Petur Subev
Telerik
I am afraid it is not possible to globally change the labels and other formatting options of the Chart widget.
However you can extend a widget like shown here with the options that you want and then use your own widget to initialize it with your predefined options (you can extend existing widget the same way as demonstrated to extend a Base Widget).
Or you can simply use an object literal with all predefined settings and then extend it with particular options before creating a Chart widget.
Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Andreas
Top achievements
Rank 1
answered on 03 Jan 2014, 04:50 PM
Hey, thanks for your reply and a happy new year.
I don't really need to customize the formats, I would be happy if I could tell the labels to use the culture.de.min.js
I tried to set the culture property on the category axis's labels property, but nothing happened.
categoryAxis: {
field: "date",
baseUnit: "days",
labels : {
culture : "de",
step : 3
}
}
It still renders as M/y which is not really german ;)
The docs say it should work: http://docs.kendoui.com/api/dataviz/chart#configuration-categoryAxis.labels.culture
I don't really need to customize the formats, I would be happy if I could tell the labels to use the culture.de.min.js
I tried to set the culture property on the category axis's labels property, but nothing happened.
categoryAxis: {
field: "date",
baseUnit: "days",
labels : {
culture : "de",
step : 3
}
}
It still renders as M/y which is not really german ;)
The docs say it should work: http://docs.kendoui.com/api/dataviz/chart#configuration-categoryAxis.labels.culture
0
Hello Andreas,
Did you add the needed culture JavaScript file?
http://docs.kendoui.com/getting-started/framework/globalization/overview
Here is an example:
http://jsbin.com/oDOkAne/2/edit
Kind Regards,
Petur Subev
Telerik
Did you add the needed culture JavaScript file?
http://docs.kendoui.com/getting-started/framework/globalization/overview
Here is an example:
http://jsbin.com/oDOkAne/2/edit
Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Andreas
Top achievements
Rank 1
answered on 06 Jan 2014, 02:33 PM
Yes, I do include the correct culture file.
I edited your jsbin and removed the "format" property, because I want kendo to handle the format according to the given culture.
The only thing that changes if I set the culture are the month and day names, but not the chart's formats. In my opinion, they belong to a culture because in other cultures 01/02/2014 is not the second of january 2014 :)
I edited your jsbin and removed the "format" property, because I want kendo to handle the format according to the given culture.
The only thing that changes if I set the culture are the month and day names, but not the chart's formats. In my opinion, they belong to a culture because in other cultures 01/02/2014 is not the second of january 2014 :)
0
Accepted
Hello Andreas,
Thank you for clarifying. These formats are coded inside the chart and the order of the months / days does not depend on the current culture. Here is how the default values for the labels.dateFormats property are:
http://docs.kendoui.com/api/dataviz/chart#configuration-categoryAxis.labels.dateFormats
You can try and manually change them based on the current culture that is loaded. (kendo.culture() to get the object representing the current culture)
Kind Regards,
Petur Subev
Telerik
Thank you for clarifying. These formats are coded inside the chart and the order of the months / days does not depend on the current culture. Here is how the default values for the labels.dateFormats property are:
http://docs.kendoui.com/api/dataviz/chart#configuration-categoryAxis.labels.dateFormats
var DateLabelFormats = {
seconds: "HH:mm:ss",
minutes: "HH:mm",
hours: "HH:mm",
days: "M/d",
weeks: "M/d",
months: "MMM 'yy",
years: "yyyy"
};
You can try and manually change them based on the current culture that is loaded. (kendo.culture() to get the object representing the current culture)
Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Andreas
Top achievements
Rank 1
answered on 09 Jan 2014, 08:47 AM
Alright, thanks for helping me :)
It would be great if the formats, too, would make it into the culture files somewhen!
It would be great if the formats, too, would make it into the culture files somewhen!