我在帖子中发布了同样的问题:highcharts pass multiple values to tooltip
我想将数据传递给工具提示但this.point.config[2]
不工作。我也找到了这个例子。它也不在那里工作
formatter: function() {
return 'param1: '+this.point.config[2] + 'param2: '+this.point.config[3];
你能帮我么
我在帖子中发布了同样的问题:highcharts pass multiple values to tooltip
我想将数据传递给工具提示但this.point.config[2]
不工作。我也找到了这个例子。它也不在那里工作
formatter: function() {
return 'param1: '+this.point.config[2] + 'param2: '+this.point.config[3];
你能帮我么
如果您想将额外的值传递到工具提示中,数据系列需要是对象列表而不是值列表:
data: [
{
x: 7,
y: 10,
config1: 'test', // our custom data
config2: 'test2' // our custom data
},
{
x:10,
y:20,
config1: 'test3', // our custom data
config2: 'test4' // our custom data
}
]
因此,在您的 Highchartsformatter
函数中,您可以引用自定义参数,例如。config1
和config2
(你可以使用任何你想要的名字):
tooltip: {
formatter: function() {
return 'param1: '+this.point.config1 + '<br/>param2: '+this.point.config2;
}
}
见小提琴:http: //jsfiddle.net/FuyTC/8/