Мое предложение изменить цвет всплывающей подсказки и цвет линии.Я использовал параметр всплывающей подсказки shared:true
, чтобы собрать все серии, а затем события в каждой серии для правильного цвета.
let color = null,
colorIndex = null,
colors = ['rgba(200,150,168,0.5)', 'rgba(120,250,60,0.5)',
'rgba(40,250,208,0.5)', 'rgba(90,10,208,0.5)'];
plotOptions: {
series: {
events: {
mouseOver: function() {
color = (colors[this.index]).replace('0.5', '1');
colorIndex = this.index;
this.chart.series[this.index].update({
color: color
});
},
mouseOut: function() {
this.chart.series[this.index].update({
color: colors[this.index]
});
}
}
}
},
tooltip: {
useHTML:true,
formatter: function() {
s = '<b>' + this.points[0].key + '</b><br/>';
this.points.forEach(function(point, index) {
if (index !== colorIndex){
s += '<span style="color:' + point.color
+ ';margin-right:2px">\u25CF</span> <span style="color: #c6c6c6">'
+ point.series.name
+ ': <b>' + point.y + ' ' + '</b><br>';
} else{
s += '<span style="color:' + point.color
+ ';margin-right:2px">\u25CF</span> <span style="color: #000">'
+ point.series.name
+ ': <b>' + point.y + ' ' + '</b><br>';
}
});
return s;
},
shared: true
}
API - mouseOver / mouseOut
API - средство форматирования всплывающей подсказки
Fiddle