Reputation: 1402
I want to display custom text in tooltip. When I use my code, I got Cannot read property 'length' of undefined
when I hover on tooltip.
Does someone knows where's the problem?
tooltip: {
shared: false,
formatter: function() {
var serie = this.series;
var s = '<span style="color:' + serie.color + '">' + serie.options.name + '</span>: <b>' + this.y + '</b><br/>';
$.each(serie.options.composition, function(name, value) {//Error pop ups here
s += '<b>' + name + ':</b> ' + value + '<br>';
});
return s;
}
}
EDIT - Added error message:
Uncaught TypeError: Cannot read property 'length' of undefinedm.extend.each @ jquery.min.js:2$.highcharts.tooltip.formatter @ grafovi.php:823Mb.refresh @ highcharts.js:160Va.runPointActions @ highcharts.js:166Va.onContainerMouseMove @ highcharts.js:174Va.setDOMEvents.b.onmousemove @ highcharts.js:176
Upvotes: 2
Views: 2240
Reputation: 1944
As for comment check that serie.options.composition
exists and is an array
.
Upvotes: 1