Вы можете настроить форматирование меток следующими способами:
Обратите внимание, что вам нужно будет предоставить таблицу перевода для сопоставления ваших нежелательных название страны на ту, которую вы хотите. Например:
countries = {
Brazil1: 'Wanted Brazil1 name',
Canada1: 'Wanted Canada1 name',
};
Подсказки
В этом форматере к точке данных { from, to, weight }
можно получить доступ через this
, поэтому мы можем написать:
tooltip: {
pointFormatter: function() {
console.log('tooltip formatter', this);
point = this;
from = countries[point.from] || point.from;
to = countries[point.to] || point.to;
weight = point.weight
return from + ' → ' + to + ': ' + weight;
},
},
Метки на узлах
В этом устройстве форматирования можно получить доступ к стране через this.key
, поэтому мы можем написать:
dataLabels: {
nodeFormatter: function() {
console.log('node formatter', this);
return countries[this.key] || this.key;
},
},
Метки на стрелках
В этом форматере точка доступа { from, to, weight }
может быть доступна через this.point
, поэтому мы можем написать:
dataLabels: {
formatter: function() {
console.log('formatter', this);
point = this.point;
from = countries[point.from] || point.from;
to = countries[point.to] || point.to;
weight = point.weight
return from + ' → ' + to + ': ' + weight;
},
},
Вы можете увидеть это в действии здесь: https://jsfiddle.net/Metoule/q80t36ay/1/