i want show multiple data in tooltip but highstock's example is only one data in tooltip
i tried find ask and example, but I could only find examples for highchart
==============================================================
my code > (tooltip's abc and toto is show undefined )
series: [{
name: '',
data: [{
x:1452870000000,
y: 56.33,
abc: 'Microsoft Internet Explorer',
toto:'op'
}, {
x:1453870000000,
y: 24.03,
abc: 'Chrome',
toto:'uo'
}, {
x:1455870000000,
y: 10.38,
abc: 'Firefox',
toto:'fq'
}
],
marker: {
enabled: true,
radius: 3
},
shadow: true
}],
tooltip: {
formatter: function() {
return '<span>'+this.point.abc+this.point.toto+'</span>';
}
}
Use the option shared:true in the tooltip section to show data of all series at the same time on the tooltip:
tooltip: {
shared:true
},
check the jsfiddle
$(function () {
var seriesOptions = [],
seriesCounter = 0,
names = ['MSFT', 'AAPL', 'GOOG'];
/**
* Create the chart when all data is loaded
* @returns {undefined}
*/
function createChart() {
$('#container').highcharts('StockChart', {
rangeSelector: {
selected: 4
},
yAxis: {
labels: {
formatter: function () {
return (this.value > 0 ? ' + ' : '') + this.value + '%';
}
},
plotLines: [{
value: 0,
width: 2,
color: 'silver'
}]
},
plotOptions: {
series: {
compare: 'percent',
showInNavigator: true
}
},
tooltip: {
pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.change}%)<br/>',
valueDecimals: 2,
//split: true,
shared:true
},
series: seriesOptions
});
}
$.each(names, function (i, name) {
$.getJSON('https://www.highcharts.com/samples/data/jsonp.php?filename=' + name.toLowerCase() + '-c.json&callback=?', function (data) {
seriesOptions[i] = {
name: name,
data: data
};
// As we're loading the data asynchronously, we don't know what order it will arrive. So
// we keep a counter and create the chart when all the data is loaded.
seriesCounter += 1;
if (seriesCounter === names.length) {
createChart();
}
});
});
});
You can get more information about how to use the tooltip option here.