Reputation: 485
I have a Highcharts line chart and have tooltips enabled, however, I would like to change the background color of tooltip for just a single data point on the chart.
Is it possible to do so?
What I have so far
tooltip: {
formatter: function () {
return this.y;
},
backgroundColor: '#68BD49',
borderColor: '#000000',
borderWidth: '1'
},
Upvotes: 1
Views: 3449
Reputation: 37588
Yes it is possible, by using HTML option and define custom parameters. Obviously you can use CSS styles / classes disable padding/margins, but in the simplest way you can achive this in this way:
tooltip: {
useHTML:true,
formatter: function() {
console.log(this);
if(this.point.customBck)
return '<div style="background-color:red;">The value for <b>'+ this.x + '</b> is <b>'+ this.y +'</b></div>';
else
return '<div>The value for <b>'+ this.x + '</b> is <b>'+ this.y +'</b></div>';
}
},
Upvotes: 1