Reputation: 4100
I have created a Stockchart with two data series, the second series has the attribute linkedTo: ':previous'
In the tooltip the name of the series appears two times (because the same series is added twice), I want to show the name only once.
Please see the jsFiddle
I am trying to see the tooltip as:
Upvotes: 1
Views: 189
Reputation: 1871
In the $.each(this.points, function(i, point) {
part you loop over the points for the tooltip.
One possible solution is to only add the point.series.name
for the first point. And luckily you can check this with the i
argument.
formatter: function() {
var s = [];
$.each(this.points, function(i, point) {
var content = '<span style="color:#D31B22;font-weight:bold;">'
if (i === 0) {
content += point.series.name + ': ';
}
content += point.y;
content += '</span>';
s.push(content);
});
return s.join(' and ');
}
https://jsfiddle.net/mg1cm7ye/7/
Upvotes: 3