2013-03-27 56 views
1

在Highcharts,我有我的数据设置像这样:额外的数据不适用于提示

var data = [{ 
    x: Date.UTC(2011, 10, 1), 
    y: 1.9, 
    variance: 2.6 
}, { 
    x: Date.UTC(2011, 11, 1), 
    y: 2.0, 
    variance: 2.6 
}...]; 

我想在我的工具提示使用方差值。但方差值不会显示在工具提示格式化程序可用的点对象中。我错过了什么?

的jsfiddle:http://jsfiddle.net/hofo/um7f6/17/

回答

1

修复您的格式字符串如下:

var tooltipString = "Highcharts.dateFormat('%b-%y', this.x) + ' survey<br>Average inflation expectations: ' + this.y + '<br>Variance ' + point.point.variance";

然后你应该添加到您的detailChart数据。

变化detailData.push(point.y);detailData.push(point.options);

Demo

+0

八九不离十。我实际上不得不使用point.point.options.variance – hofo 2013-03-28 16:14:24

1

请大家看一下类似的例子http://jsfiddle.net/fbMQf/119/

tooltip:{ 
    formatter:function(){ 
     return '<b>' + this.series.name + '</b>' + 
     '<br/><b>X Value:</b> ' + this.x + 
     '<br/><b>Y Value:</b> ' + this.y + 
     '<br/><b>Other Data:</b> ' + this.point.note; 
    } 
},