Hello,
We have an issue where encoded characters (for example: ö) in the chart category field cause the label to be misaligned.
You can see this in the following dojo example here: https://dojo.telerik.com/aMEYaziy
This dojo is based on your example (https://demos.telerik.com/kendo-ui/bar-charts/index) but I've added an encoded 'รถ' character to the label for Februrary.
In our application we are passing our the labels down via ajax, and defining the field in series.categoryField (as oposed to the hard-coded values in your demo and dojo), but the effect is the same.
Please let us know what the problem is and how we can resolve it.
Thank you,
George
Hello, George,
The link to the public item is below:
Regards,
Alex Hajigeorgieva
Progress Telerik
Hi,
That's fine.
Thanks.
Hello, George,
Would you mind if I convert this thread to a public Feedback item so others can upvote it?
The more popularity an item gets, the sooner it gets pushed forward for implementation because of the higher impact it has.
Let me know if you would like me to do that.
Kind Regards,
Alex Hajigeorgieva
Progress Telerik
Thanks Alex,
I've got that working in our app. Thanks very much for your help.
Could I suggest that you raise this with your development team, so that html-encoded text is handled without work-arounds in future?
Many thanks,
George
Hello, George,
For the remote binding scenario, you can use either option:
https://dojo.telerik.com/EnOweVuL/2
schema:{
model: {
fields:{
month: { parse: decodeEntities } // where month is the categoryField
}
}
}
https://dojo.telerik.com/@bubblemaster/ikELUBOG
requestEnd: function(e){
var data = e.response;
for(var i=0; i< data.length; i++){
data[i].month = decodeEntities(data[i].month);
}
return data;
}
Kind Regards,
Alex Hajigeorgieva
Progress Telerik
Hi Alex,
Thanks for the response. How do these solutions apply when the categories are sent via ajax, after the chart control is initialised?
As I said, we receive the categories via ajax, and use the series.categoryField configuration to specify the field from which to read the text value.
i.e. https://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart/configuration/series.categoryfield
Thanks,
George
Hello, George,
To overcome this issue, you can decode the categories before passing them to the chart:
function decodeEntities(input) {
return $("<div>").html(input).text();
}
var categories = ["Jan", "Febö", "Mar", "Apr", "May", "Jun"].map(decodeEntities);
https://dojo.telerik.com/@bubblemaster/eJapISiW/2
There is another way of including HTML entities as illustrated in this how-to article:
https://docs.telerik.com/kendo-ui/controls/charts/how-to/various/html-in-axes-labels
Kind Regards,
Alex Hajigeorgieva
Progress Telerik