Reputation: 181
I have one WorldMap by HighCharts in one application. I need to translate my country labels to Portuguese but I can't find a way to do it. I'm feeding my world chart with the following:
series: [
{
data: myDataSeries,
name: 'Projects',
states: {
hover: {
color: '#BADA55'
}
},
dataLabels: {
enabled: true,
format: '{point.name}'
}
}
]
It's possible to change the dataLabels language? I can't find a way.
Upvotes: 1
Views: 556
Reputation: 5826
Highcharts doesn't provide the language customization, so it needs to be done manually.
datalabels.formatter
is a good place to perform translation:
function translate(englishName) {
if (englishName === "Russia") {
return "Rosja"; // translated
}
return englishName;
}
(...)
dataLabels: {
enabled: true,
formatter: function() {
return translate(this.point.name);
}
}
Live demo: http://jsfiddle.net/kkulig/m6vaume1/
API reference: https://api.highcharts.com/highmaps/series.map.dataLabels.formatter
Upvotes: 1